From 8e2aecbe429ad2b067c73564001bab994c0a8e95 Mon Sep 17 00:00:00 2001 From: Martin Duffy Date: Wed, 3 Jun 2026 11:01:48 -0400 Subject: [PATCH] instrumentation: Increase data version to 1.1 --- Help/command/cmake_instrumentation.rst | 2 +- Help/manual/cmake-instrumentation.7.rst | 17 +++++++++-------- .../manual/instrumentation/index-v1-schema.json | 5 ++++- .../manual/instrumentation/query-v1-schema.json | 5 ++++- Source/cmInstrumentationCommand.cxx | 2 +- Source/cmInstrumentationQuery.cxx | 4 ++-- .../Instrumentation/check-custom-content.cmake | 2 +- ...-command-unsupported-data-version-stderr.txt | 4 ++-- Tests/RunCMake/Instrumentation/hook.cmake | 4 ++-- .../query/bad-version-minor.json.in | 2 +- .../Instrumentation/query/bad-version.json.in | 2 +- .../query/cmake-command-capture-output.cmake | 2 +- ...cmake-command-unsupported-data-version.cmake | 2 +- .../query/hooks-invalid-version-ignored.json.in | 2 +- .../Instrumentation/verify-snippet.cmake | 4 ++-- 15 files changed, 33 insertions(+), 26 deletions(-) diff --git a/Help/command/cmake_instrumentation.rst b/Help/command/cmake_instrumentation.rst index 9f555035ae..3de4cb09f0 100644 --- a/Help/command/cmake_instrumentation.rst +++ b/Help/command/cmake_instrumentation.rst @@ -25,7 +25,7 @@ The ``API_VERSION`` and ``DATA_VERSION`` must always be given. See :ref:`cmake-instrumentation API v1` for details. ``DATA_VERSION`` is a version value of the form ``major`` or ``major.minor``. -Currently, the only supported version is ``1.0``. See +Currently, the maximum supported version is ``1.1``. See :ref:`cmake-instrumentation Data Version` for details. Each of the optional keywords ``HOOKS``, ``OPTIONS``, and ``CALLBACK`` diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst index 403a5c9fb8..ae8bba798e 100644 --- a/Help/manual/cmake-instrumentation.7.rst +++ b/Help/manual/cmake-instrumentation.7.rst @@ -17,8 +17,7 @@ information and system diagnostic information during the configure, generate, build, test and install steps for a CMake project. All interactions with the CMake instrumentation API must specify both an API -version and a Data version. At this time, there is only one version for each of -these: see the `API v1`_ and `Data Version`_. +version and a `Data Version`_. There is only one API version, see the `API v1`_. .. note:: @@ -229,11 +228,11 @@ request a specific Data Version, and `v1 Data Files`_ of the corresponding version will be generated and sent to the user `Callbacks`_ defined in that query. -Currently, the only supported version is ``1.0``. A new major version number -will be created whenever previously included data is removed or reformatted such -that scripts written to parse this data may become incompatible with the new -format. A new minor version number will be created whenever new data becomes -available. +Currently, the only supported major version is ``1``, and the maximum supported +minor version is also ``1``. A new major version number will be created whenever +previously included data is removed or reformatted such that scripts written to +parse this data may become incompatible with the new format. A new minor version +number will be created whenever new data becomes available. .. _`cmake-instrumentation v1 Query Files`: @@ -307,6 +306,8 @@ key is required, but all other fields are optional. When enabled, snippets for ``compile``, ``link``, ``custom``, ``test``, and ``install`` commands include ``stdout`` and ``stderr`` fields. + Only available as of data version ``1.1``. + ``cdashSubmit`` Enables including instrumentation data in CDash. This is equivalent to having the :envvar:`CTEST_USE_INSTRUMENTATION` environment @@ -546,7 +547,7 @@ Example: { "version": { "major": 1, - "minor": 0 + "minor": 1 }, "command" : "\"/usr/bin/c++\" \"-MD\" \"-MT\" \"CMakeFiles/main.dir/main.cxx.o\" \"-MF\" \"CMakeFiles/main.dir/main.cxx.o.d\" \"-o\" \"CMakeFiles/main.dir/main.cxx.o\" \"-c\" \"/main.cxx\"", "role" : "compile", diff --git a/Help/manual/instrumentation/index-v1-schema.json b/Help/manual/instrumentation/index-v1-schema.json index 5f8ec57d08..540cb5bf3a 100644 --- a/Help/manual/instrumentation/index-v1-schema.json +++ b/Help/manual/instrumentation/index-v1-schema.json @@ -47,7 +47,10 @@ }, "minor": { "type": "integer", - "const": 0 + "enum": [ + 0, + 1 + ] } }, "additionalProperties": false diff --git a/Help/manual/instrumentation/query-v1-schema.json b/Help/manual/instrumentation/query-v1-schema.json index d7b3f80390..26bca55efe 100644 --- a/Help/manual/instrumentation/query-v1-schema.json +++ b/Help/manual/instrumentation/query-v1-schema.json @@ -22,7 +22,10 @@ }, "minor": { "type": "integer", - "const": 0 + "enum": [ + 0, + 1 + ] } }, "additionalProperties": false diff --git a/Source/cmInstrumentationCommand.cxx b/Source/cmInstrumentationCommand.cxx index 5b0bb2d16b..636478e220 100644 --- a/Source/cmInstrumentationCommand.cxx +++ b/Source/cmInstrumentationCommand.cxx @@ -81,7 +81,7 @@ bool validateDataVersion(std::string const& versionString, Version& version, if (!cmInstrumentationQuery::ValidDataVersion(version)) { status.SetError( cmStrCat("given an unsupported DATA_VERSION \"", versionString, - "\" (the only currently supported version is 1.0).")); + "\" (the maximum currently supported version is 1.1).")); return false; } diff --git a/Source/cmInstrumentationQuery.cxx b/Source/cmInstrumentationQuery.cxx index a792490736..7a6c74fe1d 100644 --- a/Source/cmInstrumentationQuery.cxx +++ b/Source/cmInstrumentationQuery.cxx @@ -165,13 +165,13 @@ bool cmInstrumentationQuery::ReadJSON(std::string const& filename, bool cmInstrumentationQuery::ValidDataVersion(Version version) { auto const latest = LatestDataVersion(); - return version.Major == latest.Major && version.Minor == latest.Minor; + return version.Major == latest.Major && version.Minor <= latest.Minor; } Version cmInstrumentationQuery::LatestDataVersion() { Version latest; latest.Major = 1; - latest.Minor = 0; + latest.Minor = 1; return latest; } diff --git a/Tests/RunCMake/Instrumentation/check-custom-content.cmake b/Tests/RunCMake/Instrumentation/check-custom-content.cmake index ac358ef3c2..fd6a68ee19 100644 --- a/Tests/RunCMake/Instrumentation/check-custom-content.cmake +++ b/Tests/RunCMake/Instrumentation/check-custom-content.cmake @@ -18,7 +18,7 @@ foreach(content_file IN LISTS content_files) # Check version string(JSON version GET "${contents}" version) json_assert_key("${content_file}" "${version}" major "1") - json_assert_key("${content_file}" "${version}" minor "0") + json_assert_key("${content_file}" "${version}" minor "1") # Check project name json_assert_key("${content_file}" "${contents}" project "instrumentation") diff --git a/Tests/RunCMake/Instrumentation/cmake-command-unsupported-data-version-stderr.txt b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-data-version-stderr.txt index d8c3ec7bcc..5864c2ba75 100644 --- a/Tests/RunCMake/Instrumentation/cmake-command-unsupported-data-version-stderr.txt +++ b/Tests/RunCMake/Instrumentation/cmake-command-unsupported-data-version-stderr.txt @@ -1,6 +1,6 @@ CMake Error at [^ ]*\(cmake_instrumentation\): - cmake_instrumentation given an unsupported DATA_VERSION "1\.1" \(the only - currently supported version is 1\.0\)\. + cmake_instrumentation given an unsupported DATA_VERSION "2\.1" \(the maximum + currently supported version is 1\.1\)\. Call Stack \(most recent call first\): CMakeLists\.txt:5 \(include\) diff --git a/Tests/RunCMake/Instrumentation/hook.cmake b/Tests/RunCMake/Instrumentation/hook.cmake index 21fe59a194..e1d29088e6 100644 --- a/Tests/RunCMake/Instrumentation/hook.cmake +++ b/Tests/RunCMake/Instrumentation/hook.cmake @@ -68,8 +68,8 @@ json_has_key("${index}" "${contents}" version) string(JSON version_major GET "${contents}" version major) string(JSON version_minor GET "${contents}" version minor) -if (NOT version_major EQUAL 1 OR NOT version_minor EQUAL 0) - add_error("Version must be 1.0, got: ${version_major}.${version_minor}") +if (NOT version_major EQUAL 1 OR NOT version_minor LESS_EQUAL 1) + add_error("Version must be <= 1.1, got: ${version_major}.${version_minor}") endif() json_has_key("${index}" "${contents}" buildDir) diff --git a/Tests/RunCMake/Instrumentation/query/bad-version-minor.json.in b/Tests/RunCMake/Instrumentation/query/bad-version-minor.json.in index de6bc6b3f8..afe9a55591 100644 --- a/Tests/RunCMake/Instrumentation/query/bad-version-minor.json.in +++ b/Tests/RunCMake/Instrumentation/query/bad-version-minor.json.in @@ -1,6 +1,6 @@ { "version": { "major": 1, - "minor": 1 + "minor": 9 } } diff --git a/Tests/RunCMake/Instrumentation/query/bad-version.json.in b/Tests/RunCMake/Instrumentation/query/bad-version.json.in index de6bc6b3f8..afe9a55591 100644 --- a/Tests/RunCMake/Instrumentation/query/bad-version.json.in +++ b/Tests/RunCMake/Instrumentation/query/bad-version.json.in @@ -1,6 +1,6 @@ { "version": { "major": 1, - "minor": 1 + "minor": 9 } } diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-capture-output.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-capture-output.cmake index 945d502099..17c4362548 100644 --- a/Tests/RunCMake/Instrumentation/query/cmake-command-capture-output.cmake +++ b/Tests/RunCMake/Instrumentation/query/cmake-command-capture-output.cmake @@ -1,5 +1,5 @@ cmake_instrumentation( API_VERSION 1 - DATA_VERSION 1 + DATA_VERSION 1.1 OPTIONS captureOutput ) diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-unsupported-data-version.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-unsupported-data-version.cmake index 94aa71fc2d..952b92eda9 100644 --- a/Tests/RunCMake/Instrumentation/query/cmake-command-unsupported-data-version.cmake +++ b/Tests/RunCMake/Instrumentation/query/cmake-command-unsupported-data-version.cmake @@ -1,4 +1,4 @@ cmake_instrumentation( API_VERSION 1 - DATA_VERSION 1.1 + DATA_VERSION 2.1 ) diff --git a/Tests/RunCMake/Instrumentation/query/hooks-invalid-version-ignored.json.in b/Tests/RunCMake/Instrumentation/query/hooks-invalid-version-ignored.json.in index c99213d16d..0aeed54993 100644 --- a/Tests/RunCMake/Instrumentation/query/hooks-invalid-version-ignored.json.in +++ b/Tests/RunCMake/Instrumentation/query/hooks-invalid-version-ignored.json.in @@ -1,7 +1,7 @@ { "version": { "major": 1, - "minor": 1 + "minor": 9 }, "hooks": ["postCMakeBuild"], "callbacks": ["@GET_HOOK@"] diff --git a/Tests/RunCMake/Instrumentation/verify-snippet.cmake b/Tests/RunCMake/Instrumentation/verify-snippet.cmake index d5c87bc962..cf9acd07ce 100644 --- a/Tests/RunCMake/Instrumentation/verify-snippet.cmake +++ b/Tests/RunCMake/Instrumentation/verify-snippet.cmake @@ -77,8 +77,8 @@ function(verify_snippet_data snippet contents) snippet_valid_timing("${contents}") string(JSON version_major GET "${contents}" version major) string(JSON version_minor GET "${contents}" version minor) - if (NOT version_major EQUAL 1 OR NOT version_minor EQUAL 0) - json_error("${snippet}" "Version must be 1.0, got: ${version_major}.${version_minor}") + if (NOT version_major EQUAL 1 OR NOT version_minor LESS_EQUAL 1) + json_error("${snippet}" "Version must be <= 1.1, got: ${version_major}.${version_minor}") endif() get_filename_component(filename "${snippet}" NAME) string(JSON result GET "${contents}" result)