file-api: support exporting file set information

This includes listing the filesets themselves as well as which file set
(if any) each source file is associated with.

Fixes: #24128
This commit is contained in:
Ben Boeckel
2022-11-03 16:32:39 -04:00
parent 3aa6d79a50
commit b3e9fb67bb
58 changed files with 342 additions and 11 deletions
+29 -1
View File
@@ -425,7 +425,7 @@ Version 1 does not exist to avoid confusion with that from
{
"kind": "codemodel",
"version": { "major": 2, "minor": 4 },
"version": { "major": 2, "minor": 5 },
"paths": {
"source": "/path/to/top-level-source-dir",
"build": "/path/to/top-level-build-dir"
@@ -1071,6 +1071,27 @@ with members:
available. The value is an unsigned integer 0-based index into
the ``backtraceGraph`` member's ``nodes`` array.
``fileSets``
A JSON array of entries corresponding to the target's file sets. Each entry
is a JSON object with members:
``name``
A string specifying the name of the file set.
``type``
A string specifying the type of the file set. See
:command:`target_sources` supported file set types.
``visibility``
A string specifying the visibility of the file set; one of ``PUBLIC``,
``PRIVATE``, or ``INTERFACE``.
``baseDirectories``
A JSON array of strings specifying the base directories containing sources
in the file set.
This field was added in codemodel version 2.5.
``sources``
A JSON array of entries corresponding to the target's source files.
Each entry is a JSON object with members:
@@ -1096,6 +1117,13 @@ with members:
Optional member that is present with boolean value ``true`` if
the source is :prop_sf:`GENERATED`.
``fileSetIndex``
Optional member that is present when the source is part of a file set.
The value is an unsigned integer 0-based index into the ``fileSets``
array.
This field was added in codemodel version 2.5.
``backtrace``
Optional member that is present when a CMake language backtrace to
the :command:`target_sources`, :command:`add_executable`,
+9
View File
@@ -0,0 +1,9 @@
file-api-file-sets
------------------
* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
been updated to 2.5.
* The :manual:`cmake-file-api(7)` "codemodel" version 2 "target" object
gained a new ``fileSets`` field and associated ``fileSetIndex``
field to ``sources`` objects.