Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[projmgr] Update portability check #1073

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/ProjMgrYamlParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class ProjMgrYamlParser {
protected:
void ParseMisc(const YAML::Node& parent, std::vector<MiscItem>& misc);
void ParseDefine(const YAML::Node& parent, std::vector<std::string>& define);
void ParsePacks(const YAML::Node& parent, std::vector<PackItem>& packs);
void ParsePacks(const YAML::Node& parent, const std::string& file, std::vector<PackItem>& packs);
void ParseProcessor(const YAML::Node& parent, ProcessorItem& processor);
void ParseString(const YAML::Node& parent, const std::string& key, std::string& value);
void ParseVector(const YAML::Node& parent, const std::string& key, std::vector<std::string>& value);
Expand Down
13 changes: 7 additions & 6 deletions tools/projmgr/src/ProjMgrYamlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ProjMgrYamlSchemaChecker.h"

#include "RteFsUtils.h"
#include <regex>
#include <string>

using namespace std;
Expand Down Expand Up @@ -90,7 +91,7 @@ bool ProjMgrYamlParser::ParseCsolution(const string& input,
if (!ParseTargetType(solutionNode, csolution.path, csolution.target)) {
return false;
}
ParsePacks(solutionNode, csolution.packs);
ParsePacks(solutionNode, csolution.path, csolution.packs);
csolution.enableCdefault = solutionNode[YAML_CDEFAULT].IsDefined();
ParseGenerators(solutionNode, csolution.path, csolution.generators);

Expand Down Expand Up @@ -128,7 +129,7 @@ bool ProjMgrYamlParser::ParseCproject(const string& input,

ParseTargetType(projectNode, cproject.path, cproject.target);

ParsePacks(projectNode, cproject.packs);
ParsePacks(projectNode, cproject.path, cproject.packs);

if (!ParseComponents(projectNode, cproject.path, cproject.components)) {
return false;
Expand Down Expand Up @@ -201,7 +202,7 @@ bool ProjMgrYamlParser::ParseClayer(const string& input,

ParseTargetType(layerNode, clayer.path, clayer.target);

ParsePacks(layerNode, clayer.packs);
ParsePacks(layerNode, clayer.path, clayer.packs);

if (!ParseComponents(layerNode, clayer.path, clayer.components)) {
return false;
Expand Down Expand Up @@ -243,7 +244,7 @@ void ProjMgrYamlParser::EnsurePortability(const string& file, const YAML::Mark&
if (!canonical.empty() && (original != canonical)) {
ProjMgrLogger::Warn(file, mark.line + 1, mark.column + 1, "'" + value + "' has case inconsistency, use '" + RteFsUtils::RelativePath(canonical, parentDir) + "' instead");
}
} else if (checkExist) {
} else if (checkExist && !regex_match(value, regex(".*\\$.*\\$.*"))) {
ProjMgrLogger::Warn(file, mark.line + 1, mark.column + 1, "path '" + value + "' was not found");
}
}
Expand Down Expand Up @@ -466,13 +467,13 @@ void ProjMgrYamlParser::ParseMisc(const YAML::Node& parent, vector<MiscItem>& mi
}
}

void ProjMgrYamlParser::ParsePacks(const YAML::Node& parent, vector<PackItem>& packs) {
void ProjMgrYamlParser::ParsePacks(const YAML::Node& parent, const string& file, vector<PackItem>& packs) {
if (parent[YAML_PACKS].IsDefined()) {
const YAML::Node& packNode = parent[YAML_PACKS];
for (const auto& packEntry : packNode) {
PackItem packItem;
ParseString(packEntry, YAML_PACK, packItem.pack);
ParseString(packEntry, YAML_PATH, packItem.path);
ParsePortablePath(packEntry, file, YAML_PATH, packItem.path);
ParseTypeFilter(packEntry, packItem.type);
packs.push_back(packItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ solution:
output-dirs:
intdir: ../PortAbility
outdir: ..\Portability

packs:
- pack: ARM::RteTest_DFP
path: ../../solutionspecificpack
- pack: ARM::RteTest_DFP
path: ..\..\SolutionSpecificPack
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ solution:
projects:
- project: ./Case/caSe.cproject.yml
- project: .\bs\bs.cproject.yml

add-path:
- ./$Compiler$
3 changes: 3 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3525,6 +3525,7 @@ TEST_F(ProjMgrUnitTests, EnsurePortability) {
const vector<string> expectedSeparator = {
{"portability.csolution.yml:20:13 - warning csolution: '..\\Portability' contains non-portable backslash, use forward slash instead"},
{"portability.csolution.yml:14:7 - warning csolution: '..\\Portability' contains non-portable backslash, use forward slash instead"},
{"portability.csolution.yml:26:13 - warning csolution: '..\\..\\SolutionSpecificPack' contains non-portable backslash, use forward slash instead"},
{"bs/bs.cproject.yml:10:16 - warning csolution: '..\\artifact.elf' contains non-portable backslash, use forward slash instead"},
{"bs/bs.cproject.yml:7:14 - warning csolution: '..\\layer.clayer.yml' contains non-portable backslash, use forward slash instead"},
{"bs/bs.cproject.yml:4:15 - warning csolution: '..\\linker_script.ld' contains non-portable backslash, use forward slash instead"},
Expand All @@ -3536,6 +3537,7 @@ TEST_F(ProjMgrUnitTests, EnsurePortability) {
const vector<string> expectedCase = {
{"portability.csolution.yml:19:13 - warning csolution: '../PortAbility' has case inconsistency, use '.' instead"},
{"portability.csolution.yml:13:7 - warning csolution: '../PortAbility' has case inconsistency, use '.' instead"},
{"portability.csolution.yml:24:13 - warning csolution: '../../solutionspecificpack' has case inconsistency, use '../../SolutionSpecificPack' instead"},
{"case/case.cproject.yml:10:16 - warning csolution: '../Artifact.elf' has case inconsistency, use '../artifact.elf' instead"},
{"case/case.cproject.yml:7:14 - warning csolution: '../laYer.clayer.yml' has case inconsistency, use '../layer.clayer.yml' instead"},
{"case/case.cproject.yml:4:15 - warning csolution: '../linker_Script.ld' has case inconsistency, use '../linker_script.ld' instead"},
Expand All @@ -3547,6 +3549,7 @@ TEST_F(ProjMgrUnitTests, EnsurePortability) {
const vector<string> expectedNotFound = {
{"portability.csolution.yml:13:7 - warning csolution: path '../PortAbility' was not found"},
{"portability.csolution.yml:14:7 - warning csolution: path '..\\Portability' was not found"},
{"portability.csolution.yml:26:13 - warning csolution: path '..\\..\\SolutionSpecificPack' was not found"},
{"bs/bs.cproject.yml:7:14 - warning csolution: path '..\\layer.clayer.yml' was not found"},
{"bs/bs.cproject.yml:4:15 - warning csolution: path '..\\linker_script.ld' was not found"},
{"bs/bs.cproject.yml:13:15 - warning csolution: path '..\\..\\Portability' was not found"},
Expand Down
Loading