diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 6c49c30ede42..e7f4b809c958 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -172,13 +172,21 @@ def add_section(self, section: str, values: T.Dict[str, T.Any], bool_yn: bool, self.sections[section][k] = (formatted_values, list_sep) self.max_key_len = max(self.max_key_len, len(k)) - def dump(self): + def dump(self, is_cross_build: bool): mlog.log(self.project_name, mlog.normal_cyan(self.project_version)) for section, values in self.sections.items(): mlog.log('') # newline if section: mlog.log(' ', mlog.bold(section)) - for k, v in values.items(): + for raw_k, v in values.items(): + if isinstance(raw_k, tuple): + subp_name, for_machine = raw_k + if is_cross_build and for_machine == MachineChoice.BUILD: + k = f"{subp_name}[native]" + else: + k = subp_name + else: + k = raw_k v, list_sep = v padding = self.max_key_len - len(k) end = ' ' if v else '' @@ -297,7 +305,7 @@ def __init__( self.processed_buildfiles: T.Set[str] = set() self.project_args_frozen = False self.global_args_frozen = False # implies self.project_args_frozen - self.subprojects: T.Dict[str, SubprojectHolder] = {} + self.subprojects: T.Dict[T.Tuple[str, MachineChoice], SubprojectHolder] = {} self.subproject_stack: T.List[str] = [] self.configure_file_outputs: T.Dict[str, int] = {} # Passed from the outside, only used in subprojects. @@ -865,11 +873,9 @@ def func_subproject(self, nodes: mparser.BaseNode, args: T.Tuple[str], kwargs: k def find_subproject(self, subp_name: str, native: bool) -> Optional[SubprojectHolder]: return self.subprojects.get(self._make_subproject_id(subp_name, native)) - def _make_subproject_id(self, subp_name: str, native: bool) -> str: - if not self.coredata.is_cross_build(): - return subp_name - tag = 'build' if native else 'host' - return ':'.join([subp_name, tag]) + def _make_subproject_id(self, subp_name: str, native: bool) -> T.Tuple[str, MachineChoice]: + for_machine = MachineChoice.BUILD if native else MachineChoice.HOST + return (subp_name, for_machine) def disabled_subproject(self, subp_name: str, subp_id: str, disabled_feature: T.Optional[str] = None, exception: T.Optional[Exception] = None) -> SubprojectHolder: @@ -1419,11 +1425,12 @@ def _print_summary(self) -> None: # Print all summaries, main project last. mlog.log('') # newline main_summary = self.summary.pop('', None) + is_cross_build = self.coredata.is_cross_build() for subp_id, summary in sorted(self.summary.items()): if self.subprojects[subp_id].found(): - summary.dump() + summary.dump(is_cross_build) if main_summary: - main_summary.dump() + main_summary.dump(is_cross_build) @noArgsFlattening @FeatureNew('warning', '0.44.0')