component¶
Required: No
Type: List of objects
Condition: No
List of components to be added to the project.
| Key | Required | Type | Description |
|---|---|---|---|
id |
Yes | String | ID of the component |
instance |
If instantiable | List of strings | List of instance names if the component is instantiable. Since instance names must be usable as variables in C code, input must be restricted to /[A-Za-z0-9_]+/. |
vendor |
No | String | The vendor of the SDK extension the component is from. Only the vendors listed under extension/vendor or sdk/vendor key may be used. |
package |
No | String | The ID of the SDK extension the component is from. Only SDK extensions listed using the extension/id or sdk/id key may be used. |
condition |
No | List of features | The component is added if all the given features are present |
The id, package, and vendor fields together form a component reference. For details on what a component reference is, and how the package and vendor fields affect resolution, see the component reference.
A component reference may be listed multiple times with different conditions. If any of the entries apply to the project — that is, if the features to activate the condition are present — the component is added to the project. If the component is instantiable and multiple entries apply but provide different lists of instances, the union of all instances requested by the applicable entries are created.
Example
Basic example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
In the above example, the components tuna and bass are searched across all SDKs and extensions. The component marlin is searched across all SDKs and extensions, but limited to the grocer vendor. The component cod is searched across all SDKs and extensions, but limited to the atlantic package. The component salmon is searched only within the pacific package by the fishmonger vendor.
Example of multiple instances across multiple entries:
1 2 3 4 5 6 7 8 9 10 11 12 | |
If the features tuna and cod are present, the component foo is instantiated with the instances one, two, four and five. The two requests for an instance four are deduplicated. The instance three is not created, since salmon is not present.