diff options
-rw-r--r-- | docs/markdown/IDE-integration.md | 1 | ||||
-rw-r--r-- | docs/markdown/snippets/introspect_multiple.md | 1 | ||||
-rw-r--r-- | mesonbuild/mintro.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 12 |
4 files changed, 11 insertions, 5 deletions
diff --git a/docs/markdown/IDE-integration.md b/docs/markdown/IDE-integration.md index 25d262a..32e5e32 100644 --- a/docs/markdown/IDE-integration.md +++ b/docs/markdown/IDE-integration.md @@ -53,6 +53,7 @@ for one target is defined as follows: "name": "Name of the target", "id": "The internal ID meson uses", "type": "<TYPE>", + "defined_in": "/Path/to/the/targets/meson.build", "filename": ["list", "of", "generated", "files"], "build_by_default": true / false, "target_sources": [], diff --git a/docs/markdown/snippets/introspect_multiple.md b/docs/markdown/snippets/introspect_multiple.md index 67f517a..15f0e29 100644 --- a/docs/markdown/snippets/introspect_multiple.md +++ b/docs/markdown/snippets/introspect_multiple.md @@ -19,4 +19,5 @@ configuration of the build directory. 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 - Added new target types (`jar`, `shared module`). diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 45689bd..2039553 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -121,6 +121,7 @@ def list_installed(installdata): def list_targets(builddata: build.Build, installdata, backend: backends.Backend): tlist = [] build_dir = builddata.environment.get_build_dir() + src_dir = builddata.environment.get_source_dir() # Fast lookup table for installation files install_lookuptable = {} @@ -136,6 +137,7 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend) 'name': target.get_basename(), 'id': idname, 'type': target.get_typename(), + '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) diff --git a/run_unittests.py b/run_unittests.py index 5f3181d..11060ce 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -3172,6 +3172,7 @@ recommended as it is not supported on some platforms''') ('name', str), ('id', str), ('type', str), + ('defined_in', str), ('filename', list), ('build_by_default', bool), ('target_sources', list), @@ -3240,11 +3241,11 @@ recommended as it is not supported on some platforms''') # Check targets targets_to_find = { - 'sharedTestLib': ('shared library', True, False), - 'staticTestLib': ('static library', True, False), - 'test1': ('executable', True, True), - 'test2': ('executable', True, False), - 'test3': ('executable', True, False), + 'sharedTestLib': ('shared library', True, False, 'sharedlib/meson.build'), + 'staticTestLib': ('static library', True, False, 'staticlib/meson.build'), + 'test1': ('executable', True, True, 'meson.build'), + 'test2': ('executable', True, False, 'meson.build'), + 'test3': ('executable', True, False, 'meson.build'), } for i in res['targets']: assertKeyTypes(targets_typelist, i) @@ -3253,6 +3254,7 @@ recommended as it is not supported on some platforms''') self.assertEqual(i['type'], tgt[0]) self.assertEqual(i['build_by_default'], tgt[1]) self.assertEqual(i['installed'], tgt[2]) + self.assertPathEqual(i['defined_in'], os.path.join(testdir, tgt[3])) targets_to_find.pop(i['name'], None) for j in i['target_sources']: assertKeyTypes(targets_sources_typelist, j) |