summaryrefslogtreecommitdiffstats
path: root/Source/cmScanDepFormat.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2021-06-08 15:27:39 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-09 14:50:41 (GMT)
commit82c867ad85785cdf6efed98f8fdef27419375f29 (patch)
tree5d423e0b600adbb1a19ddf517902e70c6e7e6ba4 /Source/cmScanDepFormat.cxx
parent5e26887c35be116a83ba049098f5780309ced073 (diff)
downloadCMake-82c867ad85785cdf6efed98f8fdef27419375f29.zip
CMake-82c867ad85785cdf6efed98f8fdef27419375f29.tar.gz
CMake-82c867ad85785cdf6efed98f8fdef27419375f29.tar.bz2
cmScanDepFormat: P1689R4: Flatten future-compile members into parent
Diffstat (limited to 'Source/cmScanDepFormat.cxx')
-rw-r--r--Source/cmScanDepFormat.cxx102
1 files changed, 48 insertions, 54 deletions
diff --git a/Source/cmScanDepFormat.cxx b/Source/cmScanDepFormat.cxx
index e66f96d..8e09a78 100644
--- a/Source/cmScanDepFormat.cxx
+++ b/Source/cmScanDepFormat.cxx
@@ -117,65 +117,61 @@ bool cmScanDepFormat_P1689_Parse(std::string const& arg_pp,
return false;
}
- if (rule.isMember("future-compile")) {
- Json::Value const& future_compile = rule["future-compile"];
-
- if (future_compile.isMember("outputs")) {
- Json::Value const& outputs = future_compile["outputs"];
- if (outputs.isArray()) {
- if (outputs.empty()) {
- cmSystemTools::Error(
- cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp,
- ": expected at least one 1 output"));
- return false;
- }
-
- PARSE_FILENAME(outputs[0], info->PrimaryOutput);
+ if (rule.isMember("outputs")) {
+ Json::Value const& outputs = rule["outputs"];
+ if (outputs.isArray()) {
+ if (outputs.empty()) {
+ cmSystemTools::Error(
+ cmStrCat("-E cmake_ninja_dyndep failed to parse ", arg_pp,
+ ": expected at least one 1 output"));
+ return false;
}
+
+ PARSE_FILENAME(outputs[0], info->PrimaryOutput);
}
+ }
- if (future_compile.isMember("provides")) {
- Json::Value const& provides = future_compile["provides"];
- if (provides.isArray()) {
- for (auto const& provide : provides) {
- cmSourceReqInfo provide_info;
-
- Json::Value const& logical_name = provide["logical-name"];
- PARSE_BLOB(logical_name, provide_info.LogicalName);
-
- if (provide.isMember("compiled-module-path")) {
- Json::Value const& compiled_module_path =
- provide["compiled-module-path"];
- PARSE_FILENAME(compiled_module_path,
- provide_info.CompiledModulePath);
- } else {
- provide_info.CompiledModulePath =
- cmStrCat(provide_info.LogicalName, ".mod");
- }
-
- info->Provides.push_back(provide_info);
+ if (rule.isMember("provides")) {
+ Json::Value const& provides = rule["provides"];
+ if (provides.isArray()) {
+ for (auto const& provide : provides) {
+ cmSourceReqInfo provide_info;
+
+ Json::Value const& logical_name = provide["logical-name"];
+ PARSE_BLOB(logical_name, provide_info.LogicalName);
+
+ if (provide.isMember("compiled-module-path")) {
+ Json::Value const& compiled_module_path =
+ provide["compiled-module-path"];
+ PARSE_FILENAME(compiled_module_path,
+ provide_info.CompiledModulePath);
+ } else {
+ provide_info.CompiledModulePath =
+ cmStrCat(provide_info.LogicalName, ".mod");
}
+
+ info->Provides.push_back(provide_info);
}
}
+ }
- if (future_compile.isMember("requires")) {
- Json::Value const& reqs = future_compile["requires"];
- if (reqs.isArray()) {
- for (auto const& require : reqs) {
- cmSourceReqInfo require_info;
-
- Json::Value const& logical_name = require["logical-name"];
- PARSE_BLOB(logical_name, require_info.LogicalName);
+ if (rule.isMember("requires")) {
+ Json::Value const& reqs = rule["requires"];
+ if (reqs.isArray()) {
+ for (auto const& require : reqs) {
+ cmSourceReqInfo require_info;
- if (require.isMember("compiled-module-path")) {
- Json::Value const& compiled_module_path =
- require["compiled-module-path"];
- PARSE_FILENAME(compiled_module_path,
- require_info.CompiledModulePath);
- }
+ Json::Value const& logical_name = require["logical-name"];
+ PARSE_BLOB(logical_name, require_info.LogicalName);
- info->Requires.push_back(require_info);
+ if (require.isMember("compiled-module-path")) {
+ Json::Value const& compiled_module_path =
+ require["compiled-module-path"];
+ PARSE_FILENAME(compiled_module_path,
+ require_info.CompiledModulePath);
}
+
+ info->Requires.push_back(require_info);
}
}
}
@@ -196,12 +192,10 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
Json::Value rule(Json::objectValue);
- Json::Value& future_compile = rule["future-compile"] = Json::objectValue;
-
- Json::Value& outputs = future_compile["outputs"] = Json::arrayValue;
+ Json::Value& outputs = rule["outputs"] = Json::arrayValue;
outputs.append(info.PrimaryOutput);
- Json::Value& provides = future_compile["provides"] = Json::arrayValue;
+ Json::Value& provides = rule["provides"] = Json::arrayValue;
for (auto const& provide : info.Provides) {
Json::Value provide_obj(Json::objectValue);
auto const encoded = EncodeFilename(provide.LogicalName);
@@ -218,7 +212,7 @@ bool cmScanDepFormat_P1689_Write(std::string const& path,
provides.append(provide_obj);
}
- Json::Value& reqs = future_compile["requires"] = Json::arrayValue;
+ Json::Value& reqs = rule["requires"] = Json::arrayValue;
for (auto const& require : info.Requires) {
Json::Value require_obj(Json::objectValue);
auto const encoded = EncodeFilename(require.LogicalName);