diff options
Diffstat (limited to 'Source/cmCMakePresetsGraphReadJSON.cxx')
-rw-r--r-- | Source/cmCMakePresetsGraphReadJSON.cxx | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx index 54fea40..8d63441 100644 --- a/Source/cmCMakePresetsGraphReadJSON.cxx +++ b/Source/cmCMakePresetsGraphReadJSON.cxx @@ -15,7 +15,7 @@ #include <cm3p/json/value.h> -#include "cmCMakePresetErrors.h" +#include "cmCMakePresetsErrors.h" #include "cmCMakePresetsGraph.h" #include "cmCMakePresetsGraphInternal.h" #include "cmJSONHelpers.h" @@ -71,18 +71,18 @@ auto const ConditionStringHelper = JSONHelperBuilder::String(); auto const ConditionBoolHelper = JSONHelperBuilder::Bool(); auto const ConditionStringListHelper = JSONHelperBuilder::Vector<std::string>( - cmCMakePresetErrors::INVALID_CONDITION, ConditionStringHelper); + cmCMakePresetsErrors::INVALID_CONDITION, ConditionStringHelper); auto const ConstConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::ConstCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("value"_s, &cmCMakePresetsGraphInternal::ConstCondition::Value, ConditionBoolHelper, true); auto const EqualsConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::EqualsCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("lhs"_s, &cmCMakePresetsGraphInternal::EqualsCondition::Lhs, ConditionStringHelper, true) @@ -91,7 +91,7 @@ auto const EqualsConditionHelper = auto const InListConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::InListCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("string"_s, &cmCMakePresetsGraphInternal::InListCondition::String, ConditionStringHelper, true) @@ -100,7 +100,7 @@ auto const InListConditionHelper = auto const MatchesConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::MatchesCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("string"_s, &cmCMakePresetsGraphInternal::MatchesCondition::String, ConditionStringHelper, true) @@ -112,10 +112,10 @@ bool SubConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out, auto const ListConditionVectorHelper = JSONHelperBuilder::Vector<std::unique_ptr<cmCMakePresetsGraph::Condition>>( - cmCMakePresetErrors::INVALID_CONDITION, SubConditionHelper); + cmCMakePresetsErrors::INVALID_CONDITION, SubConditionHelper); auto const AnyAllOfConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::AnyAllOfCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("conditions"_s, &cmCMakePresetsGraphInternal::AnyAllOfCondition::Conditions, @@ -123,7 +123,7 @@ auto const AnyAllOfConditionHelper = auto const NotConditionHelper = JSONHelperBuilder::Object<cmCMakePresetsGraphInternal::NotCondition>( - cmCMakePresetErrors::INVALID_CONDITION_OBJECT, false) + cmCMakePresetsErrors::INVALID_CONDITION_OBJECT, false) .Bind<std::string>("type"_s, nullptr, ConditionStringHelper, true) .Bind("condition"_s, &cmCMakePresetsGraphInternal::NotCondition::SubCondition, @@ -151,12 +151,12 @@ bool ConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out, if (value->isObject()) { if (!value->isMember("type")) { - cmCMakePresetErrors::INVALID_CONDITION(value, state); + cmCMakePresetsErrors::INVALID_CONDITION(value, state); return false; } if (!(*value)["type"].isString()) { - cmCMakePresetErrors::INVALID_CONDITION(value, state); + cmCMakePresetsErrors::INVALID_CONDITION(value, state); return false; } auto type = (*value)["type"].asString(); @@ -216,7 +216,7 @@ bool ConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out, } } - cmCMakePresetErrors::INVALID_CONDITION(value, state); + cmCMakePresetsErrors::INVALID_CONDITION(value, state); return false; } @@ -226,7 +226,7 @@ bool SubConditionHelper(std::unique_ptr<cmCMakePresetsGraph::Condition>& out, std::unique_ptr<cmCMakePresetsGraph::Condition> ptr; auto result = ConditionHelper(ptr, value, state); if (ptr && ptr->IsNull()) { - cmCMakePresetErrors::INVALID_CONDITION(value, state); + cmCMakePresetsErrors::INVALID_CONDITION(value, state); return false; } out = std::move(ptr); @@ -244,22 +244,22 @@ bool EnvironmentHelper(cm::optional<std::string>& out, out = value->asString(); return true; } - cmCMakePresetErrors::INVALID_PRESET(value, state); + cmCMakePresetsErrors::INVALID_PRESET(value, state); return false; } auto const VersionIntHelper = - JSONHelperBuilder::Int(cmCMakePresetErrors::INVALID_VERSION); + JSONHelperBuilder::Int(cmCMakePresetsErrors::INVALID_VERSION); auto const VersionHelper = JSONHelperBuilder::Required<int>( - cmCMakePresetErrors::NO_VERSION, VersionIntHelper); + cmCMakePresetsErrors::NO_VERSION, VersionIntHelper); auto const RootVersionHelper = - JSONHelperBuilder::Object<int>(cmCMakePresetErrors::INVALID_ROOT_OBJECT) + JSONHelperBuilder::Object<int>(cmCMakePresetsErrors::INVALID_ROOT_OBJECT) .Bind("version"_s, VersionHelper, false); auto const CMakeVersionUIntHelper = - JSONHelperBuilder::UInt(cmCMakePresetErrors::INVALID_VERSION); + JSONHelperBuilder::UInt(cmCMakePresetsErrors::INVALID_VERSION); auto const CMakeVersionHelper = JSONHelperBuilder::Object<CMakeVersion>(JsonErrors::INVALID_NAMED_OBJECT_KEY, @@ -269,14 +269,14 @@ auto const CMakeVersionHelper = .Bind("patch"_s, &CMakeVersion::Patch, CMakeVersionUIntHelper, false); auto const IncludeHelper = - JSONHelperBuilder::String(cmCMakePresetErrors::INVALID_INCLUDE); + JSONHelperBuilder::String(cmCMakePresetsErrors::INVALID_INCLUDE); auto const IncludeVectorHelper = JSONHelperBuilder::Vector<std::string>( - cmCMakePresetErrors::INVALID_INCLUDE, IncludeHelper); + cmCMakePresetsErrors::INVALID_INCLUDE, IncludeHelper); auto const RootPresetsHelper = JSONHelperBuilder::Object<RootPresets>( - cmCMakePresetErrors::INVALID_ROOT_OBJECT, false) + cmCMakePresetsErrors::INVALID_ROOT_OBJECT, false) .Bind<int>("version"_s, nullptr, VersionHelper) .Bind("configurePresets"_s, &RootPresets::ConfigurePresets, cmCMakePresetsGraphInternal::ConfigurePresetsHelper, false) @@ -293,7 +293,7 @@ auto const RootPresetsHelper = .Bind("include"_s, &RootPresets::Include, IncludeVectorHelper, false) .Bind<std::nullptr_t>("vendor"_s, nullptr, cmCMakePresetsGraphInternal::VendorHelper( - cmCMakePresetErrors::INVALID_ROOT), + cmCMakePresetsErrors::INVALID_ROOT), false); } @@ -309,7 +309,7 @@ bool PresetNameHelper(std::string& out, const Json::Value* value, cmJSONState* state) { if (!value || !value->isString() || value->asString().empty()) { - cmCMakePresetErrors::INVALID_PRESET_NAME(value, state); + cmCMakePresetsErrors::INVALID_PRESET_NAME(value, state); return false; } out = value->asString(); @@ -320,7 +320,7 @@ bool PresetVectorStringHelper(std::vector<std::string>& out, const Json::Value* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector<std::string>( - cmCMakePresetErrors::INVALID_PRESET, + cmCMakePresetsErrors::INVALID_PRESET, cmCMakePresetsGraphInternal::PresetStringHelper); return helper(out, value, state); } @@ -356,7 +356,7 @@ bool PresetVectorIntHelper(std::vector<int>& out, const Json::Value* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Vector<int>( - cmCMakePresetErrors::INVALID_PRESET, PresetIntHelper); + cmCMakePresetsErrors::INVALID_PRESET, PresetIntHelper); return helper(out, value, state); } @@ -409,7 +409,7 @@ bool EnvironmentMapHelper( const Json::Value* value, cmJSONState* state) { static auto const helper = JSONHelperBuilder::Map<cm::optional<std::string>>( - cmCMakePresetErrors::INVALID_PRESET, EnvironmentHelper); + cmCMakePresetsErrors::INVALID_PRESET, EnvironmentHelper); return helper(out, value, state); } @@ -429,7 +429,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, auto fileIt = std::find(inProgressFiles.begin(), inProgressFiles.end(), file); if (fileIt != inProgressFiles.end()) { - cmCMakePresetErrors::CYCLIC_INCLUDE(filename, &this->parseState); + cmCMakePresetsErrors::CYCLIC_INCLUDE(filename, &this->parseState); return false; } @@ -448,43 +448,43 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, return result; } if (v < MIN_VERSION || v > MAX_VERSION) { - cmCMakePresetErrors::UNRECOGNIZED_VERSION(&root["version"], - &this->parseState); + cmCMakePresetsErrors::UNRECOGNIZED_VERSION(&root["version"], + &this->parseState); return false; } // Support for build and test presets added in version 2. if (v < 2) { if (root.isMember("buildPresets")) { - cmCMakePresetErrors::BUILD_TEST_PRESETS_UNSUPPORTED( + cmCMakePresetsErrors::BUILD_TEST_PRESETS_UNSUPPORTED( &root["buildPresets"], &this->parseState); return false; } if (root.isMember("testPresets")) { - cmCMakePresetErrors::BUILD_TEST_PRESETS_UNSUPPORTED(&root["testPresets"], - &this->parseState); + cmCMakePresetsErrors::BUILD_TEST_PRESETS_UNSUPPORTED( + &root["testPresets"], &this->parseState); return false; } } // Support for package presets added in version 6. if (v < 6 && root.isMember("packagePresets")) { - cmCMakePresetErrors::PACKAGE_PRESETS_UNSUPPORTED(&root["packagePresets"], - &this->parseState); + cmCMakePresetsErrors::PACKAGE_PRESETS_UNSUPPORTED(&root["packagePresets"], + &this->parseState); return false; } // Support for workflow presets added in version 6. if (v < 6 && root.isMember("workflowPresets")) { - cmCMakePresetErrors::WORKFLOW_PRESETS_UNSUPPORTED(&root["workflowPresets"], - &this->parseState); + cmCMakePresetsErrors::WORKFLOW_PRESETS_UNSUPPORTED( + &root["workflowPresets"], &this->parseState); return false; } // Support for include added in version 4. if (v < 4 && root.isMember("include")) { - cmCMakePresetErrors::INCLUDE_UNSUPPORTED(&root["include"], - &this->parseState); + cmCMakePresetsErrors::INCLUDE_UNSUPPORTED(&root["include"], + &this->parseState); return false; } @@ -498,20 +498,20 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, unsigned int currentPatch = cmVersion::GetPatchVersion(); auto const& required = presets.CMakeMinimumRequired; if (required.Major > currentMajor) { - ErrorGenerator error = cmCMakePresetErrors::UNRECOGNIZED_CMAKE_VERSION( + ErrorGenerator error = cmCMakePresetsErrors::UNRECOGNIZED_CMAKE_VERSION( "major", currentMajor, required.Major); error(&root["cmakeMinimumRequired"]["major"], &this->parseState); return false; } if (required.Major == currentMajor) { if (required.Minor > currentMinor) { - ErrorGenerator error = cmCMakePresetErrors::UNRECOGNIZED_CMAKE_VERSION( + ErrorGenerator error = cmCMakePresetsErrors::UNRECOGNIZED_CMAKE_VERSION( "minor", currentMinor, required.Minor); error(&root["cmakeMinimumRequired"]["minor"], &this->parseState); return false; } if (required.Minor == currentMinor && required.Patch > currentPatch) { - ErrorGenerator error = cmCMakePresetErrors::UNRECOGNIZED_CMAKE_VERSION( + ErrorGenerator error = cmCMakePresetsErrors::UNRECOGNIZED_CMAKE_VERSION( "patch", currentPatch, required.Patch); error(&root["cmakeMinimumRequired"]["patch"], &this->parseState); return false; @@ -537,26 +537,26 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, presetPair.Unexpanded = preset; presetPair.Expanded = cm::nullopt; if (!this->ConfigurePresets.emplace(preset.Name, presetPair).second) { - cmCMakePresetErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); + cmCMakePresetsErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); return false; } // Support for installDir presets added in version 3. if (v < 3 && !preset.InstallDir.empty()) { - cmCMakePresetErrors::INSTALL_PREFIX_UNSUPPORTED(&root["installDir"], - &this->parseState); + cmCMakePresetsErrors::INSTALL_PREFIX_UNSUPPORTED(&root["installDir"], + &this->parseState); return false; } // Support for conditions added in version 3. if (v < 3 && preset.ConditionEvaluator) { - cmCMakePresetErrors::CONDITION_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::CONDITION_UNSUPPORTED(&this->parseState); return false; } // Support for toolchainFile presets added in version 3. if (v < 3 && !preset.ToolchainFile.empty()) { - cmCMakePresetErrors::TOOLCHAIN_FILE_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::TOOLCHAIN_FILE_UNSUPPORTED(&this->parseState); return false; } @@ -564,7 +564,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, if (v < 7 && (preset.TraceMode.has_value() || preset.TraceFormat.has_value() || !preset.TraceRedirect.empty() || !preset.TraceSource.empty())) { - cmCMakePresetErrors::TRACE_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::TRACE_UNSUPPORTED(&this->parseState); return false; } @@ -582,13 +582,13 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, presetPair.Unexpanded = preset; presetPair.Expanded = cm::nullopt; if (!this->BuildPresets.emplace(preset.Name, presetPair).second) { - cmCMakePresetErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); + cmCMakePresetsErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); return false; } // Support for conditions added in version 3. if (v < 3 && preset.ConditionEvaluator) { - cmCMakePresetErrors::CONDITION_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::CONDITION_UNSUPPORTED(&this->parseState); return false; } @@ -606,26 +606,26 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, presetPair.Unexpanded = preset; presetPair.Expanded = cm::nullopt; if (!this->TestPresets.emplace(preset.Name, presetPair).second) { - cmCMakePresetErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); + cmCMakePresetsErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); return false; } // Support for conditions added in version 3. if (v < 3 && preset.ConditionEvaluator) { - cmCMakePresetErrors::CONDITION_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::CONDITION_UNSUPPORTED(&this->parseState); return false; } // Support for TestOutputTruncation added in version 5. if (v < 5 && preset.Output && preset.Output->TestOutputTruncation) { - cmCMakePresetErrors::TEST_OUTPUT_TRUNCATION_UNSUPPORTED( + cmCMakePresetsErrors::TEST_OUTPUT_TRUNCATION_UNSUPPORTED( &this->parseState); return false; } // Support for outputJUnitFile added in version 6. if (v < 6 && preset.Output && !preset.Output->OutputJUnitFile.empty()) { - cmCMakePresetErrors::CTEST_JUNIT_UNSUPPORTED(&this->parseState); + cmCMakePresetsErrors::CTEST_JUNIT_UNSUPPORTED(&this->parseState); return false; } @@ -643,7 +643,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, presetPair.Unexpanded = preset; presetPair.Expanded = cm::nullopt; if (!this->PackagePresets.emplace(preset.Name, presetPair).second) { - cmCMakePresetErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); + cmCMakePresetsErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); return false; } @@ -664,7 +664,7 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, presetPair.Unexpanded = preset; presetPair.Expanded = cm::nullopt; if (!this->WorkflowPresets.emplace(preset.Name, presetPair).second) { - cmCMakePresetErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); + cmCMakePresetsErrors::DUPLICATE_PRESETS(preset.Name, &this->parseState); return false; } @@ -718,8 +718,8 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename, // Support for macro expansion in includes added in version 7 if (v >= 7) { if (ExpandMacros(include, macroExpanders, v) != ExpandMacroResult::Ok) { - cmCMakePresetErrors::INVALID_INCLUDE(&root["include"][i], - &this->parseState); + cmCMakePresetsErrors::INVALID_INCLUDE(&root["include"][i], + &this->parseState); return false; } } |