aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorRachel Mant <DX-MON@users.noreply.github.com>2019-08-17 19:12:56 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-17 21:12:56 +0300
commitf431cff809ec7159c26792e96055747c724e669c (patch)
tree04d4574a7db6b9911ddb70263c455283d0e5b39f /mesonbuild/build.py
parent1cb6177f033dcdf59f354376c509f16906165a97 (diff)
downloadmeson-f431cff809ec7159c26792e96055747c724e669c.zip
meson-f431cff809ec7159c26792e96055747c724e669c.tar.gz
meson-f431cff809ec7159c26792e96055747c724e669c.tar.bz2
Make .extract_objects() work correctly as an input to custom_target
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index b77995a..eab2057 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -278,6 +278,13 @@ class ExtractedObjects:
'in Unity builds. You can only extract all '
'the object files for each compiler at once.')
+ def get_outputs(self, backend):
+ # TODO: Consider if we need to handle genlist here
+ return [
+ backend.object_filename_from_source(self.target, source)
+ for source in self.srclist
+ ]
+
class EnvironmentVariables:
def __init__(self):
self.envvars = []
@@ -1911,7 +1918,7 @@ class CustomTarget(Target):
'console',
])
- def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False):
+ def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False, backend=None):
self.typename = 'custom'
# TODO expose keyword arg to make MachineChoice.HOST configurable
super().__init__(name, subdir, subproject, False, MachineChoice.HOST)
@@ -1919,7 +1926,7 @@ class CustomTarget(Target):
self.extra_depends = []
self.depend_files = [] # Files that this target depends on but are not on the command line.
self.depfile = None
- self.process_kwargs(kwargs)
+ self.process_kwargs(kwargs, backend)
self.extra_files = []
# Whether to use absolute paths for all files on the commandline
self.absolute_paths = absolute_paths
@@ -1996,14 +2003,14 @@ class CustomTarget(Target):
raise InvalidArguments('Argument {!r} in "command" is invalid'.format(c))
return final_cmd
- def process_kwargs(self, kwargs):
+ def process_kwargs(self, kwargs, backend):
super().process_kwargs(kwargs)
self.sources = extract_as_list(kwargs, 'input', unholder=True)
if 'output' not in kwargs:
raise InvalidArguments('Missing keyword argument "output".')
self.outputs = listify(kwargs['output'])
# This will substitute values from the input into output and return it.
- inputs = get_sources_string_names(self.sources)
+ inputs = get_sources_string_names(self.sources, backend)
values = get_filenames_templates_dict(inputs, [])
for i in self.outputs:
if not(isinstance(i, str)):
@@ -2370,7 +2377,7 @@ class TestSetup:
self.timeout_multiplier = timeout_multiplier
self.env = env
-def get_sources_string_names(sources):
+def get_sources_string_names(sources, backend):
'''
For the specified list of @sources which can be strings, Files, or targets,
get all the output basenames.
@@ -2383,6 +2390,8 @@ def get_sources_string_names(sources):
names.append(s)
elif isinstance(s, (BuildTarget, CustomTarget, CustomTargetIndex, GeneratedList)):
names += s.get_outputs()
+ elif isinstance(s, ExtractedObjects):
+ names += s.get_outputs(backend)
elif isinstance(s, File):
names.append(s.fname)
else: