presets: Add trace options to configure presets

Add JSON schema version 7 to support them.

Fixes: #22543
This commit is contained in:
Artin Alavi
2023-02-06 23:30:21 -08:00
committed by Brad King
parent 4901fdb201
commit 8e579b0228
28 changed files with 455 additions and 46 deletions
+49
View File
@@ -63,6 +63,9 @@ The root object recognizes the following fields:
``6``
.. versionadded:: 3.25
``7``
.. versionadded:: 3.27
``cmakeMinimumRequired``
An optional object representing the minimum version of CMake needed to
build this project. This object consists of the following fields:
@@ -359,6 +362,52 @@ that may contain the following fields:
An optional boolean. Setting this to ``true`` is equivalent to passing
:option:`--debug-find <cmake --debug-find>` on the command line.
``trace``
An optional object specifying trace options. This is allowed in preset
files specifying version ``7``. The object may contain the following fields:
``mode``
An optional string that specifies the trace mode. Valid values are:
``on``
Causes a trace of all calls made and from where to be printed.
Equivalent to passing :option:`--trace <cmake --trace>` on the command
line.
``off``
A trace of all calls will not be printed.
``expand``
Causes a trace with variables expanded of all calls made and from where
to be printed. Equivalent to passing :option:`--trace-expand <cmake --trace-expand>`
on the command line.
``format``
An optional string that specifies the format output of the trace.
Valid values are:
``human``
Prints each trace line in a human-readable format.
This is the default format. Equivalent to passing
:option:`--trace-format=human <cmake --trace-format>`
on the command line.
``json-v1``
Prints each line as a separate JSON document. Equivalent to passing
:option:`--trace-format=json-v1 <cmake --trace-format>`
on the command line.
``source``
An optional array of strings representing the paths of source files to
be traced. This field can also be a string, which is equivalent to an
array containing one string. Equivalent to passing
:option:`--trace-source <cmake --trace-source>` on the command line.
``redirect``
An optional string specifying a path to a trace output file. Equivalent
to passing :option:`--trace-redirect <cmake --trace-redirect>`
on the command line.
Build Preset
^^^^^^^^^^^^
+107
View File
@@ -89,6 +89,23 @@
"include": { "$ref": "#/definitions/include"}
},
"additionalProperties": false
},
{
"properties": {
"version": {
"const": 7,
"description": "A required integer representing the version of the JSON schema."
},
"cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired"},
"vendor": { "$ref": "#/definitions/vendor" },
"configurePresets": { "$ref": "#/definitions/configurePresetsV7"},
"buildPresets": { "$ref": "#/definitions/buildPresetsV4"},
"testPresets": { "$ref": "#/definitions/testPresetsV6"},
"packagePresets": { "$ref": "#/definitions/packagePresetsV6"},
"workflowPresets": { "$ref": "#/definitions/workflowPresetsV6" },
"include": { "$ref": "#/definitions/include"}
},
"additionalProperties": false
}
],
"required": [
@@ -119,6 +136,59 @@
"description": "An optional map containing vendor-specific information. CMake does not interpret the contents of this field except to verify that it is a map if it does exist. However, the keys should be a vendor-specific domain name followed by a /-separated path. For example, the Example IDE 1.0 could use example.com/ExampleIDE/1.0. The value of each field can be anything desired by the vendor, though will typically be a map.",
"properties": {}
},
"configurePresetsItemsV7": {
"type": "array",
"description": "A configure preset object.",
"items": {
"type": "object",
"description": "A configure preset object.",
"properties": {
"trace": {
"type": "object",
"description": "An optional object specifying trace options.",
"properties": {
"mode": {
"type": "string",
"description": "An optional string that specifies the trace mode.",
"enum": [
"on", "off", "expand"
]
},
"format": {
"type": "string",
"description": "An optional string that specifies the trace output format.",
"enum": [
"human", "json-v1"
]
},
"source": {
"anyOf": [
{
"type": "string",
"description": "An optional string representing the path to one source file to be traced.",
"minLength": 1
},
{
"type": "array",
"description": "An optional array of strings representing the paths to source files to be traced.",
"items": {
"type": "string",
"description": "A string representing the path to one source file to be traced.",
"minLength": 1
}
}
]
},
"redirect": {
"type": "string",
"description": "An optional string specifying a path to a trace output file."
}
},
"additionalProperties": false
}
}
}
},
"configurePresetsItemsV3": {
"type": "array",
"description": "A configure preset object.",
@@ -393,6 +463,43 @@
}
}
},
"configurePresetsV7": {
"type": "array",
"description": "An optional array of configure preset objects.",
"allOf": [
{ "$ref": "#/definitions/configurePresetsItemsV1" },
{ "$ref": "#/definitions/configurePresetsItemsV3" },
{ "$ref": "#/definitions/configurePresetsItemsV7" }
],
"items": {
"properties": {
"name": {},
"hidden": {},
"inherits": {},
"vendor": {},
"displayName": {},
"description": {},
"generator": {},
"architecture": {},
"toolset": {},
"toolchainFile": {},
"binaryDir": {},
"installDir": {},
"cmakeExecutable": {},
"cacheVariables": {},
"environment": {},
"warnings": {},
"errors": {},
"debug": {},
"condition": {},
"trace": {}
},
"required": [
"name"
],
"additionalProperties": false
}
},
"configurePresetsV3": {
"type": "array",
"description": "An optional array of configure preset objects.",