aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-01-09 12:35:57 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-03-06 13:47:55 -0800
commite0fd2ffae55a6679655e12e4e4880c530184140f (patch)
treebba8432fc33aea990789339d6fcaf4fc2995404a
parentf70945d1184a68be46bd38f0a4672d2bc88e99f2 (diff)
downloadmeson-e0fd2ffae55a6679655e12e4e4880c530184140f.zip
meson-e0fd2ffae55a6679655e12e4e4880c530184140f.tar.gz
meson-e0fd2ffae55a6679655e12e4e4880c530184140f.tar.bz2
build: cache target id at time of first use
-rw-r--r--mesonbuild/build.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 8d3d405..9f3af9f 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']