diff options
-rw-r--r-- | docs/markdown/IDE-integration.md | 4 | ||||
-rw-r--r-- | docs/markdown/snippets/introspect_multiple.md | 1 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 3 | ||||
-rwxr-xr-x | run_unittests.py | 15 |
4 files changed, 22 insertions, 1 deletions
diff --git a/docs/markdown/IDE-integration.md b/docs/markdown/IDE-integration.md index 32e5e32..ab157d1 100644 --- a/docs/markdown/IDE-integration.md +++ b/docs/markdown/IDE-integration.md @@ -54,6 +54,7 @@ for one target is defined as follows: "id": "The internal ID meson uses", "type": "<TYPE>", "defined_in": "/Path/to/the/targets/meson.build", + "subproject": null, "filename": ["list", "of", "generated", "files"], "build_by_default": true / false, "target_sources": [], @@ -66,6 +67,9 @@ be present. It stores the installation location for each file in `filename`. If one file in `filename` is not installed, its corresponding install location is set to `null`. +The `subproject' key specifies the name of the subproject this target was +defined in, or `null` if the target was defined in the top level project. + A target usually generates only one file. However, it is possible for custom targets to have multiple outputs. diff --git a/docs/markdown/snippets/introspect_multiple.md b/docs/markdown/snippets/introspect_multiple.md index 15f0e29..7953415 100644 --- a/docs/markdown/snippets/introspect_multiple.md +++ b/docs/markdown/snippets/introspect_multiple.md @@ -20,4 +20,5 @@ Additionlly the format of `meson introspect target` was changed: - New: the `sources` key. It stores the source files of a target and their compiler parameters. - New: the `defined_in` key. It stores the meson file where a target is defined + - New: the `subproject` key. It stores the name of the subproject where a target is defined. - Added new target types (`jar`, `shared module`). diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 2d01c11..8f9ed1d 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -135,7 +135,8 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend) 'defined_in': os.path.normpath(os.path.join(src_dir, target.subdir, 'meson.build')), 'filename': [os.path.join(build_dir, target.subdir, x) for x in target.get_outputs()], 'build_by_default': target.build_by_default, - 'target_sources': backend.get_introspection_data(idname, target) + 'target_sources': backend.get_introspection_data(idname, target), + 'subproject': target.subproject or None } if installdata and target.should_install(): diff --git a/run_unittests.py b/run_unittests.py index cf6c910..dcd3ced 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3236,6 +3236,21 @@ recommended as it is not supported on some platforms''') } self.assertDictEqual(res, expected) + def test_introspection_target_subproject(self): + testdir = os.path.join(self.common_test_dir, '46 subproject') + self.init(testdir) + res = self.introspect('--targets') + + expected = { + 'sublib': 'sublib', + 'simpletest': 'sublib', + 'user': None + } + + for entry in res: + name = entry['name'] + self.assertEquals(entry['subproject'], expected[name]) + @skipIfNoExecutable('clang-format') def test_clang_format(self): if self.backend is not Backend.ninja: |