mintro: Add name of subproject the target is contained in to --target output

pull/4998/head
Daniel Schulte 6 years ago committed by Jussi Pakkanen
parent ded0defc3f
commit 924cf5e622
  1. 4
      docs/markdown/IDE-integration.md
  2. 1
      docs/markdown/snippets/introspect_multiple.md
  3. 3
      mesonbuild/mintro.py
  4. 15
      run_unittests.py

@ -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.

@ -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`).

@ -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():

@ -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:

Loading…
Cancel
Save