Store extra_files as file objects. Helps with #1686.

pull/1555/merge
Jussi Pakkanen 8 years ago
parent 8f49764896
commit 108dac5c16
  1. 2
      mesonbuild/backend/vs2010backend.py
  2. 7
      mesonbuild/build.py
  3. 5
      mesonbuild/interpreter.py

@ -980,7 +980,7 @@ class Vs2010Backend(backends.Backend):
for h in gen_hdrs:
ET.SubElement(inc_hdrs, 'CLInclude', Include=h)
for h in target.extra_files:
relpath = os.path.join(proj_to_src_dir, h)
relpath = os.path.join(down, h.rel_to_builddir(self.build_to_src))
ET.SubElement(inc_hdrs, 'CLInclude', Include=relpath)
if len(sources) + len(gen_src) + len(pch_sources) > 0:

@ -648,12 +648,11 @@ class BuildTarget(Target):
elif 'gui_app' in kwargs:
raise InvalidArguments('Argument gui_app can only be used on executables.')
extra_files = kwargs.get('extra_files', [])
if isinstance(extra_files, str):
if not isinstance(extra_files, list):
extra_files = [extra_files]
for i in extra_files:
if not isinstance(i, str):
raise InvalidArguments('Arguments to extra_files must be strings.')
trial = os.path.join(environment.get_source_dir(), self.subdir, i)
assert(isinstance(i, File))
trial = os.path.join(environment.get_source_dir(), i.subdir, i.fname)
if not(os.path.isfile(trial)):
raise InvalidArguments('Tried to add non-existing extra file %s.' % i)
self.extra_files = extra_files

@ -2554,6 +2554,11 @@ different subdirectory.
sources = self.source_strings_to_files(sources)
objs = self.flatten(kwargs.get('objects', []))
kwargs['dependencies'] = self.flatten(kwargs.get('dependencies', []))
if 'extra_files' in kwargs:
ef = kwargs['extra_files']
if not isinstance(ef, list):
ef = [ef]
kwargs['extra_files'] = self.source_strings_to_files(ef)
if not isinstance(objs, list):
objs = [objs]
self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)

Loading…
Cancel
Save