Skip to content

Commit

Permalink
backend/ninja: give better descriptions for depscanning rules
Browse files Browse the repository at this point in the history
backend/ninja: use the depscanner for fortran objects as well
  • Loading branch information
dcbaker committed Nov 22, 2023
1 parent 282c0b1 commit 58c8923
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,12 @@ def generate_target(self, target):
obj_targets = [t for t in od if t.uses_fortran()]
obj_list.extend(o)

fortran_order_deps = [File(True, *os.path.split(self.get_target_filename(t))) for t in obj_targets]
# We don't need this order dep if we're using dyndeps, as the
# depscanner will handle this for us, which produces a better dependency
# graph
fortran_order_deps: T.List[File] = []
if not self.use_dyndeps_for_fortran():
fortran_order_deps = [File(True, *os.path.split(self.get_target_filename(t))) for t in obj_targets]
fortran_inc_args: T.List[str] = []
if target.uses_fortran():
fortran_inc_args = mesonlib.listify([target.compilers['fortran'].get_include_args(
Expand Down Expand Up @@ -1118,14 +1123,18 @@ def generate_dependency_scan_target(self, target: build.BuildTarget,
for g in generated_source_files:
elem.orderdeps.add(g.relative_name())
elem.orderdeps.update(object_deps)
elem.add_item('name', target.name)
self.add_build(elem)

infiles = [json_file]
for t in itertools.chain(target.link_targets, target.link_whole_targets):
if self.should_use_dyndeps_for_target(t):
infiles.append(self.get_dep_scan_file_for(t)[0])
_, od = self.flatten_object_list(target)
infiles.extend([self.get_dep_scan_file_for(t)[0] for t in od if t.uses_fortran()])

elem = NinjaBuildElement(self.all_outputs, depscan_file, 'depaccumulate', infiles)
elem.add_item('name', target.name)
self.add_build(elem)

def select_sources_to_scan(self, compiled_sources: T.List[str]
Expand Down Expand Up @@ -2526,15 +2535,15 @@ def generate_scanner_rules(self):
command = self.environment.get_build_command() + \
['--internal', 'depscan']
args = ['$picklefile', '$out', '$in']
description = 'Module scanner.'
description = 'Scanning target $name for modules'
rule = NinjaRule(rulename, command, args, description)
self.add_rule(rule)

rulename = 'depaccumulate'
command = self.environment.get_build_command() + \
['--internal', 'depaccumulate']
args = ['$out', '$in']
description = 'Module dependency accumulator.'
description = 'Generating dynamic dependency information for target $name'
rule = NinjaRule(rulename, command, args, description)
self.add_rule(rule)

Expand Down

0 comments on commit 58c8923

Please sign in to comment.