ninja: Don't add every CustomTarget to 'all'
Otherwise they are built regardless of whether they are actually used by anything else. Only build them if they're going to be installed or always-built. Ideally, we should also do this with all BuildTargets, and provide a mechanism for people to specify which targets they want built with 'all', and a way for people to add them to custom targets.. Without this, things like tests and examples are *always* built with no way to turn that off. For now, we just do this because it also with tests that check for dependency issues. Including all CustomTargets in `all` results in dangling targets to also be built, which hides the problem and makes it racy.
This commit is contained in:
parent
e713aca1d1
commit
9d1aeebc27
|
@ -1920,8 +1920,16 @@ rule FORTRAN_DEP_HACK
|
||||||
elem.write(outfile)
|
elem.write(outfile)
|
||||||
|
|
||||||
def generate_ending(self, outfile):
|
def generate_ending(self, outfile):
|
||||||
targetlist = [self.get_target_filename(t) for t in self.build.get_targets().values()\
|
targetlist = []
|
||||||
if not isinstance(t, build.RunTarget)]
|
for t in self.build.get_targets().values():
|
||||||
|
# RunTargets are meant to be invoked manually
|
||||||
|
if isinstance(t, build.RunTarget):
|
||||||
|
continue
|
||||||
|
# CustomTargets that aren't installed should only be built if they
|
||||||
|
# are used by something else or are meant to be always built
|
||||||
|
if isinstance(t, build.CustomTarget) and not (t.install or t.build_always):
|
||||||
|
continue
|
||||||
|
targetlist.append(self.get_target_filename(t))
|
||||||
|
|
||||||
elem = NinjaBuildElement(self.all_outputs, 'all', 'phony', targetlist)
|
elem = NinjaBuildElement(self.all_outputs, 'all', 'phony', targetlist)
|
||||||
elem.write(outfile)
|
elem.write(outfile)
|
||||||
|
|
Loading…
Reference in New Issue