Skip to content

Commit 665163e

Browse files
authored
[projmgr] Ensure access sequences under target-set do not generate dependencies
1 parent b98ee81 commit 665163e

File tree

5 files changed

+65
-7
lines changed

5 files changed

+65
-7
lines changed

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ class ProjMgrWorker {
12171217
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
12181218
bool ProcessSequencesRelatives(ContextItem& context, std::vector<std::string>& src, const std::string& ref = std::string(), std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
12191219
bool ProcessSequencesRelatives(ContextItem& context, BuildType& build, const std::string& ref = std::string());
1220-
bool ProcessSequenceRelative(ContextItem& context, std::string& item, const std::string& ref = std::string(), std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
1220+
bool ProcessSequenceRelative(ContextItem& context, std::string& item, const std::string& ref = std::string(), bool genDep = true, std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
12211221
bool ProcessOutputFilenames(ContextItem& context);
12221222
bool ProcessLinkerOptions(ContextItem& context);
12231223
bool ProcessLinkerOptions(ContextItem& context, const LinkerItem& linker, const std::string& ref);

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,7 +2637,7 @@ bool ProjMgrWorker::ProcessDebuggers(ContextItem& context) {
26372637
context.debugger.protocol = m_activeTargetSet.debugger.protocol;
26382638
if (!m_activeTargetSet.debugger.dbgconf.empty()) {
26392639
context.debugger.dbgconf = m_activeTargetSet.debugger.dbgconf;
2640-
if (!ProcessSequenceRelative(context, context.debugger.dbgconf, context.csolution->directory)) {
2640+
if (!ProcessSequenceRelative(context, context.debugger.dbgconf, context.csolution->directory, false)) {
26412641
return false;
26422642
}
26432643
if (RteFsUtils::IsRelative(context.debugger.dbgconf)) {
@@ -2647,7 +2647,7 @@ bool ProjMgrWorker::ProcessDebuggers(ContextItem& context) {
26472647
context.debugger.startPname = m_activeTargetSet.debugger.startPname;
26482648
for (auto telnet : m_activeTargetSet.debugger.telnet) {
26492649
if (!telnet.file.empty()) {
2650-
if (!ProcessSequenceRelative(context, telnet.file, context.csolution->directory)) {
2650+
if (!ProcessSequenceRelative(context, telnet.file, context.csolution->directory, false)) {
26512651
return false;
26522652
}
26532653
}
@@ -2670,7 +2670,8 @@ bool ProjMgrWorker::ProcessImages(ContextItem& context) {
26702670
const vector<ImageItem>& images = m_activeTargetSet.images;
26712671
for (auto item : images) {
26722672
if (!item.image.empty()) {
2673-
if (!ProcessSequenceRelative(context, item.image, context.csolution->directory)) {
2673+
// process access sequences
2674+
if (!ProcessSequenceRelative(context, item.image, context.csolution->directory, false)) {
26742675
return false;
26752676
}
26762677
if (RteFsUtils::IsRelative(item.image)) {
@@ -3549,7 +3550,8 @@ void ProjMgrWorker::ExpandPackDir(ContextItem& context, const string& pack, stri
35493550
item = regex_replace(item, regEx, replacement);
35503551
}
35513552

3552-
bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item, const string& ref, string outDir, bool withHeadingDot, bool solutionLevel) {
3553+
bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item, const string& ref,
3554+
bool genDep, string outDir, bool withHeadingDot, bool solutionLevel) {
35533555
size_t offset = 0;
35543556
bool pathReplace = false;
35553557
outDir = outDir.empty() && item != context.directories.cprj ? context.directories.cprj : outDir;
@@ -3610,7 +3612,7 @@ bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item,
36103612
// expand access sequence
36113613
ExpandAccessSequence(context, refContext, sequenceName, outDir, item, withHeadingDot);
36123614
// store dependency information
3613-
if (refContext.name != context.name) {
3615+
if (genDep && refContext.name != context.name) {
36143616
CollectionUtils::PushBackUniquely(context.dependsOn, refContext.name);
36153617
}
36163618
} else {
@@ -4904,7 +4906,7 @@ std::string ProjMgrWorker::GetBoardInfoString(const std::string& vendor,
49044906

49054907
bool ProjMgrWorker::ProcessSequencesRelatives(ContextItem& context, vector<string>& src, const string& ref, string outDir, bool withHeadingDot, bool solutionLevel) {
49064908
for (auto& item : src) {
4907-
if (!ProcessSequenceRelative(context, item, ref, outDir, withHeadingDot, solutionLevel)) {
4909+
if (!ProcessSequenceRelative(context, item, ref, true, outDir, withHeadingDot, solutionLevel)) {
49084910
return false;
49094911
}
49104912
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json
2+
3+
solution:
4+
5+
compiler: AC6
6+
7+
target-types:
8+
- type: CM4
9+
device: RteTest_ARMCM4_NOFP
10+
target-set:
11+
- set:
12+
images:
13+
- project-context: project
14+
- project-context: project2
15+
- image: $OutDir(project)$/project.bin
16+
- image: $OutDir(project2)$/project2.bin
17+
debugger:
18+
name: J-Link
19+
dbgconf: $ProjectDir(project)$/$Dname$.dbgconf
20+
telnet:
21+
- mode: file
22+
file: $OutDir(project2)$/telnet.log
23+
24+
projects:
25+
- project: project.cproject.yml
26+
- project: project2.cproject.yml
27+
28+
packs:
29+
- pack: ARM::RteTest_DFP
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/cproject.schema.json
2+
3+
project:
4+
5+
components:
6+
- component: Startup
7+
- component: CORE

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7324,3 +7324,23 @@ TEST_F(ProjMgrUnitTests, WestSupport) {
73247324
testinput_folder + "/WestSupport/ref/core1.Debug+CM0.cbuild.yml");
73257325
}
73267326

7327+
TEST_F(ProjMgrUnitTests, TargetSetDependencies) {
7328+
char* argv[5];
7329+
const string& csolution = testinput_folder + "/TestTargetSet/cross-dependency.csolution.yml";
7330+
argv[1] = (char*)"convert";
7331+
argv[2] = (char*)csolution.c_str();
7332+
argv[3] = (char*)"--active";
7333+
argv[4] = (char*)"CM4";
7334+
EXPECT_EQ(0, RunProjMgr(5, argv, m_envp));
7335+
const YAML::Node& cbuildRun = YAML::LoadFile(testinput_folder + "/TestTargetSet/out/cross-dependency+CM4.cbuild-run.yml");
7336+
// check access sequences were correctly expanded: bin images, dbgconf and telnet file
7337+
EXPECT_EQ("project/CM4/project.bin", cbuildRun["cbuild-run"]["output"][2]["file"].as<string>());
7338+
EXPECT_EQ("project2/CM4/project2.bin", cbuildRun["cbuild-run"]["output"][3]["file"].as<string>());
7339+
EXPECT_EQ("../RteTest_ARMCM4_NOFP.dbgconf", cbuildRun["cbuild-run"]["debugger"]["dbgconf"].as<string>());
7340+
EXPECT_EQ("../../../../../project2/CM4/telnet.log", cbuildRun["cbuild-run"]["debugger"]["telnet"][0]["file"].as<string>());
7341+
7342+
// ensure dependencies are not set
7343+
const YAML::Node& cbuildIdx = YAML::LoadFile(testinput_folder + "/TestTargetSet/cross-dependency.cbuild-idx.yml");
7344+
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][0]["depends-on"].IsDefined());
7345+
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][1]["depends-on"].IsDefined());
7346+
}

0 commit comments

Comments
 (0)