From 9ba0d5b92580368298e74fe345561429ba24d57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Wed, 7 Feb 2024 13:56:46 +0100 Subject: [PATCH] [WIP] SQUASHME --- mesonbuild/interpreter/interpreter.py | 19 +++++++++++-------- mesonbuild/modules/__init__.py | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 81da6550e328..7b860543f49a 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1977,7 +1977,7 @@ def func_vcs_tag(self, node: mparser.BaseNode, args: T.List['TYPE_var'], kwargs: tg = build.CustomTarget( kwargs['output'][0], self.subdir, - self.subproject, + self.subp_id, self.environment, cmd, self.source_strings_to_files(kwargs['input']), @@ -2098,7 +2098,7 @@ def func_custom_target(self, node: mparser.FunctionNode, args: T.Tuple[str], tg = build.CustomTarget( name, self.subdir, - self.subproject, + self.subp_id, self.environment, command, inputs, @@ -2137,7 +2137,7 @@ def func_run_target(self, node: mparser.FunctionNode, args: T.Tuple[str], if isinstance(all_args[0], str): all_args[0] = self.find_program_impl([all_args[0]]) name = args[0] - tg = build.RunTarget(name, all_args, kwargs['depends'], self.subdir, self.subproject, self.environment, + tg = build.RunTarget(name, all_args, kwargs['depends'], self.subdir, self.subp_id, self.environment, kwargs['env']) self.add_target(name, tg) return tg @@ -2148,7 +2148,7 @@ def func_run_target(self, node: mparser.FunctionNode, args: T.Tuple[str], def func_alias_target(self, node: mparser.BaseNode, args: T.Tuple[str, T.List[build.Target]], kwargs: 'TYPE_kwargs') -> build.AliasTarget: name, deps = args - tg = build.AliasTarget(name, deps, self.subdir, self.subproject, self.environment) + tg = build.AliasTarget(name, deps, self.subdir, self.subp_id, self.environment) self.add_target(name, tg) return tg @@ -2972,9 +2972,9 @@ def _add_global_arguments(self, node: mparser.FunctionNode, argsdict: T.Dict[str def _add_project_arguments(self, node: mparser.FunctionNode, argsdict: T.Dict[str, T.Dict[str, T.List[str]]], args: T.List[str], kwargs: 'kwtypes.FuncAddProjectArgs') -> None: - if self.subproject not in argsdict: - argsdict[self.subproject] = {} - self._add_arguments(node, argsdict[self.subproject], + if self.subp_id not in argsdict: + argsdict[self.subp_id] = {} + self._add_arguments(node, argsdict[self.subp_id], self.project_args_frozen, args, kwargs) def _add_arguments(self, node: mparser.FunctionNode, argsdict: T.Dict[str, T.List[str]], @@ -3326,6 +3326,9 @@ def build_target(self, node: mparser.BaseNode, args: T.Tuple[str, SourcesVarargs # Silently force to native because that's the only sensible value # and rust_crate_type is deprecated any way. for_machine = MachineChoice.BUILD + elif self.environment.is_native_clone: + for_machine = MachineChoice.BUILD + kwargs['install'] = False # Avoid mutating, since there could be other references to sources sources = sources + kwargs['sources'] if any(isinstance(s, build.BuildTarget) for s in sources): @@ -3433,7 +3436,7 @@ def build_target(self, node: mparser.BaseNode, args: T.Tuple[str, SourcesVarargs if kwargs['implib'] is None: kwargs['implib'] = False - target = targetclass(name, self.subdir, self.subproject, for_machine, srcs, struct, objs, + target = targetclass(name, self.subdir, self.subp_id, for_machine, srcs, struct, objs, self.environment, self.compilers[for_machine], kwargs) self.add_target(name, target) diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py index 17b3631d983a..7fe3ef8a40a8 100644 --- a/mesonbuild/modules/__init__.py +++ b/mesonbuild/modules/__init__.py @@ -50,7 +50,7 @@ def __init__(self, interpreter: 'Interpreter') -> None: self.headers = interpreter.build.get_headers() self.man = interpreter.build.get_man() self.global_args = interpreter.build.global_args.host - self.project_args = interpreter.build.projects_args.host.get(interpreter.subproject, {}) + self.project_args = interpreter.build.projects_args.host.get(interpreter.subp_id, {}) self.current_node = interpreter.current_node def get_include_args(self, include_dirs: T.Iterable[T.Union[str, build.IncludeDirs]], prefix: str = '-I') -> T.List[str]: