From e0fd2ffae55a6679655e12e4e4880c530184140f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 9 Jan 2025 12:35:57 +0100 Subject: build: cache target id at time of first use --- mesonbuild/build.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 8d3d4052d..9f3af9fba 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -25,7 +25,7 @@ from .mesonlib import ( extract_as_list, typeslistify, stringlistify, classify_unity_sources, get_filenames_templates_dict, substitute_values, has_path_sep, PerMachineDefaultable, - MesonBugException, EnvironmentVariables, pickle_load, + MesonBugException, EnvironmentVariables, pickle_load, lazy_property, ) from .options import OptionKey @@ -627,13 +627,17 @@ class Target(HoldableObject, metaclass=abc.ABCMeta): return subdir_part + '@@' + my_id return my_id - def get_id(self) -> str: + @lazy_property + def id(self) -> str: name = self.name if getattr(self, 'name_suffix_set', False): name += '.' + self.suffix return self.construct_id_from_path( self.subdir, name, self.type_suffix()) + def get_id(self) -> str: + return self.id + def process_kwargs_base(self, kwargs: T.Dict[str, T.Any]) -> None: if 'build_by_default' in kwargs: self.build_by_default = kwargs['build_by_default'] -- cgit v1.2.3