Skip to content

Commit

Permalink
[projmgr] Extend cbuild-idx with layer configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored Mar 25, 2024
1 parent 7e591ed commit 7c39ecb
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 40 deletions.
11 changes: 11 additions & 0 deletions tools/projmgr/include/ProjMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@

#include <cxxopts.hpp>

/**
* @brief Error return codes
*/
enum ErrorCode
{
SUCCESS = 0,
ERROR = 1,
VARIABLE_NOT_DEFINED
};

/**
* @brief projmgr class
*/
Expand Down Expand Up @@ -131,6 +141,7 @@ class ProjMgr {
bool m_contextSet;
bool m_relativePaths;
bool m_frozenPacks;
bool m_updateIdx;
GroupNode m_files;
std::vector<ContextItem*> m_processedContexts;
std::vector<ContextItem*> m_allContexts;
Expand Down
2 changes: 1 addition & 1 deletion tools/projmgr/include/ProjMgrUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef std::vector<const ConnectItem*> ConnectPtrVec;
*/
struct ConnectionsCollection {
const std::string& filename;
const std::string& type;
const std::string type;
ConnectPtrVec connections;
ConnectionsCollection& operator=(const ConnectionsCollection& c) { return *this; };
ConnectionsCollection(const ConnectionsCollection& c) = default;
Expand Down
2 changes: 2 additions & 0 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ class ProjMgrWorker {
bool ProcessGlobalGenerators(ContextItem* context, const std::string& generatorId,
std::string& projectType, StrVec& siblings);

bool HasVarDefineError();
protected:
ProjMgrParser* m_parser = nullptr;
ProjMgrKernel* m_kernel = nullptr;
Expand Down Expand Up @@ -639,6 +640,7 @@ class ProjMgrWorker {
bool m_debug;
bool m_dryRun;
bool m_relativePaths;
bool m_varDefineError;
StrMap m_packMetadata;

bool LoadPacks(ContextItem& context);
Expand Down
4 changes: 4 additions & 0 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static constexpr const char* YAML_COMPONENT = "component";
static constexpr const char* YAML_COMPONENTS = "components";
static constexpr const char* YAML_CONDITION = "condition";
static constexpr const char* YAML_CONFIGURATION = "configuration";
static constexpr const char* YAML_CONFIGURATIONS = "configurations";
static constexpr const char* YAML_CONNECT = "connect";
static constexpr const char* YAML_CONNECTIONS = "connections";
static constexpr const char* YAML_CONSTRUCTEDFILES = "constructed-files";
Expand Down Expand Up @@ -143,7 +144,10 @@ static constexpr const char* YAML_SELECTED_BY_PACK = "selected-by-pack";
static constexpr const char* YAML_SETUPS = "setups";
static constexpr const char* YAML_SETUP = "setup";
static constexpr const char* YAML_SET = "set";
static constexpr const char* YAML_SETTINGS = "settings";
static constexpr const char* YAML_SWITCH = "switch";
static constexpr const char* YAML_TARGET_CONFIGURATIONS = "target-configurations";
static constexpr const char* YAML_TARGETTYPE = "target-type";
static constexpr const char* YAML_TARGETTYPES = "target-types";
static constexpr const char* YAML_TRUSTZONE = "trustzone";
static constexpr const char* YAML_CORE = "core";
Expand Down
91 changes: 89 additions & 2 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@
"generated-by": { "type": "string", "description": "Tool name along with version information used to generate this file" },
"csolution": { "type": "string", "description": "Path to csolution.yml file" },
"cprojects": { "$ref": "#/definitions/BuildProjectsType" },
"cbuilds": { "$ref": "#/definitions/BuildContextsType" }
"cbuilds": { "$ref": "#/definitions/BuildContextsType" },
"configurations": { "$ref": "#/definitions/BuildConfigurationsType" }
},
"additionalProperties": false,
"required": ["generated-by", "csolution", "cprojects"]
Expand All @@ -855,11 +856,26 @@
"BuildProjectType": {
"type": "object",
"properties": {
"cproject": { "type": "string", "description": "Path to cproject.yml file" }
"cproject": { "type": "string", "description": "Path to cproject.yml file" },
"clayers": { "$ref": "#/definitions/BuildLayersType" }
},
"additionalProperties": false,
"required": ["cproject"]
},
"BuildLayersType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildLayerType", "description": "List of clayers" }
},
"BuildLayerType": {
"type": "object",
"properties": {
"clayer": { "type": "string", "description": "Path to clayer.yml file" }
},
"additionalProperties": false,
"required": ["clayer"]
},
"BuildContextsType": {
"type": "array",
"uniqueItems": true,
Expand All @@ -877,6 +893,77 @@
"additionalProperties": false,
"required": ["cbuild", "project", "configuration"]
},
"BuildConfigurationsType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildConfigurationType", "description": "Target specific layer configurations" }
},
"BuildConfigurationType": {
"type": "object",
"properties": {
"target-type": { "type": "string", "description": "Name of the target" },
"target-configurations" : { "$ref": "#/definitions/BuildTargetConfigurationsType" }
},
"additionalProperties": false,
"required": ["target-type", "target-configurations"]
},
"BuildTargetConfigurationsType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildTargetConfigurationType", "description": "Target compatible configurations" }
},
"BuildTargetConfigurationType": {
"type": "object",
"properties": {
"configuration": { "$ref": "#/definitions/BuildLayerConfigurationsType" }
},
"additionalProperties": false,
"required": ["configuration"]
},
"BuildLayerConfigurationsType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildLayerConfigurationType" }
},
"BuildLayerConfigurationType": {
"type": "object",
"properties": {
"variables": { "$ref": "#/definitions/BuildLayerVariablesType", "description": "List of layer variables" }
},
"additionalProperties": false,
"required": ["variables"]
},
"BuildLayerVariablesType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildLayerVariableType" }
},
"BuildLayerVariableType": {
"type": "object",
"patternProperties": {
"^.*-Layer$": { "type": "string", "description": "Unique variable name for the layer" },
"settings": { "$ref": "#/definitions/BuildConnectionSettingsType" }
},
"additionalProperties": false
},
"BuildConnectionSettingsType": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildConnectionSetType", "description": "List of connection sets" }
},
"BuildConnectionSetType": {
"type": "object",
"properties": {
"set": { "type": "string", "description": "Connection set configurations" }
},
"additionalProperties": false,
"required": ["set"]
},
"BuildDescType": {
"description": "The lock info that describes the resolved state of contexts and also can be used as input for generators",
"type": "object",
Expand Down
Loading

0 comments on commit 7c39ecb

Please sign in to comment.