Skip to content

Commit b5bf5db

Browse files
grasci-armbrondani
andauthored
[projmgr] Expand $SolutionDir()$ when used in cproject.yml layer node (#1239) (#2110)
Co-authored-by: Daniel Brondani <[email protected]>
1 parent ecd4a51 commit b5bf5db

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ bool ProjMgrWorker::ParseContextLayers(ContextItem& context) {
203203
if (!variable.empty()) {
204204
context.layerVariables[clayer.type] = variable;
205205
}
206-
string clayerFile = RteUtils::ExpandAccessSequences(clayer.layer, context.variables);
206+
auto variables = context.variables;
207+
variables[RteConstants::AS_SOLUTION_DIR_BR] = context.csolution->directory;
208+
string clayerFile = RteUtils::ExpandAccessSequences(clayer.layer, variables);
207209
if (clayerFile.empty()) {
208210
continue;
209211
}

tools/projmgr/test/data/TestLayers/ref/variables/variables.cbuild-idx.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ build-idx:
99
- clayer: ../data/TestLayers/$VarTargetLayer$
1010
- clayer: ../data/TestLayers/$VarSolution$
1111
- clayer: ../data/TestLayers/$VarSolutionDir$
12+
- clayer: ../data/TestLayers/$SolutionDir()$/variables/solutionDir2.clayer.yml
1213
cbuilds:
1314
- cbuild: variables.BuildType1+TargetType1.cbuild.yml
1415
project: variables
@@ -17,6 +18,7 @@ build-idx:
1718
- clayer: ../data/TestLayers/variables/app.clayer.yml
1819
- clayer: ../data/TestLayers/variables/build1.clayer.yml
1920
- clayer: ../data/TestLayers/variables/solutionDir.clayer.yml
21+
- clayer: ../data/TestLayers/variables/solutionDir2.clayer.yml
2022
- clayer: ../data/TestLayers/variables/target1.clayer.yml
2123
messages:
2224
info:
@@ -29,6 +31,7 @@ build-idx:
2931
- clayer: ../data/TestLayers/variables/app.clayer.yml
3032
- clayer: ../data/TestLayers/variables/build1.clayer.yml
3133
- clayer: ../data/TestLayers/variables/solutionDir.clayer.yml
34+
- clayer: ../data/TestLayers/variables/solutionDir2.clayer.yml
3235
- clayer: ../data/TestLayers/variables/target2.clayer.yml
3336
messages:
3437
info:
@@ -41,6 +44,7 @@ build-idx:
4144
- clayer: ../data/TestLayers/variables/app.clayer.yml
4245
- clayer: ../data/TestLayers/variables/build2.clayer.yml
4346
- clayer: ../data/TestLayers/variables/solutionDir.clayer.yml
47+
- clayer: ../data/TestLayers/variables/solutionDir2.clayer.yml
4448
- clayer: ../data/TestLayers/variables/target1.clayer.yml
4549
messages:
4650
info:
@@ -53,6 +57,7 @@ build-idx:
5357
- clayer: ../data/TestLayers/variables/app.clayer.yml
5458
- clayer: ../data/TestLayers/variables/build2.clayer.yml
5559
- clayer: ../data/TestLayers/variables/solutionDir.clayer.yml
60+
- clayer: ../data/TestLayers/variables/solutionDir2.clayer.yml
5661
- clayer: ../data/TestLayers/variables/target2.clayer.yml
5762
messages:
5863
info:

tools/projmgr/test/data/TestLayers/variables.cproject.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ project:
66
- layer: $VarTargetLayer$
77
- layer: $VarSolution$
88
- layer: $VarSolutionDir$
9+
- layer: $SolutionDir()$/variables/solutionDir2.clayer.yml
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/clayer.schema.json
2+
3+
layer:
4+
5+
define:
6+
- SolutionDir-Layer

0 commit comments

Comments
 (0)