Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/upload-art…
Browse files Browse the repository at this point in the history
…ifact-4.3.2
  • Loading branch information
soumeh01 authored Apr 22, 2024
2 parents 11aa713 + 122a169 commit e3e7366
Show file tree
Hide file tree
Showing 19 changed files with 628 additions and 44 deletions.
37 changes: 37 additions & 0 deletions external/yaml-cpp.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
diff --git a/include/yaml-cpp/emittermanip.h b/include/yaml-cpp/emittermanip.h
index 976d149..ba73a48 100644
--- a/include/yaml-cpp/emittermanip.h
+++ b/include/yaml-cpp/emittermanip.h
@@ -32,6 +32,7 @@ enum EMITTER_MANIP {
UpperNull,
CamelNull,
TildeNull,
+ EmptyNull,

// bool manipulators
YesNoBool, // yes, no
diff --git a/include/yaml-cpp/exceptions.h b/include/yaml-cpp/exceptions.h
index f6b2602..a4c5537 100644
--- a/include/yaml-cpp/exceptions.h
Expand Down Expand Up @@ -53,6 +65,31 @@ index 07cf81a..ed7d9cd 100644
void convert_to_map(const shared_memory_holder& pMemory);
void convert_sequence_to_map(const shared_memory_holder& pMemory);

diff --git a/src/emitter.cpp b/src/emitter.cpp
index 4d48307..d4485be 100644
--- a/src/emitter.cpp
+++ b/src/emitter.cpp
@@ -816,6 +816,8 @@ const char* Emitter::ComputeNullName() const {
return "NULL";
case CamelNull:
return "Null";
+ case EmptyNull:
+ return "";
case TildeNull:
// fallthrough
default:
diff --git a/src/emitterstate.cpp b/src/emitterstate.cpp
index 3dbe401..0dd0b17 100644
--- a/src/emitterstate.cpp
+++ b/src/emitterstate.cpp
@@ -305,6 +305,7 @@ bool EmitterState::SetNullFormat(EMITTER_MANIP value, FmtScope::value scope) {
case LowerNull:
case UpperNull:
case CamelNull:
+ case EmptyNull:
case TildeNull:
_Set(m_nullFmt, value, scope);
return true;
diff --git a/src/exceptions.cpp b/src/exceptions.cpp
index 43a7976..af99fd6 100644
--- a/src/exceptions.cpp
Expand Down
27 changes: 25 additions & 2 deletions tools/projmgr/include/ProjMgrParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,25 @@ struct GeneratorsItem {
std::map<std::string, std::string> options;
};

/**
* @brief executes item containing
* execute description,
* command string,
* boolean run always,
* list of input files,
* list of output files,
* type inclusion
*/
struct ExecutesItem {
std::string execute;
std::string run;
bool always;
std::vector<std::string> input;
std::vector<std::string> output;
std::vector<std::string> dependsOn;
TypeFilter typeFilter;
};

/**
* @brief layer item containing
* layer name,
Expand Down Expand Up @@ -355,7 +374,8 @@ struct CdefaultItem {
* list of contexts descriptors,
* list of packs,
* cdefault enable switch,
* generator options
* generator options,
* list of executes
*/
struct CsolutionItem {
std::string name;
Expand All @@ -372,6 +392,7 @@ struct CsolutionItem {
bool enableCdefault;
GeneratorsItem generators;
CbuildPackItem cbuildPack;
std::vector<ExecutesItem> executes;
};

/**
Expand All @@ -389,7 +410,8 @@ struct CsolutionItem {
* list of connections,
* list of packs,
* list of linker entries,
* generator options
* generator options,
* list of executes
*/
struct CprojectItem {
std::string name;
Expand All @@ -406,6 +428,7 @@ struct CprojectItem {
std::vector<PackItem> packs;
std::vector<LinkerItem> linker;
GeneratorsItem generators;
std::vector<ExecutesItem> executes;
};

/**
Expand Down
14 changes: 14 additions & 0 deletions tools/projmgr/include/ProjMgrUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,20 @@ class ProjMgrUtils {
*/
static std::string ConvertToVersionRange(const std::string& version);

/**
* @brief create IO sequences table according to executes nodes input/output
* @param vector of executes nodes
* @return map with IO sequences
*/
static StrMap CreateIOSequenceMap(const std::vector<ExecutesItem>& executes);

/**
* @brief replace delimiters "::|:|&|@>=|@|.|/| " by underscore character
* @param input string
* @return string with replaced characters
*/
static std:: string ReplaceDelimiters(const std::string input);

protected:
static std::string ConstructID(const std::vector<std::pair<const char*, const std::string&>>& elements);
/**
Expand Down
33 changes: 30 additions & 3 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ class ProjMgrWorker {
*/
void GetYmlOrderedContexts(std::vector<std::string> &contexts);

/**
* @brief get executes node at solution level
* @param reference to executes map
*/
void GetExecutes(std::map<std::string, ExecutesItem>& executes);

/**
* @brief set output directory
* @param reference to output directory
Expand Down Expand Up @@ -614,7 +620,23 @@ class ProjMgrWorker {
bool ProcessGlobalGenerators(ContextItem* context, const std::string& generatorId,
std::string& projectType, StrVec& siblings);

/**
* @brief check whether variable definition error is set
* @return true if error is set
*/
bool HasVarDefineError();

/**
* @brief process solution level executes
* @return true if it is processed successfully
*/
bool ProcessSolutionExecutes();

/**
* @brief process executes nodes dependencies
*/
void ProcessExecutesDependencies();

protected:
ProjMgrParser* m_parser = nullptr;
ProjMgrKernel* m_kernel = nullptr;
Expand Down Expand Up @@ -644,6 +666,7 @@ class ProjMgrWorker {
bool m_relativePaths;
bool m_varDefineError;
StrMap m_packMetadata;
std::map<std::string, ExecutesItem> m_executes;

bool LoadPacks(ContextItem& context);
bool CheckMissingPackRequirements(const std::string& contextName);
Expand All @@ -670,11 +693,12 @@ class ProjMgrWorker {
bool ProcessGpdsc(ContextItem& context);
bool ProcessConfigFiles(ContextItem& context);
bool ProcessComponentFiles(ContextItem& context);
bool ProcessExecutes(ContextItem& context, bool solutionLevel = false);
bool ProcessGroups(ContextItem& context);
bool ProcessSequencesRelatives(ContextItem& context, bool rerun);
bool ProcessSequencesRelatives(ContextItem& context, std::vector<std::string>& src, const std::string& ref = std::string(), bool withHeadingDot = false);
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(), bool withHeadingDot = false);
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 ProcessOutputFilenames(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context);
bool ProcessLinkerOptions(ContextItem& context, const LinkerItem& linker, const std::string& ref);
Expand Down Expand Up @@ -727,7 +751,7 @@ class ProjMgrWorker {
void CheckAndGenerateRegionsHeader(ContextItem& context);
bool GenerateRegionsHeader(ContextItem& context, std::string& generatedRegionsFile);
void UpdatePartialReferencedContext(ContextItem& context, std::string& contextName);
void ExpandAccessSequence(const ContextItem& context, const ContextItem& refContext, const std::string& sequence, std::string& item, bool withHeadingDot);
void ExpandAccessSequence(const ContextItem& context, const ContextItem& refContext, const std::string& sequence, const std::string& outdir, std::string& item, bool withHeadingDot);
bool GetGeneratorDir(const RteGenerator* generator, ContextItem& context, const std::string& layer, std::string& genDir);
bool GetGeneratorDir(const std::string& generatorId, ContextItem& context, const std::string& layer, std::string& genDir);
bool GetExtGeneratorDir(const std::string& generatorId, ContextItem& context, const std::string& layer, std::string& genDir);
Expand All @@ -741,6 +765,9 @@ class ProjMgrWorker {
std::string GetContextRteFolder(ContextItem& context);
std::vector<std::string> FindMatchingPackIdsInCbuildPack(const PackItem& needle, const std::vector<ResolvedPackItem>& resolvedPacks);
void PrintContextErrors(const std::string& contextName);
void SetFilesDependencies(const GroupNode& group, const std::string& ouput, StrVec& dependsOn, const std::string& dep, const std::string& outDir);
void SetBuildOutputDependencies(const OutputTypes& outputTypes, const std::string& input, StrVec& dependsOn, const std::string& dep, const std::string& outDir);
void SetExecutesDependencies(const std::string& output, const std::string& dep, const std::string& outDir);
};

#endif // PROJMGRWORKER_H
5 changes: 4 additions & 1 deletion tools/projmgr/include/ProjMgrYamlEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ class ProjMgrYamlEmitter {
* @param parser reference
* @param contexts vector with pointers to contexts
* @param outputDir directory
* @param failed contexts
* @param executes nodes at solution level
* @param boolean check schema of generated file
* @return true if executed successfully
*/
static bool GenerateCbuildIndex(ProjMgrParser& parser,
const std::vector<ContextItem*>& contexts, const std::string& outputDir,
const std::set<std::string>& failedContexts, bool checkSchema);
const std::set<std::string>& failedContexts,
const std::map<std::string, ExecutesItem>& executes, bool checkSchema);

/**
* @brief generate cbuild-gen-idx.yml file
Expand Down
5 changes: 5 additions & 0 deletions tools/projmgr/include/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @brief YAML key definitions
*/
static constexpr const char* YAML_ADDPATH = "add-path";
static constexpr const char* YAML_ALWAYS = "always";
static constexpr const char* YAML_ARGUMENT = "argument";
static constexpr const char* YAML_ARGUMENTS = "arguments";
static constexpr const char* YAML_ATTR = "attr";
Expand Down Expand Up @@ -71,6 +72,8 @@ static constexpr const char* YAML_DOWNLOAD_URL = "download-url";
static constexpr const char* YAML_DSP = "dsp";
static constexpr const char* YAML_ENDIAN = "endian";
static constexpr const char* YAML_ERRORS = "errors";
static constexpr const char* YAML_EXECUTE = "execute";
static constexpr const char* YAML_EXECUTES = "executes";
static constexpr const char* YAML_FILE = "file";
static constexpr const char* YAML_FILES = "files";
static constexpr const char* YAML_FROM_PACK = "from-pack";
Expand All @@ -90,6 +93,7 @@ static constexpr const char* YAML_GROUPS = "groups";
static constexpr const char* YAML_HOST = "host";
static constexpr const char* YAML_ID = "id";
static constexpr const char* YAML_INFO = "info";
static constexpr const char* YAML_INPUT = "input";
static constexpr const char* YAML_INSTANCES = "instances";
static constexpr const char* YAML_LANGUAGE = "language";
static constexpr const char* YAML_LANGUAGE_C = "language-C";
Expand Down Expand Up @@ -238,6 +242,7 @@ class ProjMgrYamlParser {
void ParseOutput(const YAML::Node& parent, const std::string& file, OutputItem& output);
void ParseOutputDirs(const YAML::Node& parent, const std::string& file, struct DirectoriesItem& directories);
void ParseGenerators(const YAML::Node& parent, const std::string& file, GeneratorsItem& generators);
void ParseExecutes(const YAML::Node& parent, const std::string& file, std::vector<ExecutesItem>& executes);
void ParseConnections(const YAML::Node& parent, std::vector<ConnectItem>& connects);
bool ParseTargetType(const YAML::Node& parent, const std::string& file, TargetType& targetType);
bool ParseBuildTypes(const YAML::Node& parent, const std::string& file, std::map<std::string, BuildType>& buildTypes);
Expand Down
54 changes: 50 additions & 4 deletions tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@
"description": "The tool required to build this csolution project"
},
"cdefault": { "type": "null", "description": "Enable use of cdefault.yml file" },
"generators": { "$ref": "#/definitions/GeneratorsOutputType" }
"generators": { "$ref": "#/definitions/GeneratorsOutputType" },
"executes": { "$ref": "#/definitions/ExecutesType" }
},
"additionalProperties": false,
"required": [ "target-types", "projects" ]
Expand Down Expand Up @@ -833,7 +834,8 @@
"connections": { "$ref": "#/definitions/ConnectionsType" },
"linker": { "$ref": "#/definitions/LinkersType" },
"generators": { "$ref": "#/definitions/GeneratorsOutputType" },
"rte": { "$ref": "#/definitions/RteType" }
"rte": { "$ref": "#/definitions/RteType" },
"executes": { "$ref": "#/definitions/ExecutesType" }
},
"additionalProperties": false
},
Expand All @@ -846,7 +848,8 @@
"csolution": { "type": "string", "description": "Path to csolution.yml file" },
"cprojects": { "$ref": "#/definitions/BuildProjectsType" },
"cbuilds": { "$ref": "#/definitions/BuildContextsType" },
"configurations": { "$ref": "#/definitions/BuildConfigurationsType" }
"configurations": { "$ref": "#/definitions/BuildConfigurationsType" },
"executes": { "$ref": "#/definitions/BuildExecutesType" }
},
"additionalProperties": false,
"required": ["generated-by", "csolution", "cprojects"]
Expand Down Expand Up @@ -1018,6 +1021,7 @@
"linker": { "$ref": "#/definitions/LinkerType" },
"groups": { "$ref": "#/definitions/BuildGroupsType" },
"generators": { "$ref": "#/definitions/GeneratorsType" },
"executes": { "$ref": "#/definitions/BuildExecutesType" },
"constructed-files": {
"type": "array",
"items": { "$ref": "#/definitions/FileType" }
Expand Down Expand Up @@ -1430,6 +1434,48 @@
"components": { "$ref": "#/definitions/ComponentsType" }
},
"additionalProperties": false
}
},
"ExecutesType": {
"description": "Execute and external command for pre or post build steps",
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/ExecuteType" }
},
"ExecuteType": {
"type": "object",
"properties": {
"execute": { "type": "string", "description": "Description of the build step" },
"run": { "type": "string", "description": "Command string with name of the program or script (optionally with path) along with argument string" },
"always": { "type": "null", "description": "When present, the build step always runs and bypasses check for outdated files" },
"input": { "type": "array", "description": "A list of input files (may contain Access Sequences)", "items": { "type": "string"} },
"output": { "type": "array", "description": "A list of output files (may contain Access Sequences)", "items": { "type": "string"} },
"for-context": { "$ref": "#/definitions/ForContext" },
"not-for-context": { "$ref": "#/definitions/NotForContext" }
},
"additionalProperties": false,
"allOf": [
{ "$ref": "#/definitions/TypeListMutualExclusion"},
{ "required": ["execute", "run"] }
]
},
"BuildExecutesType": {
"description": "Execute and external command for pre or post build steps",
"type": "array",
"uniqueItems": true,
"items": { "$ref": "#/definitions/BuildExecuteType" }
},
"BuildExecuteType": {
"type": "object",
"properties": {
"execute": { "type": "string", "description": "Description of the build step" },
"run": { "type": "string", "description": "Command string with name of the program or script (optionally with path) along with argument string" },
"always": { "type": "null", "description": "When present, the build step always runs and bypasses check for outdated files" },
"input": { "type": "array", "description": "A list of input files (may contain Access Sequences)", "items": { "type": "string"} },
"output": { "type": "array", "description": "A list of output files (may contain Access Sequences)", "items": { "type": "string"} },
"depends-on": { "$ref": "#/definitions/ArrayOfBuildContextWithProjectName" }
},
"additionalProperties": false,
"required": ["execute", "run"]
}
}
}
13 changes: 11 additions & 2 deletions tools/projmgr/src/ProjMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,9 @@ bool ProjMgr::GenerateYMLConfigurationFiles() {

// Generate cbuild index file
if (!m_allContexts.empty()) {
if (!m_emitter.GenerateCbuildIndex(m_parser, m_allContexts, m_outputDir, m_failedContext, m_checkSchema)) {
map<string, ExecutesItem> executes;
m_worker.GetExecutes(executes);
if (!m_emitter.GenerateCbuildIndex(m_parser, m_allContexts, m_outputDir, m_failedContext, executes, m_checkSchema)) {
return false;
}
}
Expand Down Expand Up @@ -563,6 +565,13 @@ bool ProjMgr::Configure() {
}
m_selectedToolchain = m_worker.GetSelectedToochain();

// Process solution level executes
if (!m_worker.ProcessSolutionExecutes()) {
error = true;
}
// Process executes dependencies
m_worker.ProcessExecutesDependencies();

// Print warnings for missing filters
m_worker.PrintMissingFilters();
if (m_verbose) {
Expand Down Expand Up @@ -830,7 +839,7 @@ bool ProjMgr::RunListLayers(void) {
}

if (!m_allContexts.empty()) {
if (!m_emitter.GenerateCbuildIndex(m_parser, m_allContexts, m_outputDir, m_failedContext, m_checkSchema)) {
if (!m_emitter.GenerateCbuildIndex(m_parser, m_allContexts, m_outputDir, m_failedContext, map<string, ExecutesItem>(), m_checkSchema)) {
return false;
}
}
Expand Down
Loading

0 comments on commit e3e7366

Please sign in to comment.