Skip to content

Commit

Permalink
build: cache target id at time of first use
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzini committed Jan 12, 2025
1 parent 827cd98 commit 4b59905
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mesonbuild/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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

Expand Down Expand Up @@ -637,13 +637,17 @@ def construct_id_from_path(subdir: str, name: str, type_suffix: str) -> str:
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']
Expand Down

0 comments on commit 4b59905

Please sign in to comment.