diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-16 15:27:44 +0100 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2024-12-19 09:25:20 -0800 |
| commit | 15c2c9811411e5e84419bcee487fb3a84ac2756c (patch) | |
| tree | 1237a185415fec8135fad99b0d7b73fb82d0d6e4 /mesonbuild | |
| parent | 8b9846d9a9d29b427860891c9b699eb4305e348b (diff) | |
| download | meson-15c2c9811411e5e84419bcee487fb3a84ac2756c.tar.gz | |
introspect: add machine to target_sources
Even though the "targets" introspection info already includes the
command line arguments used to invoke the compiler, this is not
enough to correlated with the "compilers" introspection info and
get extra information from there.
Together with the existing "language" key, adding a "machine" key
is enough to identify completely an entry in the compilers info.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild')
| -rw-r--r-- | mesonbuild/ast/introspection.py | 3 | ||||
| -rw-r--r-- | mesonbuild/backend/backends.py | 3 | ||||
| -rw-r--r-- | mesonbuild/backend/ninjabackend.py | 1 | ||||
| -rw-r--r-- | mesonbuild/mintro.py | 1 |
4 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index 3e8d564e2..6bc6286f2 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -283,7 +283,7 @@ class IntrospectionInterpreter(AstInterpreter): kwargs_reduced = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs and k in {'install', 'build_by_default', 'build_always'}} kwargs_reduced = {k: v.value if isinstance(v, ElementaryNode) else v for k, v in kwargs_reduced.items()} kwargs_reduced = {k: v for k, v in kwargs_reduced.items() if not isinstance(v, BaseNode)} - for_machine = MachineChoice.HOST + for_machine = MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST objects: T.List[T.Any] = [] empty_sources: T.List[T.Any] = [] # Passing the unresolved sources list causes errors @@ -294,6 +294,7 @@ class IntrospectionInterpreter(AstInterpreter): new_target = { 'name': target.get_basename(), + 'machine': target.for_machine.get_lower_case_name(), 'id': target.get_id(), 'type': target.get_typename(), 'defined_in': os.path.normpath(os.path.join(self.source_root, self.subdir, environment.build_filename)), diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index a4be50f66..d2c6a4696 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -41,13 +41,14 @@ if T.TYPE_CHECKING: from ..linkers.linkers import StaticLinker from ..mesonlib import FileMode, FileOrString - from typing_extensions import TypedDict + from typing_extensions import TypedDict, NotRequired _ALL_SOURCES_TYPE = T.List[T.Union[File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]] class TargetIntrospectionData(TypedDict): language: str + machine: NotRequired[str] compiler: T.List[str] parameters: T.List[str] sources: T.List[str] diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 5716ea29e..64921ffa6 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -837,6 +837,7 @@ class NinjaBackend(backends.Backend): # The new entry src_block = { 'language': lang, + 'machine': comp.for_machine.get_lower_case_name(), 'compiler': comp.get_exelist(), 'parameters': parameters, 'sources': [], diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 810a2b674..b9b09c557 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -211,6 +211,7 @@ def list_targets_from_source(intr: IntrospectionInterpreter) -> T.List[T.Dict[st 'build_by_default': i['build_by_default'], 'target_sources': [{ 'language': 'unknown', + 'machine': i['machine'], 'compiler': [], 'parameters': [], 'sources': [str(x) for x in sources], |
