Commit bf0fd71a authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'preset-no-comments'

06e16ea0 Merge branch 'backport-3.19-preset-no-comments' into preset-no-comments
afaa69f5 Tests: Remove comments from CMakePresetsTest/Good.json.in
4a92277f Revert "Help: Document JSON comment support in cmake-presets(7)"
431dd59b

 CMakePresets.json: Remove undocumented support for comments
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !5853
parents 4b27a80c 06e16ea0
...@@ -29,10 +29,7 @@ is using Git, ``CMakePresets.json`` may be tracked, and ...@@ -29,10 +29,7 @@ is using Git, ``CMakePresets.json`` may be tracked, and
Format Format
====== ======
The files are JSON documents. C-style comments are allowed using The files are a JSON document with an object as the root:
line-wise ``//`` syntax or block ``/*...*/`` syntax.
Each document has an object as the root:
.. literalinclude:: presets/example.json .. literalinclude:: presets/example.json
:language: json :language: json
......
...@@ -409,7 +409,6 @@ Changes made since CMake 3.19.0 include the following. ...@@ -409,7 +409,6 @@ Changes made since CMake 3.19.0 include the following.
:generator:`Visual Studio 14 2015` generator. It has now been fixed to :generator:`Visual Studio 14 2015` generator. It has now been fixed to
work with :ref:`Visual Studio Generators` for later VS versions too. work with :ref:`Visual Studio Generators` for later VS versions too.
3.19.5 3.19.5
------ ------
...@@ -425,3 +424,11 @@ Changes made since CMake 3.19.0 include the following. ...@@ -425,3 +424,11 @@ Changes made since CMake 3.19.0 include the following.
*Link Binaries With Libraries* build phase broke the ability to switch *Link Binaries With Libraries* build phase broke the ability to switch
between device and simulator builds without reconfiguring. That capability between device and simulator builds without reconfiguring. That capability
has now been restored. has now been restored.
3.19.6
------
* The :manual:`cmake-presets(7)` feature no longer allows comments in
``CMakePresets.json`` or ``CMakeUserPresets.json`` files.
This was mistakenly allowed by the implementation in CMake 3.19.0 through
CMake 3.19.5, and was not documented.
...@@ -1519,6 +1519,7 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile( ...@@ -1519,6 +1519,7 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile(
Json::Value root; Json::Value root;
Json::CharReaderBuilder builder; Json::CharReaderBuilder builder;
Json::CharReaderBuilder::strictMode(&builder.settings_);
if (!Json::parseFromStream(builder, fin, &root, nullptr)) { if (!Json::parseFromStream(builder, fin, &root, nullptr)) {
return ReadFileResult::JSON_PARSE_ERROR; return ReadFileResult::JSON_PARSE_ERROR;
} }
......
/*
* Block comment
*/
{ {
// Inline comment
"version": 1, "version": 1,
"cmakeMinimumRequired": { "cmakeMinimumRequired": {
"major": 3, "major": 3,
......
^CMake Error: Could not read presets from [^
]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$
// Comment
{
"version": 1,
"configurePresets": [
{
"name": "Comment",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build"
}
]
}
...@@ -63,6 +63,7 @@ endfunction() ...@@ -63,6 +63,7 @@ endfunction()
# Test CMakePresets.json errors # Test CMakePresets.json errors
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_presets(NoCMakePresets) run_cmake_presets(NoCMakePresets)
run_cmake_presets(Comment)
run_cmake_presets(JSONParseError) run_cmake_presets(JSONParseError)
run_cmake_presets(InvalidRoot) run_cmake_presets(InvalidRoot)
run_cmake_presets(NoVersion) run_cmake_presets(NoVersion)
......
import jsmin
import json import json
import jsonschema import jsonschema
import os.path import os.path
...@@ -6,7 +5,7 @@ import sys ...@@ -6,7 +5,7 @@ import sys
with open(sys.argv[1], "rb") as f: with open(sys.argv[1], "rb") as f:
contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig"))) contents = json.loads(f.read().decode("utf-8-sig"))
schema_file = os.path.join( schema_file = os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
......
...@@ -49,8 +49,6 @@ ...@@ -49,8 +49,6 @@
"outputLogFile": "", "outputLogFile": "",
"labelSummary": true, "labelSummary": true,
"subprojectSummary": true "subprojectSummary": true
// "maxPassedTestOutputSize": 0
// "maxTestNameWidth": 0
}, },
"filter": { "filter": {
"include": { "include": {
...@@ -58,11 +56,6 @@ ...@@ -58,11 +56,6 @@
"label": "", "label": "",
"useUnion": false, "useUnion": false,
"index": "" "index": ""
// "index": {
// "start": 0,
// "end": 0,
// "stride": 0
// }
}, },
"exclude": { "exclude": {
"name": "", "name": "",
...@@ -79,7 +72,6 @@ ...@@ -79,7 +72,6 @@
"enableFailover": false, "enableFailover": false,
"jobs": 0, "jobs": 0,
"resourceSpecFile": "", "resourceSpecFile": "",
// "testLoad": 0,
"showOnly": "human", "showOnly": "human",
"repeat": { "repeat": {
"mode": "until-pass", "mode": "until-pass",
...@@ -87,7 +79,6 @@ ...@@ -87,7 +79,6 @@
}, },
"interactiveDebugging": false, "interactiveDebugging": false,
"scheduleRandom": false, "scheduleRandom": false,
// "timeout": 0,
"noTestsAction": "default" "noTestsAction": "default"
} }
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment