instrumentation: Increase data version to 1.1

This commit is contained in:
Martin Duffy
2026-06-03 11:01:48 -04:00
parent 1a85245496
commit 8e2aecbe42
15 changed files with 33 additions and 26 deletions

View File

@@ -25,7 +25,7 @@ The ``API_VERSION`` and ``DATA_VERSION`` must always be given.
See :ref:`cmake-instrumentation API v1` for details. See :ref:`cmake-instrumentation API v1` for details.
``DATA_VERSION`` is a version value of the form ``major`` or ``major.minor``. ``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. :ref:`cmake-instrumentation Data Version` for details.
Each of the optional keywords ``HOOKS``, ``OPTIONS``, and ``CALLBACK`` Each of the optional keywords ``HOOKS``, ``OPTIONS``, and ``CALLBACK``

View File

@@ -17,8 +17,7 @@ information and system diagnostic information during the configure, generate,
build, test and install steps for a CMake project. build, test and install steps for a CMake project.
All interactions with the CMake instrumentation API must specify both an API 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 version and a `Data Version`_. There is only one API version, see the `API v1`_.
these: see the `API v1`_ and `Data Version`_.
.. note:: .. 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 version will be generated and sent to the user `Callbacks`_ defined in that
query. query.
Currently, the only supported version is ``1.0``. A new major version number Currently, the only supported major version is ``1``, and the maximum supported
will be created whenever previously included data is removed or reformatted such minor version is also ``1``. A new major version number will be created whenever
that scripts written to parse this data may become incompatible with the new previously included data is removed or reformatted such that scripts written to
format. A new minor version number will be created whenever new data becomes parse this data may become incompatible with the new format. A new minor version
available. number will be created whenever new data becomes available.
.. _`cmake-instrumentation v1 Query Files`: .. _`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 When enabled, snippets for ``compile``, ``link``, ``custom``, ``test``, and
``install`` commands include ``stdout`` and ``stderr`` fields. ``install`` commands include ``stdout`` and ``stderr`` fields.
Only available as of data version ``1.1``.
``cdashSubmit`` ``cdashSubmit``
Enables including instrumentation data in CDash. This is Enables including instrumentation data in CDash. This is
equivalent to having the :envvar:`CTEST_USE_INSTRUMENTATION` environment equivalent to having the :envvar:`CTEST_USE_INSTRUMENTATION` environment
@@ -546,7 +547,7 @@ Example:
{ {
"version": { "version": {
"major": 1, "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\" \"<src>/main.cxx\"", "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\" \"<src>/main.cxx\"",
"role" : "compile", "role" : "compile",

View File

@@ -47,7 +47,10 @@
}, },
"minor": { "minor": {
"type": "integer", "type": "integer",
"const": 0 "enum": [
0,
1
]
} }
}, },
"additionalProperties": false "additionalProperties": false

View File

@@ -22,7 +22,10 @@
}, },
"minor": { "minor": {
"type": "integer", "type": "integer",
"const": 0 "enum": [
0,
1
]
} }
}, },
"additionalProperties": false "additionalProperties": false

View File

@@ -81,7 +81,7 @@ bool validateDataVersion(std::string const& versionString, Version& version,
if (!cmInstrumentationQuery::ValidDataVersion(version)) { if (!cmInstrumentationQuery::ValidDataVersion(version)) {
status.SetError( status.SetError(
cmStrCat("given an unsupported DATA_VERSION \"", versionString, 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; return false;
} }

View File

@@ -165,13 +165,13 @@ bool cmInstrumentationQuery::ReadJSON(std::string const& filename,
bool cmInstrumentationQuery::ValidDataVersion(Version version) bool cmInstrumentationQuery::ValidDataVersion(Version version)
{ {
auto const latest = LatestDataVersion(); 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 cmInstrumentationQuery::LatestDataVersion()
{ {
Version latest; Version latest;
latest.Major = 1; latest.Major = 1;
latest.Minor = 0; latest.Minor = 1;
return latest; return latest;
} }

View File

@@ -18,7 +18,7 @@ foreach(content_file IN LISTS content_files)
# Check version # Check version
string(JSON version GET "${contents}" version) string(JSON version GET "${contents}" version)
json_assert_key("${content_file}" "${version}" major "1") 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 # Check project name
json_assert_key("${content_file}" "${contents}" project "instrumentation") json_assert_key("${content_file}" "${contents}" project "instrumentation")

View File

@@ -1,6 +1,6 @@
CMake Error at [^ CMake Error at [^
]*\(cmake_instrumentation\): ]*\(cmake_instrumentation\):
cmake_instrumentation given an unsupported DATA_VERSION "1\.1" \(the only cmake_instrumentation given an unsupported DATA_VERSION "2\.1" \(the maximum
currently supported version is 1\.0\)\. currently supported version is 1\.1\)\.
Call Stack \(most recent call first\): Call Stack \(most recent call first\):
CMakeLists\.txt:5 \(include\) CMakeLists\.txt:5 \(include\)

View File

@@ -68,8 +68,8 @@ json_has_key("${index}" "${contents}" version)
string(JSON version_major GET "${contents}" version major) string(JSON version_major GET "${contents}" version major)
string(JSON version_minor GET "${contents}" version minor) string(JSON version_minor GET "${contents}" version minor)
if (NOT version_major EQUAL 1 OR NOT version_minor EQUAL 0) if (NOT version_major EQUAL 1 OR NOT version_minor LESS_EQUAL 1)
add_error("Version must be 1.0, got: ${version_major}.${version_minor}") add_error("Version must be <= 1.1, got: ${version_major}.${version_minor}")
endif() endif()
json_has_key("${index}" "${contents}" buildDir) json_has_key("${index}" "${contents}" buildDir)

View File

@@ -1,6 +1,6 @@
{ {
"version": { "version": {
"major": 1, "major": 1,
"minor": 1 "minor": 9
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"version": { "version": {
"major": 1, "major": 1,
"minor": 1 "minor": 9
} }
} }

View File

@@ -1,5 +1,5 @@
cmake_instrumentation( cmake_instrumentation(
API_VERSION 1 API_VERSION 1
DATA_VERSION 1 DATA_VERSION 1.1
OPTIONS captureOutput OPTIONS captureOutput
) )

View File

@@ -1,4 +1,4 @@
cmake_instrumentation( cmake_instrumentation(
API_VERSION 1 API_VERSION 1
DATA_VERSION 1.1 DATA_VERSION 2.1
) )

View File

@@ -1,7 +1,7 @@
{ {
"version": { "version": {
"major": 1, "major": 1,
"minor": 1 "minor": 9
}, },
"hooks": ["postCMakeBuild"], "hooks": ["postCMakeBuild"],
"callbacks": ["@GET_HOOK@"] "callbacks": ["@GET_HOOK@"]

View File

@@ -77,8 +77,8 @@ function(verify_snippet_data snippet contents)
snippet_valid_timing("${contents}") snippet_valid_timing("${contents}")
string(JSON version_major GET "${contents}" version major) string(JSON version_major GET "${contents}" version major)
string(JSON version_minor GET "${contents}" version minor) string(JSON version_minor GET "${contents}" version minor)
if (NOT version_major EQUAL 1 OR NOT version_minor EQUAL 0) if (NOT version_major EQUAL 1 OR NOT version_minor LESS_EQUAL 1)
json_error("${snippet}" "Version must be 1.0, got: ${version_major}.${version_minor}") json_error("${snippet}" "Version must be <= 1.1, got: ${version_major}.${version_minor}")
endif() endif()
get_filename_component(filename "${snippet}" NAME) get_filename_component(filename "${snippet}" NAME)
string(JSON result GET "${contents}" result) string(JSON result GET "${contents}" result)