Skip to content

Commit

Permalink
[projmgr] Introduce keywords define, undefine, add-path and del-path
Browse files Browse the repository at this point in the history
  • Loading branch information
grasci-arm authored Jul 22, 2022
1 parent 9d979f2 commit d0e6270
Show file tree
Hide file tree
Showing 31 changed files with 362 additions and 273 deletions.
4 changes: 4 additions & 0 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @brief YAML key definitions
*/
static constexpr const char* YAML_ADDPATHS = "add-paths";
static constexpr const char* YAML_ADDPATH = "add-path";
static constexpr const char* YAML_BOARD = "board";
static constexpr const char* YAML_BUILDTYPES = "build-types";
static constexpr const char* YAML_CATEGORY = "category";
Expand All @@ -24,7 +25,9 @@ static constexpr const char* YAML_COMPONENTS = "components";
static constexpr const char* YAML_DEBUG = "debug";
static constexpr const char* YAML_DEFAULT = "default";
static constexpr const char* YAML_DEFINES = "defines";
static constexpr const char* YAML_DEFINE = "define";
static constexpr const char* YAML_DELPATHS = "del-paths";
static constexpr const char* YAML_DELPATH = "del-path";
static constexpr const char* YAML_DESCRIPTION = "description";
static constexpr const char* YAML_DEVICE = "device";
static constexpr const char* YAML_ENDIAN = "endian";
Expand Down Expand Up @@ -67,6 +70,7 @@ static constexpr const char* YAML_TARGETTYPES = "target-types";
static constexpr const char* YAML_TRUSTZONE = "trustzone";
static constexpr const char* YAML_TYPE = "type";
static constexpr const char* YAML_UNDEFINES = "undefines";
static constexpr const char* YAML_UNDEFINE = "undefine";
static constexpr const char* YAML_WARNINGS = "warnings";

/**
Expand Down
41 changes: 37 additions & 4 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@
"description": "List of #define symbol settings for the code generation.",
"uniqueItems": true,
"minItems": 1,
"prefixItems": [
{ "type": "string" },
{ "type": "object", "patternProperties": { "^(.*)$": { "type": "string" } } }
]
"items": { "type": "string" }
},
"UndefinesType": {
"type": "array",
Expand Down Expand Up @@ -174,9 +171,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" }
},
"additionalProperties": false,
Expand All @@ -201,9 +202,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" }
},
"additionalProperties": false,
Expand Down Expand Up @@ -265,9 +270,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" },
"groups": { "$ref": "#/definitions/GroupsType" },
"files": { "$ref": "#/definitions/FilesType" }
Expand Down Expand Up @@ -295,9 +304,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" }
},
"$ref": "#/definitions/TypeListMutualExclusion",
Expand All @@ -324,9 +337,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" }
},
"$ref": "#/definitions/TypeListMutualExclusion",
Expand All @@ -350,9 +367,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscType" }
},
"$ref": "#/definitions/TypeListMutualExclusion",
Expand Down Expand Up @@ -400,9 +421,13 @@
"optimize": { "$ref": "#/definitions/OptimizeType" },
"debug": { "$ref": "#/definitions/DebugType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" }
},
"additionalProperties": false
Expand All @@ -420,9 +445,13 @@
"debug": { "$ref": "#/definitions/DebugType" },
"processor": { "$ref": "#/definitions/ProcessorType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" },
"groups": { "$ref": "#/definitions/GroupsType" },
"components": { "$ref": "#/definitions/ComponentsType" },
Expand All @@ -444,9 +473,13 @@
"debug": { "$ref": "#/definitions/DebugType" },
"processor": { "$ref": "#/definitions/ProcessorType" },
"defines": { "$ref": "#/definitions/DefinesType" },
"define": { "$ref": "#/definitions/DefinesType" },
"undefines": { "$ref": "#/definitions/UndefinesType" },
"undefine": { "$ref": "#/definitions/UndefinesType" },
"add-paths": { "$ref": "#/definitions/AddpathsType" },
"add-path": { "$ref": "#/definitions/AddpathsType" },
"del-paths": { "$ref": "#/definitions/DelpathsType" },
"del-path": { "$ref": "#/definitions/DelpathsType" },
"misc": { "$ref": "#/definitions/MiscTypes" },
"groups": { "$ref": "#/definitions/GroupsType" },
"components": { "$ref": "#/definitions/ComponentsType" }
Expand Down
60 changes: 56 additions & 4 deletions tools/projmgr/src/ProjMgrYamlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,26 @@ void ProjMgrYamlParser::ParseBuildType(const YAML::Node& parent, BuildType& buil
}
ParseProcessor(parent, buildType.processor);
ParseMisc(parent, buildType.misc);
ParseVector(parent, YAML_DEFINES, buildType.defines);
ParseVector(parent, YAML_UNDEFINES, buildType.undefines);
ParseVector(parent, YAML_ADDPATHS, buildType.addpaths);
ParseVector(parent, YAML_DELPATHS, buildType.delpaths);
ParseVector(parent, YAML_DEFINE, buildType.defines);
if (buildType.defines.empty()) {
// TODO: after deprecation remove 'defines' keyword parsing in benefit of 'define'
ParseVector(parent, YAML_DEFINES, buildType.defines);
}
ParseVector(parent, YAML_UNDEFINE, buildType.undefines);
if (buildType.undefines.empty()) {
// TODO: after deprecation remove 'undefines' keyword parsing in benefit of 'undefine'
ParseVector(parent, YAML_UNDEFINES, buildType.undefines);
}
ParseVector(parent, YAML_ADDPATH, buildType.addpaths);
if (buildType.addpaths.empty()) {
// TODO: after deprecation remove 'add-paths' keyword parsing in benefit of 'add-path'
ParseVector(parent, YAML_ADDPATHS, buildType.addpaths);
}
ParseVector(parent, YAML_DELPATH, buildType.delpaths);
if (buildType.delpaths.empty()) {
// TODO: after deprecation remove 'del-paths' keyword parsing in benefit of 'del-path'
ParseVector(parent, YAML_DELPATHS, buildType.delpaths);
}
}

void ProjMgrYamlParser::ParseTargetType(const YAML::Node& parent, TargetType& targetType) {
Expand Down Expand Up @@ -509,9 +525,13 @@ const set<string> solutionKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand All @@ -532,9 +552,13 @@ const set<string> projectKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
YAML_COMPONENTS,
YAML_GROUPS,
Expand All @@ -553,9 +577,13 @@ const set<string> layerKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
YAML_COMPONENTS,
YAML_GROUPS,
Expand All @@ -572,9 +600,13 @@ const set<string> targetTypeKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand All @@ -586,9 +618,13 @@ const set<string> buildTypeKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand Down Expand Up @@ -632,9 +668,13 @@ const set<string> componentsKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand All @@ -647,9 +687,13 @@ const set<string> layersKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand All @@ -670,9 +714,13 @@ const set<string> groupsKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand All @@ -687,9 +735,13 @@ const set<string> filesKeys = {
YAML_DEBUG,
YAML_WARNINGS,
YAML_DEFINES,
YAML_DEFINE,
YAML_UNDEFINES,
YAML_UNDEFINE,
YAML_ADDPATHS,
YAML_ADDPATH,
YAML_DELPATHS,
YAML_DELPATH,
YAML_MISC,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project:
device: RteTest_ARMCM0
compiler: AC6
defines:
define:
- DEF1-$Dname$
- DEF2-$Dnamelong$
- DEF3-$Dname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
project:
device: RteTest_ARMCM0
compiler: AC6
defines:
define:
- DEF1-$OutDir(malformed-access-sequences2)$
- DEF2-$OutDirs(malformed-access-sequences2)$
- DEF3-$OutDir(malformed-access-sequences2$)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ solution:
misc:
- compiler: AC6
C-CPP: [-C-CPP-$Dname$]
defines:
define:
- DEF-CM0-$Dname$-$Bname$
add-paths:
add-path:
- ./path/CM0/$Dname$
- type: CM3
device: RteTest_ARMCM3
misc:
- compiler: AC6
C-CPP: [-C-CPP-$Dname$]
defines:
define:
- DEF-CM3-$Dname$
add-paths:
add-path:
- ./path/CM3/$Dname$

build-types:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### CMSIS Project Description ###

project:
defines:
define:
- DEF1-PROJ1-$Output(test-access-sequences2.Debug)$
- DEF2-PROJ1-$Output(test-access-sequences2+CM3)$
- DEF3-PROJ1-$Output(test-access-sequences2.Release+CM0)$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
project:
misc:
- C-CPP: [PROJ2-D($Dname$)-B($Bname$)]
defines:
define:
- $Output(test-access-sequences1)$
add-paths:
add-path:
- $Output(test-access-sequences1)$
components:
- component: CORE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

project:
device: RteTest_ARMCM0
defines:
define:
- DEF1-PROJ1-$Output(test-access-sequences3.Debug)$
- DEF2-PROJ1-$Output(test-access-sequences3.Release)$
components:
Expand Down
Loading

0 comments on commit d0e6270

Please sign in to comment.