interpreter: remove is_translated

It's not actually useful, we can just add the root meson.build file to
the depfiles when we translate the meson.build into ast. If there's a
provided ast then we don't go down that path anyway.
pull/13908/head
Dylan Baker 10 months ago
parent cad608108b
commit 5d0e073721
  1. 20
      mesonbuild/interpreter/interpreter.py

@ -269,7 +269,6 @@ class Interpreter(InterpreterBase, HoldableObject):
subproject_dir: str = 'subprojects',
default_project_options: T.Optional[T.Dict[OptionKey, str]] = None,
ast: T.Optional[mparser.CodeBlockNode] = None,
is_translated: bool = False,
relaxations: T.Optional[T.Set[InterpreterRuleRelaxation]] = None,
user_defined_options: T.Optional[coredata.SharedCMDOptions] = None,
) -> None:
@ -283,6 +282,7 @@ class Interpreter(InterpreterBase, HoldableObject):
self.modules: T.Dict[str, NewExtensionModule] = {}
self.subproject_dir = subproject_dir
self.relaxations = relaxations or set()
self.build_def_files: mesonlib.OrderedSet[str] = mesonlib.OrderedSet()
if ast is None:
self.load_root_meson_file()
else:
@ -305,16 +305,6 @@ class Interpreter(InterpreterBase, HoldableObject):
self.build_holder_map()
self.user_defined_options = user_defined_options
self.compilers: PerMachine[T.Dict[str, 'compilers.Compiler']] = PerMachine({}, {})
# build_def_files needs to be defined before parse_project is called
#
# For non-meson subprojects, we'll be using the ast. Even if it does
# exist we don't want to add a dependency on it, it's autogenerated
# from the actual build files, and is just for reference.
self.build_def_files: mesonlib.OrderedSet[str] = mesonlib.OrderedSet()
if not is_translated:
build_filename = os.path.join(self.subdir, environment.build_filename)
self.build_def_files.add(build_filename)
self.parse_project()
self._redetect_machines()
@ -339,6 +329,11 @@ class Interpreter(InterpreterBase, HoldableObject):
self.builtin['target_machine'] = \
OBJ.MachineHolder(self.build.environment.machines.target, self)
def load_root_meson_file(self) -> None:
build_filename = os.path.join(self.subdir, environment.build_filename)
self.build_def_files.add(build_filename)
super().load_root_meson_file()
def build_func_dict(self) -> None:
self.funcs.update({'add_global_arguments': self.func_add_global_arguments,
'add_global_link_arguments': self.func_add_global_link_arguments,
@ -968,8 +963,7 @@ class Interpreter(InterpreterBase, HoldableObject):
new_build = self.build.copy()
subi = Interpreter(new_build, self.backend, subp_name, subdir, self.subproject_dir,
default_options, ast=ast, is_translated=(ast is not None),
relaxations=relaxations,
default_options, ast=ast, relaxations=relaxations,
user_defined_options=self.user_defined_options)
# Those lists are shared by all interpreters. That means that
# even if the subproject fails, any modification that the subproject

Loading…
Cancel
Save