From 7a8ca8f8428abf823e818753460d9f8931dc5da8 Mon Sep 17 00:00:00 2001 From: Frank Winklmeier Date: Tue, 12 Apr 2022 13:41:07 +0200 Subject: cmCMakePresetsGraph: do not set default value for TestOutputTruncation The `TestOutputTruncation` is an optional preset. Do not set a default value to avoid failing the JSON schema version check. Closes issue #23411. --- Source/cmCMakePresetsGraphReadJSON.cxx | 2 +- Source/cmCMakePresetsGraphReadJSONTestPresets.cxx | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx index e68f0fa..0d3a91f 100644 --- a/Source/cmCMakePresetsGraphReadJSON.cxx +++ b/Source/cmCMakePresetsGraphReadJSON.cxx @@ -569,7 +569,7 @@ cmCMakePresetsGraph::ReadFileResult cmCMakePresetsGraph::ReadJSONFile( } // Support for TestOutputTruncation added in version 5. - if (v < 5 && preset.Output) { + if (v < 5 && preset.Output && preset.Output->TestOutputTruncation) { return ReadFileResult::TEST_OUTPUT_TRUNCATION_UNSUPPORTED; } diff --git a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx index 43eccfe..b874575 100644 --- a/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx +++ b/Source/cmCMakePresetsGraphReadJSONTestPresets.cxx @@ -58,10 +58,10 @@ auto const TestPresetOptionalOutputVerbosityHelper = TestPresetOutputVerbosityHelper); ReadFileResult TestPresetOutputTruncationHelper( - cmCTestTypes::TruncationMode& out, const Json::Value* value) + cm::optional& out, const Json::Value* value) { if (!value) { - out = cmCTestTypes::TruncationMode::Tail; + out = cm::nullopt; return ReadFileResult::READ_OK; } @@ -87,10 +87,6 @@ ReadFileResult TestPresetOutputTruncationHelper( return ReadFileResult::INVALID_PRESET; } -auto const TestPresetOptionalTruncationHelper = - cmJSONOptionalHelper( - ReadFileResult::READ_OK, TestPresetOutputTruncationHelper); - auto const TestPresetOptionalOutputHelper = cmJSONOptionalHelper( ReadFileResult::READ_OK, @@ -121,7 +117,7 @@ auto const TestPresetOptionalOutputHelper = cmCMakePresetsGraphInternal::PresetOptionalIntHelper, false) .Bind("testOutputTruncation"_s, &TestPreset::OutputOptions::TestOutputTruncation, - TestPresetOptionalTruncationHelper, false) + TestPresetOutputTruncationHelper, false) .Bind("maxTestNameWidth"_s, &TestPreset::OutputOptions::MaxTestNameWidth, cmCMakePresetsGraphInternal::PresetOptionalIntHelper, false)); -- cgit v0.12