Handle files() in Vala arguments and set up deps correctly.

pull/197/head
Jussi Pakkanen 10 years ago
parent 5cbcb144fa
commit cd40187d4e
  1. 5
      build.py
  2. 11
      mesonlib.py
  3. 14
      ninjabackend.py

@ -17,7 +17,7 @@ import environment
import dependencies
import mlog
import copy, os
from mesonlib import File
from mesonlib import File, flatten
known_basic_kwargs = {'install' : True,
'c_pch' : True,
@ -476,8 +476,9 @@ class BuildTarget():
self.include_dirs += ids
def add_compiler_args(self, language, args):
args = flatten(args)
for a in args:
if not isinstance(a, str):
if not isinstance(a, (str, File)):
raise InvalidArguments('A non-string passed to compiler args.')
if language in self.extra_args:
self.extra_args[language] += args

@ -58,6 +58,17 @@ class File:
def __hash__(self):
return hash((self.fname, self.subdir, self.is_built))
def flatten(item):
if not isinstance(item, list):
return item
result = []
for i in item:
if isinstance(i, list):
result += flatten(i)
else:
result.append(i)
return result
def is_osx():
return platform.system().lower() == 'darwin'

@ -689,6 +689,7 @@ class NinjaBackend(backends.Backend):
generated_c = []
(src, vapi_src) = self.split_vala_sources(target.get_sources())
vapi_src = [x.rel_to_builddir(self.build_to_src) for x in vapi_src]
extra_dep_files = []
for s in src:
if not s.endswith('.vala'):
continue
@ -714,11 +715,22 @@ class NinjaBackend(backends.Backend):
args += ['--target-glib', d.version_requirement[2:]]
args += ['--pkg', d.name]
args += vapi_src
args += target.extra_args.get('vala', [])
extra_args = []
for a in target.extra_args.get('vala', []):
if isinstance(a, File):
relname = a.rel_to_builddir(self.build_to_src)
extra_dep_files.append(relname)
extra_args.append(relname)
else:
extra_args.append(a)
print(extra_args)
args += extra_args
generated_c += [relsc]
element = NinjaBuildElement(relsc, valac.get_language() + '_COMPILER', rel_s)
element.add_item('ARGS', args)
element.add_orderdep(vapi_order_deps)
element.add_dep(extra_dep_files)
element.write(outfile)
return generated_c

Loading…
Cancel
Save