build_by_default it is.

pull/1303/head
Jussi Pakkanen 8 years ago
parent 58878b998d
commit 21d8505825
  1. 6
      mesonbuild/backend/ninjabackend.py
  2. 14
      mesonbuild/build.py
  3. 4
      run_unittests.py
  4. 0
      test cases/unit/5 build by default/foo.c
  5. 4
      test cases/unit/5 build by default/meson.build
  6. 0
      test cases/unit/5 build by default/mygen.py
  7. 0
      test cases/unit/5 build by default/source.txt

@ -2160,17 +2160,17 @@ rule FORTRAN_DEP_HACK
elem.add_item('pool', 'console')
elem.write(outfile)
def get_build_on_all_targets(self):
def get_build_by_default_targets(self):
result = []
for t in self.build.get_targets().values():
if t.build_on_all or t.install or t.build_always:
if t.build_by_default or t.install or t.build_always:
result.append(t)
return result
def generate_ending(self, outfile):
targetlist = []
ctlist = []
for t in self.get_build_on_all_targets():
for t in self.get_build_by_default_targets():
if isinstance(t, build.CustomTarget):
# Create a list of all custom target outputs
for o in t.get_outputs():

@ -44,7 +44,7 @@ known_basic_kwargs = {'install': True,
'sources': True,
'objects': True,
'native': True,
'build_on_all': True,
'build_by_default': True,
}
# These contain kwargs supported by both static and shared libraries. These are
@ -254,10 +254,10 @@ class EnvironmentVariables():
return env
class Target:
def __init__(self, name, subdir, build_on_all):
def __init__(self, name, subdir, build_by_default):
self.name = name
self.subdir = subdir
self.build_on_all = build_on_all
self.build_by_default = build_by_default
self.install = False
self.build_always = False
@ -268,10 +268,10 @@ class Target:
return self.subdir
def process_kwargs(self, kwargs):
if 'build_on_all' in kwargs:
self.build_on_all = kwargs['build_on_all']
if not isinstance(self.build_on_all, bool):
raise InvalidArguments('build_on_all must be a boolean value.')
if 'build_by_default' in kwargs:
self.build_by_default = kwargs['build_by_default']
if not isinstance(self.build_by_default, bool):
raise InvalidArguments('build_by_default must be a boolean value.')
class BuildTarget(Target):
def __init__(self, name, subdir, subproject, is_cross, sources, objects, environment, kwargs):

@ -526,8 +526,8 @@ class LinuxlikeTests(unittest.TestCase):
self._test_stds_impl(testdir, cpp, 'cpp')
def test_build_on_all(self):
testdir = os.path.join(self.unit_test_dir, '4 build on all')
def test_build_by_default(self):
testdir = os.path.join(self.unit_test_dir, '5 build by default')
self.init(testdir)
self.build()
genfile = os.path.join(self.builddir, 'generated.dat')

@ -3,11 +3,11 @@ project('build on all', 'c')
py3_mod = import('python3')
py3 = py3_mod.find_python()
executable('fooprog', 'foo.c', build_on_all : false)
executable('fooprog', 'foo.c', build_by_default : false)
comp = files('mygen.py')
mytarget = custom_target('gendat',
output : 'generated.dat',
input : 'source.txt',
command : [py3] + comp + ['@INPUT@', '@OUTPUT@'],
build_on_all : true,
build_by_default : true,
)
Loading…
Cancel
Save