From 12cb6076be875f6f9b2c73815246c5bd0547b6bd Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Mon, 29 Jun 2026 11:15:07 +0200 Subject: [PATCH 1/2] [projmgr] Set target-set specific `tmpdir` as default --- tools/projmgr/src/ProjMgrWorker.cpp | 11 ++++++----- .../data/ImageOnly/ref/image-only.cbuild-idx.yml | 2 +- .../data/WestSupport/ref/solution.cbuild-idx.yml | 2 +- tools/projmgr/test/src/ProjMgrUnitTests.cpp | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index f517f886f..de0c0b1f1 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -157,13 +157,14 @@ bool ProjMgrWorker::AddContexts(ProjMgrParser& parser, ContextDesc& descriptor, void ProjMgrWorker::UpdateTmpDir() { auto& tmpdir = m_parser->GetCsolution().directories.tmpdir; auto& base = m_outputDir.empty() ? m_parser->GetCsolution().directory : m_outputDir; - if (!tmpdir.empty()) { - if (!m_activeTargetType.empty()) { - tmpdir = RteUtils::ExpandAccessSequences(tmpdir, { + if (!m_activeTargetType.empty()) { + const auto& targetSet = m_activeTargetSet.set.empty() ? "default" : m_activeTargetSet.set; + // default tmpdir: tmp/$TargetType$/$TargetSet$ + tmpdir = tmpdir.empty() ? "tmp/" + m_activeTargetType + "/" + targetSet : + RteUtils::ExpandAccessSequences(tmpdir, { { RteConstants::AS_TARGET_TYPE, m_activeTargetType }, - { RteConstants::AS_TARGET_SET, m_activeTargetSet.set.empty() ? "default" : m_activeTargetSet.set } } + { RteConstants::AS_TARGET_SET, targetSet } } ); - } } tmpdir = base + "/" + (tmpdir.empty() ? "tmp" : tmpdir); } diff --git a/tools/projmgr/test/data/ImageOnly/ref/image-only.cbuild-idx.yml b/tools/projmgr/test/data/ImageOnly/ref/image-only.cbuild-idx.yml index 5db63fcf9..2bc5d1f47 100644 --- a/tools/projmgr/test/data/ImageOnly/ref/image-only.cbuild-idx.yml +++ b/tools/projmgr/test/data/ImageOnly/ref/image-only.cbuild-idx.yml @@ -2,7 +2,7 @@ build-idx: generated-by: csolution version 0.0.0 csolution: image-only.csolution.yml cbuild-run: out/image-only+CM0.cbuild-run.yml - tmpdir: tmp + tmpdir: tmp/CM0/default image-only: true cbuilds: - cbuild: out/image-only/CM0/image-only+CM0.cbuild.yml diff --git a/tools/projmgr/test/data/WestSupport/ref/solution.cbuild-idx.yml b/tools/projmgr/test/data/WestSupport/ref/solution.cbuild-idx.yml index 42afa8b5d..422ce3f01 100644 --- a/tools/projmgr/test/data/WestSupport/ref/solution.cbuild-idx.yml +++ b/tools/projmgr/test/data/WestSupport/ref/solution.cbuild-idx.yml @@ -2,7 +2,7 @@ build-idx: generated-by: csolution version 0.0.0 csolution: solution.csolution.yml cbuild-run: out/solution+CM0.cbuild-run.yml - tmpdir: tmp + tmpdir: tmp/CM0/default cbuilds: - cbuild: out/core0/CM0/Debug/core0.Debug+CM0.cbuild.yml west: true diff --git a/tools/projmgr/test/src/ProjMgrUnitTests.cpp b/tools/projmgr/test/src/ProjMgrUnitTests.cpp index 328eabd7a..ceb712f57 100644 --- a/tools/projmgr/test/src/ProjMgrUnitTests.cpp +++ b/tools/projmgr/test/src/ProjMgrUnitTests.cpp @@ -4388,6 +4388,20 @@ TEST_F(ProjMgrUnitTests, OutputDirsTmpdirAccessSequence) { EXPECT_EQ("tmp/TypeA/Set1", cbuild["build-idx"]["tmpdir"].as()); } +TEST_F(ProjMgrUnitTests, OutputDirsTmpdirDefault) { + char* argv[5]; + const string& csolution = testinput_folder + "/TestSolution/tmpdir-default-active.csolution.yml"; + argv[1] = (char*)"convert"; + argv[2] = (char*)csolution.c_str(); + argv[3] = (char*)"--active"; + argv[4] = (char*)"TypeA@Set1"; + EXPECT_EQ(0, RunProjMgr(5, argv, m_envp)); + + // Check default tmp directory for active target type and target set + const YAML::Node& cbuild = YAML::LoadFile(testinput_folder + "/TestSolution/tmpdir-default-active.cbuild-idx.yml"); + EXPECT_EQ("tmp/TypeA/Set1", cbuild["build-idx"]["tmpdir"].as()); +} + TEST_F(ProjMgrUnitTests, OutputDirsAbsolutePath) { StdStreamRedirect streamRedirect; char* argv[5]; From 66ecf02201cdb2a5a59388675ab48a3b371106d3 Mon Sep 17 00:00:00 2001 From: Daniel Brondani Date: Mon, 29 Jun 2026 11:38:52 +0200 Subject: [PATCH 2/2] Add test data --- .../tmpdir-default-active.csolution.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/projmgr/test/data/TestSolution/tmpdir-default-active.csolution.yml diff --git a/tools/projmgr/test/data/TestSolution/tmpdir-default-active.csolution.yml b/tools/projmgr/test/data/TestSolution/tmpdir-default-active.csolution.yml new file mode 100644 index 000000000..c54bd721d --- /dev/null +++ b/tools/projmgr/test/data/TestSolution/tmpdir-default-active.csolution.yml @@ -0,0 +1,18 @@ +# 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: TypeA + target-set: + - set: Set1 + images: + - project-context: test1.Debug + + build-types: + - type: Debug + + projects: + - project: ./TestProject1/test1.cproject.yml