Skip to content

Commit 8e6fde4

Browse files
authored
Merge branch 'main' into plm-message
2 parents 0476809 + bbe461d commit 8e6fde4

6 files changed

Lines changed: 27 additions & 15 deletions

File tree

libs/rteutils/include/RteConstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class RteConstants
104104
static constexpr const char* AS_COMPILER = "Compiler";
105105
static constexpr const char* AS_BUILD_TYPE = "BuildType";
106106
static constexpr const char* AS_TARGET_TYPE = "TargetType";
107+
static constexpr const char* AS_TARGET_SET = "TargetSet";
107108
static constexpr const char* AS_DNAME = "Dname";
108109
static constexpr const char* AS_PNAME = "Pname";
109110
static constexpr const char* AS_BNAME = "Bname";

tools/projmgr/src/ProjMgr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,6 @@ bool ProjMgr::PopulateContexts(void) {
544544
m_worker.SetOutputDir(m_outputDir);
545545
m_emitter.SetOutputDir(m_outputDir.empty() ? m_rootDir : RteFsUtils::AbsolutePath(m_outputDir).generic_string());
546546

547-
// Update tmp directory
548-
m_worker.UpdateTmpDir();
549-
550547
// Set root directory
551548
m_worker.SetRootDir(m_rootDir);
552549

@@ -565,6 +562,9 @@ bool ProjMgr::PopulateContexts(void) {
565562
result = false;
566563
}
567564

565+
// Update tmp directory
566+
m_worker.UpdateTmpDir();
567+
568568
// Add image only context
569569
m_worker.AddImageOnlyContext();
570570

tools/projmgr/src/ProjMgrCbuildIdx.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ bool ProjMgrYamlEmitter::GenerateCbuildIndex(const vector<ContextItem*>& context
247247
rootNode[YAML_BUILD_IDX], contexts, m_parser, m_worker, m_outputDir, m_cbuildRun, failedContexts, executes);
248248

249249
// set rebuild flags
250-
if (NeedRebuild(filename, rootNode)) {
250+
bool defaultTmpdir = RteFsUtils::Equivalent(m_parser->GetCsolution().directories.tmpdir, m_outputDir + "/tmp");
251+
if (defaultTmpdir && NeedRebuild(filename, rootNode)) {
251252
rootNode[YAML_BUILD_IDX][YAML_REBUILD] = true;
252253
}
253254
else {

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ void ProjMgrWorker::UpdateTmpDir() {
137137
auto& tmpdir = m_parser->GetCsolution().directories.tmpdir;
138138
auto& base = m_outputDir.empty() ? m_parser->GetCsolution().directory : m_outputDir;
139139
if (!tmpdir.empty()) {
140-
if (ProjMgrUtils::HasAccessSequence(tmpdir) || !RteFsUtils::IsRelative(tmpdir)) {
141-
ProjMgrLogger::Get().Warn("'tmpdir' does not support access sequences and must be relative to csolution.yml");
142-
tmpdir.clear();
140+
if (!m_activeTargetType.empty()) {
141+
tmpdir = RteUtils::ExpandAccessSequences(tmpdir, {
142+
{ RteConstants::AS_TARGET_TYPE, m_activeTargetType },
143+
{ RteConstants::AS_TARGET_SET, m_activeTargetSet.set.empty() ? "default" : m_activeTargetSet.set } }
144+
);
143145
}
144146
}
145147
tmpdir = base + "/" + (tmpdir.empty() ? "tmp" : tmpdir);
@@ -204,6 +206,7 @@ void ProjMgrWorker::AddContext(ContextDesc& descriptor, const TypePair& type, Co
204206
context.variables[RteConstants::AS_PROJECT] = context.cproject->name;
205207
context.variables[RteConstants::AS_BUILD_TYPE] = context.type.build;
206208
context.variables[RteConstants::AS_TARGET_TYPE] = context.type.target;
209+
context.variables[RteConstants::AS_TARGET_SET] = context.targetSet.empty() ? "default" : context.targetSet;
207210

208211
// solution and project access sequences with absolute paths
209212
context.absPathSequences[RteConstants::AS_SOLUTION_DIR_BR] = context.csolution->directory;
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json
22

33
solution:
4+
5+
compiler: AC6
6+
47
target-types:
58
- type: TypeA
9+
target-set:
10+
- set: Set1
11+
images:
12+
- project-context: test1.Debug
613

714
build-types:
815
- type: Debug
9-
compiler: AC6
1016

1117
projects:
1218
- project: ./TestProject1/test1.cproject.yml
1319

1420
output-dirs:
15-
tmpdir: $BuildType$
21+
tmpdir: tmp/$TargetType$/$TargetSet$

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,16 +4164,17 @@ TEST_F(ProjMgrUnitTests, OutputDirs) {
41644164
}
41654165

41664166
TEST_F(ProjMgrUnitTests, OutputDirsTmpdirAccessSequence) {
4167-
StdStreamRedirect streamRedirect;
4168-
char* argv[4];
4167+
char* argv[5];
41694168
const string& csolution = testinput_folder + "/TestSolution/tmpdir-as.csolution.yml";
41704169
argv[1] = (char*)"convert";
41714170
argv[2] = (char*)csolution.c_str();
4172-
argv[3] = (char*)"--cbuildgen";
4173-
EXPECT_EQ(0, RunProjMgr(4, argv, m_envp));
4171+
argv[3] = (char*)"--active";
4172+
argv[4] = (char*)"TypeA@Set1";
4173+
EXPECT_EQ(0, RunProjMgr(5, argv, m_envp));
41744174

4175-
auto errStr = streamRedirect.GetErrorString();
4176-
EXPECT_TRUE(regex_search(errStr, regex("warning csolution: 'tmpdir' does not support access sequences and must be relative to csolution.yml")));
4175+
// Check custom tmp directory
4176+
const YAML::Node& cbuild = YAML::LoadFile(testinput_folder + "/TestSolution/tmpdir-as.cbuild-idx.yml");
4177+
EXPECT_EQ("tmp/TypeA/Set1", cbuild["build-idx"]["tmpdir"].as<string>());
41774178
}
41784179

41794180
TEST_F(ProjMgrUnitTests, OutputDirsAbsolutePath) {

0 commit comments

Comments
 (0)