From b1087f011cb815a5214791ab92e7214e01b45b72 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 14 Jan 2017 17:01:07 +0200 Subject: [PATCH] Moved detection of targets to build on all into own function. --- mesonbuild/backend/ninjabackend.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index e6f82d104..cace3b3b2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2160,21 +2160,26 @@ rule FORTRAN_DEP_HACK elem.add_item('pool', 'console') elem.write(outfile) + def get_build_on_all_targets(self): + result = [] + for t in self.build.get_targets().values(): + if t.build_on_all: + result.append(t) + # CustomTargets that aren't installed should only be built if + # they are used by something else or are to always be built + if isinstance(t, build.CustomTarget): + if t.install or t.build_always: + result.append(t) + return result + def generate_ending(self, outfile): targetlist = [] ctlist = [] - for t in self.build.get_targets().values(): - # RunTargets are meant to be invoked manually - if isinstance(t, build.RunTarget): - continue + for t in self.get_build_on_all_targets(): if isinstance(t, build.CustomTarget): # Create a list of all custom target outputs for o in t.get_outputs(): ctlist.append(os.path.join(self.get_target_dir(t), o)) - # CustomTargets that aren't installed should only be built if - # they are used by something else or are to always be built - if not (t.install or t.build_always): - continue # Add the first output of each target to the 'all' target so that # they are all built targetlist.append(os.path.join(self.get_target_dir(t), t.get_outputs()[0]))