Skip to content

Commit

Permalink
[WIP] SQUASHME
Browse files Browse the repository at this point in the history
  • Loading branch information
oleavr committed Feb 6, 2024
1 parent 2ebd3f5 commit 831234b
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 831234b

Please sign in to comment.