diff options
Diffstat (limited to 'Source/cmCMakePresetsGraph.cxx')
-rw-r--r-- | Source/cmCMakePresetsGraph.cxx | 379 |
1 files changed, 178 insertions, 201 deletions
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx index 7325e44..13e8bad 100644 --- a/Source/cmCMakePresetsGraph.cxx +++ b/Source/cmCMakePresetsGraph.cxx @@ -14,6 +14,7 @@ #include "cmsys/RegularExpression.hxx" +#include "cmCMakePresetErrors.h" #include "cmCMakePresetsGraphInternal.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -39,7 +40,6 @@ enum class CycleStatus Verified, }; -using ReadFileResult = cmCMakePresetsGraph::ReadFileResult; using ConfigurePreset = cmCMakePresetsGraph::ConfigurePreset; using BuildPreset = cmCMakePresetsGraph::BuildPreset; using TestPreset = cmCMakePresetsGraph::TestPreset; @@ -81,17 +81,18 @@ void InheritVector(std::vector<T>& child, const std::vector<T>& parent) * inheritance. */ template <class T> -ReadFileResult VisitPreset( +bool VisitPreset( T& preset, std::map<std::string, cmCMakePresetsGraph::PresetPair<T>>& presets, - std::map<std::string, CycleStatus> cycleStatus, - const cmCMakePresetsGraph& graph) + std::map<std::string, CycleStatus> cycleStatus, cmCMakePresetsGraph& graph) { switch (cycleStatus[preset.Name]) { case CycleStatus::InProgress: - return ReadFileResult::CYCLIC_PRESET_INHERITANCE; + cmCMakePresetErrors::CYCLIC_PRESET_INHERITANCE(preset.Name, + &graph.parseState); + return false; case CycleStatus::Verified: - return ReadFileResult::READ_OK; + return true; default: break; } @@ -99,28 +100,41 @@ ReadFileResult VisitPreset( cycleStatus[preset.Name] = CycleStatus::InProgress; if (preset.Environment.count("") != 0) { - return ReadFileResult::INVALID_PRESET; + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, &graph.parseState); + return false; } - CHECK_OK(preset.VisitPresetBeforeInherit()); + bool result = preset.VisitPresetBeforeInherit(); + if (!result) { + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, &graph.parseState); + return false; + } for (auto const& i : preset.Inherits) { auto parent = presets.find(i); if (parent == presets.end()) { - return ReadFileResult::INVALID_PRESET; + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, + &graph.parseState); + return false; } auto& parentPreset = parent->second.Unexpanded; if (!preset.OriginFile->ReachableFiles.count(parentPreset.OriginFile)) { - return ReadFileResult::INHERITED_PRESET_UNREACHABLE_FROM_FILE; + cmCMakePresetErrors::INHERITED_PRESET_UNREACHABLE_FROM_FILE( + preset.Name, &graph.parseState); + return false; } - auto result = VisitPreset(parentPreset, presets, cycleStatus, graph); - if (result != ReadFileResult::READ_OK) { - return result; + if (!VisitPreset(parentPreset, presets, cycleStatus, graph)) { + return false; } - CHECK_OK(preset.VisitPresetInherit(parentPreset)); + result = preset.VisitPresetInherit(parentPreset); + if (!result) { + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, + &graph.parseState); + return false; + } for (auto const& v : parentPreset.Environment) { preset.Environment.insert(v); @@ -135,16 +149,21 @@ ReadFileResult VisitPreset( preset.ConditionEvaluator.reset(); } - CHECK_OK(preset.VisitPresetAfterInherit(graph.GetVersion(preset))); + result = preset.VisitPresetAfterInherit(graph.GetVersion(preset), + &graph.parseState); + if (!result) { + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, &graph.parseState); + return false; + } cycleStatus[preset.Name] = CycleStatus::Verified; - return ReadFileResult::READ_OK; + return true; } template <class T> -ReadFileResult ComputePresetInheritance( +bool ComputePresetInheritance( std::map<std::string, cmCMakePresetsGraph::PresetPair<T>>& presets, - const cmCMakePresetsGraph& graph) + cmCMakePresetsGraph& graph) { std::map<std::string, CycleStatus> cycleStatus; for (auto const& it : presets) { @@ -153,13 +172,12 @@ ReadFileResult ComputePresetInheritance( for (auto& it : presets) { auto& preset = it.second.Unexpanded; - auto result = VisitPreset<T>(preset, presets, cycleStatus, graph); - if (result != ReadFileResult::READ_OK) { - return result; + if (!VisitPreset<T>(preset, presets, cycleStatus, graph)) { + return false; } } - return ReadFileResult::READ_OK; + return true; } constexpr const char* ValidPrefixes[] = { @@ -338,7 +356,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/, } template <class T> -bool ExpandMacros(const cmCMakePresetsGraph& graph, const T& preset, +bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset, cm::optional<T>& out) { out.emplace(preset); @@ -448,6 +466,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const T& preset, switch (VisitEnv(*v.second, envCycles[v.first], macroExpanders, graph.GetVersion(preset))) { case ExpandMacroResult::Error: + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, + &graph.parseState); return false; case ExpandMacroResult::Ignore: out.reset(); @@ -462,6 +482,8 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const T& preset, cm::optional<bool> result; if (!preset.ConditionEvaluator->Evaluate( macroExpanders, graph.GetVersion(preset), result)) { + cmCMakePresetErrors::INVALID_PRESET_NAMED(preset.Name, + &graph.parseState); return false; } if (!result) { @@ -594,39 +616,44 @@ ExpandMacroResult ExpandMacro(std::string& out, } template <typename T> -ReadFileResult SetupWorkflowConfigurePreset( - const T& preset, const ConfigurePreset*& configurePreset) +bool SetupWorkflowConfigurePreset(const T& preset, + const ConfigurePreset*& configurePreset, + cmJSONState* state) { if (preset.ConfigurePreset != configurePreset->Name) { - return ReadFileResult::INVALID_WORKFLOW_STEPS; + cmCMakePresetErrors::INVALID_WORKFLOW_STEPS(configurePreset->Name, state); + return false; } - return ReadFileResult::READ_OK; + return true; } template <> -ReadFileResult SetupWorkflowConfigurePreset<ConfigurePreset>( - const ConfigurePreset& preset, const ConfigurePreset*& configurePreset) +bool SetupWorkflowConfigurePreset<ConfigurePreset>( + const ConfigurePreset& preset, const ConfigurePreset*& configurePreset, + cmJSONState*) { configurePreset = &preset; - return ReadFileResult::READ_OK; + return true; } template <typename T> -ReadFileResult TryReachPresetFromWorkflow( +bool TryReachPresetFromWorkflow( const WorkflowPreset& origin, const std::map<std::string, PresetPair<T>>& presets, const std::string& name, - const ConfigurePreset*& configurePreset) + const ConfigurePreset*& configurePreset, cmJSONState* state) { auto it = presets.find(name); if (it == presets.end()) { - return ReadFileResult::INVALID_WORKFLOW_STEPS; + cmCMakePresetErrors::INVALID_WORKFLOW_STEPS(name, state); + return false; } if (!origin.OriginFile->ReachableFiles.count( it->second.Unexpanded.OriginFile)) { - return ReadFileResult::WORKFLOW_STEP_UNREACHABLE_FROM_FILE; + cmCMakePresetErrors::WORKFLOW_STEP_UNREACHABLE_FROM_FILE(name, state); + return false; } return SetupWorkflowConfigurePreset<T>(it->second.Unexpanded, - configurePreset); + configurePreset, state); } } @@ -722,8 +749,7 @@ bool cmCMakePresetsGraphInternal::NotCondition::Evaluate( return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::ConfigurePreset::VisitPresetInherit( +bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetInherit( const cmCMakePresetsGraph::Preset& parentPreset) { auto& preset = *this; @@ -753,50 +779,52 @@ cmCMakePresetsGraph::ConfigurePreset::VisitPresetInherit( preset.CacheVariables.insert(v); } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::ConfigurePreset::VisitPresetBeforeInherit() +bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetBeforeInherit() { auto& preset = *this; if (preset.Environment.count("") != 0) { - return ReadFileResult::INVALID_PRESET; + return false; } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::ConfigurePreset::VisitPresetAfterInherit(int version) +bool cmCMakePresetsGraph::ConfigurePreset::VisitPresetAfterInherit( + int version, cmJSONState* state) { auto& preset = *this; if (!preset.Hidden) { if (version < 3) { if (preset.Generator.empty()) { - return ReadFileResult::INVALID_PRESET; + cmCMakePresetErrors::PRESET_MISSING_FIELD(preset.Name, "generator", + state); + return false; } if (preset.BinaryDir.empty()) { - return ReadFileResult::INVALID_PRESET; + cmCMakePresetErrors::PRESET_MISSING_FIELD(preset.Name, "binaryDir", + state); + return false; } } if (preset.WarnDev == false && preset.ErrorDev == true) { - return ReadFileResult::INVALID_PRESET; + return false; } if (preset.WarnDeprecated == false && preset.ErrorDeprecated == true) { - return ReadFileResult::INVALID_PRESET; + return false; } if (preset.CacheVariables.count("") != 0) { - return ReadFileResult::INVALID_PRESET; + return false; } } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::BuildPreset::VisitPresetInherit( +bool cmCMakePresetsGraph::BuildPreset::VisitPresetInherit( const cmCMakePresetsGraph::Preset& parentPreset) { auto& preset = *this; @@ -815,21 +843,20 @@ cmCMakePresetsGraph::BuildPreset::VisitPresetInherit( preset.ResolvePackageReferences = parent.ResolvePackageReferences; } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::BuildPreset::VisitPresetAfterInherit(int /* version */) +bool cmCMakePresetsGraph::BuildPreset::VisitPresetAfterInherit( + int /* version */, cmJSONState* /*stat*/) { auto& preset = *this; if (!preset.Hidden && preset.ConfigurePreset.empty()) { - return ReadFileResult::INVALID_PRESET; + return false; } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::TestPreset::VisitPresetInherit( +bool cmCMakePresetsGraph::TestPreset::VisitPresetInherit( const cmCMakePresetsGraph::Preset& parentPreset) { auto& preset = *this; @@ -928,21 +955,20 @@ cmCMakePresetsGraph::TestPreset::VisitPresetInherit( } } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::TestPreset::VisitPresetAfterInherit(int /* version */) +bool cmCMakePresetsGraph::TestPreset::VisitPresetAfterInherit( + int /* version */, cmJSONState* /*state*/) { auto& preset = *this; if (!preset.Hidden && preset.ConfigurePreset.empty()) { - return ReadFileResult::INVALID_PRESET; + return false; } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::PackagePreset::VisitPresetInherit( +bool cmCMakePresetsGraph::PackagePreset::VisitPresetInherit( const cmCMakePresetsGraph::Preset& parentPreset) { auto& preset = *this; @@ -966,30 +992,29 @@ cmCMakePresetsGraph::PackagePreset::VisitPresetInherit( InheritString(preset.PackageDirectory, parent.PackageDirectory); InheritString(preset.VendorName, parent.VendorName); - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::PackagePreset::VisitPresetAfterInherit(int /* version */) +bool cmCMakePresetsGraph::PackagePreset::VisitPresetAfterInherit( + int /* version */, cmJSONState* /*state*/) { auto& preset = *this; if (!preset.Hidden && preset.ConfigurePreset.empty()) { - return ReadFileResult::INVALID_PRESET; + return false; } - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::WorkflowPreset::VisitPresetInherit( +bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetInherit( const cmCMakePresetsGraph::Preset& /*parentPreset*/) { - return ReadFileResult::READ_OK; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::WorkflowPreset::VisitPresetAfterInherit(int /* version */) +bool cmCMakePresetsGraph::WorkflowPreset::VisitPresetAfterInherit( + int /* version */, cmJSONState* /*state*/) { - return ReadFileResult::READ_OK; + return true; } std::string cmCMakePresetsGraph::GetFilename(const std::string& sourceDir) @@ -1002,22 +1027,21 @@ std::string cmCMakePresetsGraph::GetUserFilename(const std::string& sourceDir) return cmStrCat(sourceDir, "/CMakeUserPresets.json"); } -cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadProjectPresets( - const std::string& sourceDir, bool allowNoFiles) +bool cmCMakePresetsGraph::ReadProjectPresets(const std::string& sourceDir, + bool allowNoFiles) { this->SourceDir = sourceDir; this->ClearPresets(); - auto result = this->ReadProjectPresetsInternal(allowNoFiles); - if (result != ReadFileResult::READ_OK) { + if (!this->ReadProjectPresetsInternal(allowNoFiles)) { this->ClearPresets(); + return false; } - return result; + return true; } -cmCMakePresetsGraph::ReadFileResult -cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) +bool cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) { bool haveOneFile = false; @@ -1025,21 +1049,17 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) std::string filename = GetUserFilename(this->SourceDir); std::vector<File*> inProgressFiles; if (cmSystemTools::FileExists(filename)) { - auto result = - this->ReadJSONFile(filename, RootType::User, ReadReason::Root, - inProgressFiles, file, this->errors); - if (result != ReadFileResult::READ_OK) { - return result; + if (!this->ReadJSONFile(filename, RootType::User, ReadReason::Root, + inProgressFiles, file, this->errors)) { + return false; } haveOneFile = true; } else { filename = GetFilename(this->SourceDir); if (cmSystemTools::FileExists(filename)) { - auto result = - this->ReadJSONFile(filename, RootType::Project, ReadReason::Root, - inProgressFiles, file, this->errors); - if (result != ReadFileResult::READ_OK) { - return result; + if (!this->ReadJSONFile(filename, RootType::Project, ReadReason::Root, + inProgressFiles, file, this->errors)) { + return false; } haveOneFile = true; } @@ -1047,19 +1067,28 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) assert(inProgressFiles.empty()); if (!haveOneFile) { - return allowNoFiles ? ReadFileResult::READ_OK - : ReadFileResult::FILE_NOT_FOUND; + if (allowNoFiles) { + return true; + } + cmCMakePresetErrors::FILE_NOT_FOUND(filename, &this->parseState); + return false; } - CHECK_OK(ComputePresetInheritance(this->ConfigurePresets, *this)); - CHECK_OK(ComputePresetInheritance(this->BuildPresets, *this)); - CHECK_OK(ComputePresetInheritance(this->TestPresets, *this)); - CHECK_OK(ComputePresetInheritance(this->PackagePresets, *this)); - CHECK_OK(ComputePresetInheritance(this->WorkflowPresets, *this)); + bool result = ComputePresetInheritance(this->ConfigurePresets, *this) && + ComputePresetInheritance(this->ConfigurePresets, *this) && + ComputePresetInheritance(this->BuildPresets, *this) && + ComputePresetInheritance(this->TestPresets, *this) && + ComputePresetInheritance(this->PackagePresets, *this) && + ComputePresetInheritance(this->WorkflowPresets, *this); + if (!result) { + return false; + } for (auto& it : this->ConfigurePresets) { if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { - return ReadFileResult::INVALID_MACRO_EXPANSION; + cmCMakePresetErrors::INVALID_MACRO_EXPANSION(it.first, + &this->parseState); + return false; } } @@ -1068,11 +1097,15 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) const auto configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { - return ReadFileResult::INVALID_CONFIGURE_PRESET; + cmCMakePresetErrors::INVALID_CONFIGURE_PRESET(it.first, + &this->parseState); + return false; } if (!it.second.Unexpanded.OriginFile->ReachableFiles.count( configurePreset->second.Unexpanded.OriginFile)) { - return ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE; + cmCMakePresetErrors::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE( + it.first, &this->parseState); + return false; } if (it.second.Unexpanded.InheritConfigureEnvironment.value_or(true)) { @@ -1083,7 +1116,9 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) } if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { - return ReadFileResult::INVALID_MACRO_EXPANSION; + cmCMakePresetErrors::INVALID_MACRO_EXPANSION(it.first, + &this->parseState); + return false; } } @@ -1092,11 +1127,15 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) const auto configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { - return ReadFileResult::INVALID_CONFIGURE_PRESET; + cmCMakePresetErrors::INVALID_CONFIGURE_PRESET(it.first, + &this->parseState); + return false; } if (!it.second.Unexpanded.OriginFile->ReachableFiles.count( configurePreset->second.Unexpanded.OriginFile)) { - return ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE; + cmCMakePresetErrors::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE( + it.first, &this->parseState); + return false; } if (it.second.Unexpanded.InheritConfigureEnvironment.value_or(true)) { @@ -1107,7 +1146,9 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) } if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { - return ReadFileResult::INVALID_MACRO_EXPANSION; + cmCMakePresetErrors::INVALID_MACRO_EXPANSION(it.first, + &this->parseState); + return false; } } @@ -1116,11 +1157,15 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) const auto configurePreset = this->ConfigurePresets.find(it.second.Unexpanded.ConfigurePreset); if (configurePreset == this->ConfigurePresets.end()) { - return ReadFileResult::INVALID_CONFIGURE_PRESET; + cmCMakePresetErrors::INVALID_CONFIGURE_PRESET(it.first, + &this->parseState); + return false; } if (!it.second.Unexpanded.OriginFile->ReachableFiles.count( configurePreset->second.Unexpanded.OriginFile)) { - return ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE; + cmCMakePresetErrors::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE( + it.first, &this->parseState); + return false; } if (it.second.Unexpanded.InheritConfigureEnvironment.value_or(true)) { @@ -1131,7 +1176,9 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) } if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { - return ReadFileResult::INVALID_MACRO_EXPANSION; + cmCMakePresetErrors::INVALID_MACRO_EXPANSION(it.first, + &this->parseState); + return false; } } @@ -1141,126 +1188,56 @@ cmCMakePresetsGraph::ReadProjectPresetsInternal(bool allowNoFiles) const ConfigurePreset* configurePreset = nullptr; for (auto const& step : it.second.Unexpanded.Steps) { if (configurePreset == nullptr && step.PresetType != Type::Configure) { - return ReadFileResult::INVALID_WORKFLOW_STEPS; + cmCMakePresetErrors::FIRST_WORKFLOW_STEP_NOT_CONFIGURE( + step.PresetName, &this->parseState); + return false; } if (configurePreset != nullptr && step.PresetType == Type::Configure) { - return ReadFileResult::INVALID_WORKFLOW_STEPS; + cmCMakePresetErrors::CONFIGURE_WORKFLOW_STEP_NOT_FIRST( + step.PresetName, &this->parseState); + return false; } - ReadFileResult result; switch (step.PresetType) { case Type::Configure: result = TryReachPresetFromWorkflow( it.second.Unexpanded, this->ConfigurePresets, step.PresetName, - configurePreset); + configurePreset, &this->parseState); break; case Type::Build: result = TryReachPresetFromWorkflow( it.second.Unexpanded, this->BuildPresets, step.PresetName, - configurePreset); + configurePreset, &this->parseState); break; case Type::Test: - result = - TryReachPresetFromWorkflow(it.second.Unexpanded, this->TestPresets, - step.PresetName, configurePreset); + result = TryReachPresetFromWorkflow( + it.second.Unexpanded, this->TestPresets, step.PresetName, + configurePreset, &this->parseState); break; case Type::Package: result = TryReachPresetFromWorkflow( it.second.Unexpanded, this->PackagePresets, step.PresetName, - configurePreset); + configurePreset, &this->parseState); break; } - if (result != ReadFileResult::READ_OK) { - return result; + if (!result) { + return false; } } if (configurePreset == nullptr) { - return ReadFileResult::INVALID_WORKFLOW_STEPS; + cmCMakePresetErrors::NO_WORKFLOW_STEPS(it.first, &this->parseState); + return false; } if (!ExpandMacros(*this, it.second.Unexpanded, it.second.Expanded)) { - return ReadFileResult::INVALID_MACRO_EXPANSION; + cmCMakePresetErrors::INVALID_MACRO_EXPANSION(it.first, + &this->parseState); + return false; } } - return ReadFileResult::READ_OK; -} - -const char* cmCMakePresetsGraph::ResultToString(ReadFileResult result) -{ - switch (result) { - case ReadFileResult::READ_OK: - return "OK"; - case ReadFileResult::FILE_NOT_FOUND: - return "File not found"; - case ReadFileResult::JSON_PARSE_ERROR: - return "JSON parse error"; - case ReadFileResult::INVALID_ROOT: - return "Invalid root object"; - case ReadFileResult::NO_VERSION: - return "No \"version\" field"; - case ReadFileResult::INVALID_VERSION: - return "Invalid \"version\" field"; - case ReadFileResult::UNRECOGNIZED_VERSION: - return "Unrecognized \"version\" field"; - case ReadFileResult::INVALID_CMAKE_VERSION: - return "Invalid \"cmakeMinimumRequired\" field"; - case ReadFileResult::UNRECOGNIZED_CMAKE_VERSION: - return "\"cmakeMinimumRequired\" version too new"; - case ReadFileResult::INVALID_PRESETS: - return "Invalid \"configurePresets\" field"; - case ReadFileResult::INVALID_PRESET: - return "Invalid preset"; - case ReadFileResult::INVALID_VARIABLE: - return "Invalid CMake variable definition"; - case ReadFileResult::DUPLICATE_PRESETS: - return "Duplicate presets"; - case ReadFileResult::CYCLIC_PRESET_INHERITANCE: - return "Cyclic preset inheritance"; - case ReadFileResult::INHERITED_PRESET_UNREACHABLE_FROM_FILE: - return "Inherited preset is unreachable from preset's file"; - case ReadFileResult::CONFIGURE_PRESET_UNREACHABLE_FROM_FILE: - return "Configure preset is unreachable from preset's file"; - case ReadFileResult::INVALID_MACRO_EXPANSION: - return "Invalid macro expansion"; - case ReadFileResult::BUILD_TEST_PRESETS_UNSUPPORTED: - return "File version must be 2 or higher for build and test preset " - "support."; - case ReadFileResult::PACKAGE_PRESETS_UNSUPPORTED: - return "File version must be 6 or higher for package preset support"; - case ReadFileResult::WORKFLOW_PRESETS_UNSUPPORTED: - return "File version must be 6 or higher for workflow preset support"; - case ReadFileResult::INCLUDE_UNSUPPORTED: - return "File version must be 4 or higher for include support"; - case ReadFileResult::INVALID_INCLUDE: - return "Invalid \"include\" field"; - case ReadFileResult::INVALID_CONFIGURE_PRESET: - return "Invalid \"configurePreset\" field"; - case ReadFileResult::INSTALL_PREFIX_UNSUPPORTED: - return "File version must be 3 or higher for installDir preset " - "support."; - case ReadFileResult::INVALID_CONDITION: - return "Invalid preset condition"; - case ReadFileResult::CONDITION_UNSUPPORTED: - return "File version must be 3 or higher for condition support"; - case ReadFileResult::TOOLCHAIN_FILE_UNSUPPORTED: - return "File version must be 3 or higher for toolchainFile preset " - "support."; - case ReadFileResult::CYCLIC_INCLUDE: - return "Cyclic include among preset files"; - case ReadFileResult::TEST_OUTPUT_TRUNCATION_UNSUPPORTED: - return "File version must be 5 or higher for testOutputTruncation " - "preset support."; - case ReadFileResult::INVALID_WORKFLOW_STEPS: - return "Invalid workflow steps"; - case ReadFileResult::WORKFLOW_STEP_UNREACHABLE_FROM_FILE: - return "Workflow step is unreachable from preset's file"; - case ReadFileResult::CTEST_JUNIT_UNSUPPORTED: - return "File version must be 6 or higher for CTest JUnit output support"; - } - - return "Unknown error"; + return true; } void cmCMakePresetsGraph::ClearPresets() |