Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[projmgr] Store context dependencies in cbuild-idx #1272

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ struct ContextTypesItem {
* boolean processed precedences
* map of user inputed pack ID to resolved pack ID
* set of absolute file paths of project local packs
* vector of dependent contexts
*/
struct ContextItem {
CdefaultItem* cdefault = nullptr;
Expand Down Expand Up @@ -313,7 +314,8 @@ struct ContextItem {
RtePackage* boardPack;
bool precedences;
std::map<std::string, std::set<std::string>> userInputToResolvedPackIdMap;
std::set<std::string> localPackPaths;
StrSet localPackPaths;
StrVec dependsOn;
};

/**
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static constexpr const char* YAML_DEBUG = "debug";
static constexpr const char* YAML_DEFAULT = "default";
static constexpr const char* YAML_DEFINE = "define";
static constexpr const char* YAML_DELPATH = "del-path";
static constexpr const char* YAML_DEPENDS_ON = "depends-on";
static constexpr const char* YAML_DESCRIPTION = "description";
static constexpr const char* YAML_DEVICE = "device";
static constexpr const char* YAML_DEVICE_PACK = "device-pack";
Expand Down
7 changes: 4 additions & 3 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@
],
"description": "Include node for a list of compilers"
},
"ArrayOfContextMapType": {
"ArrayOfBuildContextWithProjectName": {
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/BuildContextWithProjectName" }
},
"ContextMapType": {
"oneOf": [
{"$ref": "#/definitions/ArrayOfContextMapType" },
{"$ref": "#/definitions/ArrayOfBuildContextWithProjectName" },
{"$ref": "#/definitions/BuildContextWithProjectName" }
],
"description": "Remapping of build contexts"
Expand Down Expand Up @@ -812,7 +812,8 @@
"properties": {
"cbuild": { "type": "string", "description": "Path to <context>.cbuild.yml file" },
"project": { "type": "string", "description": "Project name" },
"configuration": { "$ref": "#/definitions/BuildContext" }
"configuration": { "$ref": "#/definitions/BuildContext" },
"depends-on": { "$ref": "#/definitions/ArrayOfBuildContextWithProjectName" }
},
"additionalProperties": false,
"required": ["cbuild", "project", "configuration"]
Expand Down
4 changes: 4 additions & 0 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2805,6 +2805,10 @@ bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item,
}
// expand access sequence
ExpandAccessSequence(context, refContext, sequenceName, item, withHeadingDot);
// store dependency information
if (refContext.name != context.name) {
ProjMgrUtils::PushBackUniquely(context.dependsOn, refContext.name);
}
} else {
// full or partial context name cannot be resolved to a valid context
ProjMgrLogger::Error("context '" + contextName + "' referenced by access sequence '" + sequenceName + "' does not exist");
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/src/ProjMgrYamlEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ ProjMgrYamlCbuildIdx::ProjMgrYamlCbuildIdx(YAML::Node node, const vector<Context
(context->type.build.empty() ? "" : ("." + context->type.build)) +
"+" + context->type.target);
}
SetNodeValue(cbuildNode[YAML_DEPENDS_ON], context->dependsOn);
node[YAML_CBUILDS].push_back(cbuildNode);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
build-idx:
generated-by: csolution version 0.0.0+gcc58b54e
csolution: ../data/TestAccessSequences/test-access-sequences2.csolution.yml
cprojects:
- cproject: ../data/TestAccessSequences/test-access-sequences3.cproject.yml
clayers:
- clayer: ../data/TestAccessSequences/test-access-sequences.clayer.yml
cbuilds:
- cbuild: test-access-sequences3.Debug+TEST_TARGET.cbuild.yml
project: test-access-sequences3
configuration: .Debug+TEST_TARGET
depends-on:
- test-access-sequences3.Release+TEST_TARGET
- cbuild: test-access-sequences3.Release+TEST_TARGET.cbuild.yml
project: test-access-sequences3
configuration: .Release+TEST_TARGET
depends-on:
- test-access-sequences3.Debug+TEST_TARGET
4 changes: 4 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,10 @@ TEST_F(ProjMgrUnitTests, AccessSequences2) {
testinput_folder + "/TestAccessSequences/ref/test-access-sequences3.Debug+TEST_TARGET.cprj");
ProjMgrTestEnv:: CompareFile(testoutput_folder + "/test-access-sequences3.Release+TEST_TARGET.cprj",
testinput_folder + "/TestAccessSequences/ref/test-access-sequences3.Release+TEST_TARGET.cprj");

// Check generated cbuild-idx
ProjMgrTestEnv::CompareFile(testoutput_folder + "/test-access-sequences2.cbuild-idx.yml",
testinput_folder + "/TestAccessSequences/ref/test-access-sequences2.cbuild-idx.yml");
}

TEST_F(ProjMgrUnitTests, RunProjMgr_MalformedAccessSequences1) {
Expand Down
Loading