Skip to content

Commit 81d7421

Browse files
committed
build: cache target id at time of first use
1 parent 827cd98 commit 81d7421

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mesonbuild/build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extract_as_list, typeslistify, stringlistify, classify_unity_sources,
2525
get_filenames_templates_dict, substitute_values, has_path_sep,
2626
PerMachineDefaultable,
27-
MesonBugException, EnvironmentVariables, pickle_load,
27+
MesonBugException, EnvironmentVariables, pickle_load, lazy_property,
2828
)
2929
from .options import OptionKey
3030

@@ -637,13 +637,17 @@ def construct_id_from_path(subdir: str, name: str, type_suffix: str) -> str:
637637
return subdir_part + '@@' + my_id
638638
return my_id
639639

640-
def get_id(self) -> str:
640+
@lazy_property
641+
def __id(self) -> str:
641642
name = self.name
642643
if getattr(self, 'name_suffix_set', False):
643644
name += '.' + self.suffix
644645
return self.construct_id_from_path(
645646
self.subdir, name, self.type_suffix())
646647

648+
def get_id(self) -> str:
649+
return self.__id
650+
647651
def process_kwargs_base(self, kwargs: T.Dict[str, T.Any]) -> None:
648652
if 'build_by_default' in kwargs:
649653
self.build_by_default = kwargs['build_by_default']

0 commit comments

Comments
 (0)