Skip to content

source

Required: No
Type: List of source files
Condition: Yes

List of files that shall be referenced as source files in the exported IDE project.

Key Required Type Description
path Yes Path to source file
project No Map of project properties Actions to perform on the source file when adding to a project
condition No List of features The source file is added if all the given features are present
unless No List of features The source file is added unless any of the given features are present
1
2
3
4
source:
  - path: em_usart.c
    condition:
      - device_has_usart

Project properties

In certain cases, it is desired to use a component to pre-load a project with a starting point for a source file. The project properties map contains actions to perform on the source file when generating the project. The only supported action is to copy the source file into the project, transferring ownership to the user.

Key Required Type Description
transfer_ownership Yes Boolean If true, ownership of the file is transferred to the project. This copies the file from the component into the project.
directory No String Subdirectory relative to the project root to place the copied file. If not set, the file is copied to the project root directory.

Ownership transfer is a one-shot operation. If a file with the same name already exists in the project at the given location, it is not overwritten by subsequent project generation actions.

The source file is not added to the .slcp file when ownership is transferred. If the component transferring ownership is removed from the project, the file stays on disk, but is no longer referenced by any part of the project or its dependencies. It is up to the user at this point to decide whether to manually add the source file to the project or not.

1
2
3
4
source:
  - path: main.c
    project:
      transfer_ownership: true
Back to top