diff --git a/docs/markdown/snippets/introspect_multiple.md b/docs/markdown/snippets/introspect_multiple.md index d05eae69a..17d0a3f97 100644 --- a/docs/markdown/snippets/introspect_multiple.md +++ b/docs/markdown/snippets/introspect_multiple.md @@ -10,4 +10,9 @@ compatibility. Furthermore the option `-a,--all`, `-i,--indent` and `-f,--force-new` were added to print all introspection information in one go, format the JSON output (the default is still compact JSON) and foce use the new -output format, even if only one introspection command was given. \ No newline at end of file +output format, even if only one introspection command was given. + +Additionlly the format of target was changed: + - `filename` is now a list of output filenames + - `install_filename` is now also a list of installed files + - New: the `sources` key. It stores the source files of a target and there compiler parameters diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 4fa6bde63..642c2d5f0 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -2120,6 +2120,9 @@ class RunTarget(Target): def get_filename(self): return self.name + def get_outputs(self): + return [self.name] + def type_suffix(self): return "@run" diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 04850c63e..cf1aeffde 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -93,11 +93,7 @@ def list_targets(builddata: build.Build, installdata, backend: backends.Backend) if not isinstance(target, build.Target): raise RuntimeError('Something weird happened. File a bug.') - fname = target.get_filename() - if isinstance(fname, list): - fname = [os.path.join(target.subdir, x) for x in fname] - else: - fname = os.path.join(target.subdir, fname) + fname = [os.path.join(target.subdir, x) for x in target.get_outputs()] t = { 'name': target.get_basename(), diff --git a/run_unittests.py b/run_unittests.py index 492a22c1a..1977fe0c1 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1436,7 +1436,7 @@ class AllPlatformTests(BasePlatformTests): # Get name of static library targets = self.introspect('--targets') self.assertEqual(len(targets), 1) - libname = targets[0]['filename'] + libname = targets[0]['filename'][0] # Build and get contents of static library self.build() before = self._run(['ar', 't', os.path.join(self.builddir, libname)]).split() @@ -3168,7 +3168,7 @@ recommended as it is not supported on some platforms''') ('name', str), ('id', str), ('type', str), - ('filename', str), + ('filename', list), ('build_by_default', bool), ('sources', list), ('installed', bool), @@ -4368,7 +4368,7 @@ class LinuxlikeTests(BasePlatformTests): break self.assertIsInstance(docbook_target, dict) ifile = self.introspect(['--target-files', 'generated-gdbus-docbook@cus'])[0] - self.assertEqual(t['filename'], 'gdbus/generated-gdbus-doc-' + os.path.basename(ifile)) + self.assertListEqual(t['filename'], ['gdbus/generated-gdbus-doc-' + os.path.basename(ifile)]) def test_build_rpath(self): if is_cygwin():