Skip to content
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
2 changes: 1 addition & 1 deletion tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ class ProjMgrWorker {
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
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);
bool ProcessSequencesRelatives(ContextItem& context, BuildType& build, const std::string& ref = std::string());
bool ProcessSequenceRelative(ContextItem& context, std::string& item, const std::string& ref = std::string(), std::string outDir = std::string(), bool withHeadingDot = false, bool solutionLevel = false);
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);
bool ProcessOutputFilenames(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context, const LinkerItem& linker, const std::string& ref);
Expand Down
14 changes: 8 additions & 6 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2637,7 +2637,7 @@ bool ProjMgrWorker::ProcessDebuggers(ContextItem& context) {
context.debugger.protocol = m_activeTargetSet.debugger.protocol;
if (!m_activeTargetSet.debugger.dbgconf.empty()) {
context.debugger.dbgconf = m_activeTargetSet.debugger.dbgconf;
if (!ProcessSequenceRelative(context, context.debugger.dbgconf, context.csolution->directory)) {
if (!ProcessSequenceRelative(context, context.debugger.dbgconf, context.csolution->directory, false)) {
return false;
}
if (RteFsUtils::IsRelative(context.debugger.dbgconf)) {
Expand All @@ -2647,7 +2647,7 @@ bool ProjMgrWorker::ProcessDebuggers(ContextItem& context) {
context.debugger.startPname = m_activeTargetSet.debugger.startPname;
for (auto telnet : m_activeTargetSet.debugger.telnet) {
if (!telnet.file.empty()) {
if (!ProcessSequenceRelative(context, telnet.file, context.csolution->directory)) {
if (!ProcessSequenceRelative(context, telnet.file, context.csolution->directory, false)) {
return false;
}
}
Expand All @@ -2670,7 +2670,8 @@ bool ProjMgrWorker::ProcessImages(ContextItem& context) {
const vector<ImageItem>& images = m_activeTargetSet.images;
for (auto item : images) {
if (!item.image.empty()) {
if (!ProcessSequenceRelative(context, item.image, context.csolution->directory)) {
// process access sequences
if (!ProcessSequenceRelative(context, item.image, context.csolution->directory, false)) {
return false;
}
if (RteFsUtils::IsRelative(item.image)) {
Expand Down Expand Up @@ -3549,7 +3550,8 @@ void ProjMgrWorker::ExpandPackDir(ContextItem& context, const string& pack, stri
item = regex_replace(item, regEx, replacement);
}

bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item, const string& ref, string outDir, bool withHeadingDot, bool solutionLevel) {
bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item, const string& ref,
bool genDep, string outDir, bool withHeadingDot, bool solutionLevel) {
size_t offset = 0;
bool pathReplace = false;
outDir = outDir.empty() && item != context.directories.cprj ? context.directories.cprj : outDir;
Expand Down Expand Up @@ -3610,7 +3612,7 @@ bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item,
// expand access sequence
ExpandAccessSequence(context, refContext, sequenceName, outDir, item, withHeadingDot);
// store dependency information
if (refContext.name != context.name) {
if (genDep && refContext.name != context.name) {
CollectionUtils::PushBackUniquely(context.dependsOn, refContext.name);
}
} else {
Expand Down Expand Up @@ -4904,7 +4906,7 @@ std::string ProjMgrWorker::GetBoardInfoString(const std::string& vendor,

bool ProjMgrWorker::ProcessSequencesRelatives(ContextItem& context, vector<string>& src, const string& ref, string outDir, bool withHeadingDot, bool solutionLevel) {
for (auto& item : src) {
if (!ProcessSequenceRelative(context, item, ref, outDir, withHeadingDot, solutionLevel)) {
if (!ProcessSequenceRelative(context, item, ref, true, outDir, withHeadingDot, solutionLevel)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json

solution:

compiler: AC6

target-types:
- type: CM4
device: RteTest_ARMCM4_NOFP
target-set:
- set:
images:
- project-context: project
- project-context: project2
- image: $OutDir(project)$/project.bin
- image: $OutDir(project2)$/project2.bin
debugger:
name: J-Link
dbgconf: $ProjectDir(project)$/$Dname$.dbgconf
telnet:
- mode: file
file: $OutDir(project2)$/telnet.log

projects:
- project: project.cproject.yml
- project: project2.cproject.yml

packs:
- pack: ARM::RteTest_DFP
7 changes: 7 additions & 0 deletions tools/projmgr/test/data/TestTargetSet/project2.cproject.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/cproject.schema.json

project:

components:
- component: Startup
- component: CORE
20 changes: 20 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7324,3 +7324,23 @@ TEST_F(ProjMgrUnitTests, WestSupport) {
testinput_folder + "/WestSupport/ref/core1.Debug+CM0.cbuild.yml");
}

TEST_F(ProjMgrUnitTests, TargetSetDependencies) {
char* argv[5];
const string& csolution = testinput_folder + "/TestTargetSet/cross-dependency.csolution.yml";
argv[1] = (char*)"convert";
argv[2] = (char*)csolution.c_str();
argv[3] = (char*)"--active";
argv[4] = (char*)"CM4";
EXPECT_EQ(0, RunProjMgr(5, argv, m_envp));
const YAML::Node& cbuildRun = YAML::LoadFile(testinput_folder + "/TestTargetSet/out/cross-dependency+CM4.cbuild-run.yml");
// check access sequences were correctly expanded: bin images, dbgconf and telnet file
EXPECT_EQ("project/CM4/project.bin", cbuildRun["cbuild-run"]["output"][2]["file"].as<string>());
EXPECT_EQ("project2/CM4/project2.bin", cbuildRun["cbuild-run"]["output"][3]["file"].as<string>());
EXPECT_EQ("../RteTest_ARMCM4_NOFP.dbgconf", cbuildRun["cbuild-run"]["debugger"]["dbgconf"].as<string>());
EXPECT_EQ("../../../../../project2/CM4/telnet.log", cbuildRun["cbuild-run"]["debugger"]["telnet"][0]["file"].as<string>());

// ensure dependencies are not set
const YAML::Node& cbuildIdx = YAML::LoadFile(testinput_folder + "/TestTargetSet/cross-dependency.cbuild-idx.yml");
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][0]["depends-on"].IsDefined());
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][1]["depends-on"].IsDefined());
}
Loading