Add meson.implementation() method

This function returns the current Meson implementation running the build
script. In our case, this is always 'meson'.
pull/12014/head
Tristan Partin 2 years ago
parent 1d84989078
commit b1f015a86a
  1. 9
      docs/markdown/Reference-tables.md
  2. 5
      docs/markdown/snippets/meson-implementation.md
  3. 8
      docs/yaml/builtins/meson.yaml
  4. 7
      mesonbuild/interpreter/mesonmain.py
  5. 3
      test cases/common/264 implementation/meson.build
  6. 1
      test cases/common/264 implementation/meson_options.txt

@ -1,5 +1,14 @@
# Reference tables # Reference tables
## Implementations (since 1.3.0)
These are return values of `meson.implementation()` depending on known
re-implementations.
| Value | Implementation |
| ----- | -------------- |
| meson | Meson |
## Compiler ids ## Compiler ids
These are return values of the `get_id` (Compiler family) and These are return values of the `get_id` (Compiler family) and

@ -0,0 +1,5 @@
## `meson.implementation()`
The built-in `meson` object now has an `implementation()` method. It returns the
current Meson implementation running the build script. In our case, this is
always `'meson'`.

@ -128,7 +128,7 @@ methods:
to install only a subset of the files. to install only a subset of the files.
By default the script has no install tag which means it is not being run when By default the script has no install tag which means it is not being run when
`meson install --tags` argument is specified. `meson install --tags` argument is specified.
dry_run: dry_run:
type: bool type: bool
since: 1.1.0 since: 1.1.0
@ -340,6 +340,12 @@ methods:
deprecated: 0.55.0 deprecated: 0.55.0
description: Use [[meson.can_run_host_binaries]] instead. description: Use [[meson.can_run_host_binaries]] instead.
- name: implementation
returns: str
since: 1.3.0
description: |
Returns the Meson implementation currently running the build script.
- name: install_dependency_manifest - name: install_dependency_manifest
returns: void returns: void
description: | description: |

@ -71,6 +71,7 @@ class MesonMain(MesonInterpreterObject):
'global_source_root': self.global_source_root_method, 'global_source_root': self.global_source_root_method,
'has_exe_wrapper': self.has_exe_wrapper_method, 'has_exe_wrapper': self.has_exe_wrapper_method,
'has_external_property': self.has_external_property_method, 'has_external_property': self.has_external_property_method,
'implementation': self.implementation_method,
'install_dependency_manifest': self.install_dependency_manifest_method, 'install_dependency_manifest': self.install_dependency_manifest_method,
'is_cross_build': self.is_cross_build_method, 'is_cross_build': self.is_cross_build_method,
'is_subproject': self.is_subproject_method, 'is_subproject': self.is_subproject_method,
@ -290,6 +291,12 @@ class MesonMain(MesonInterpreterObject):
self.build.environment.exe_wrapper is None self.build.environment.exe_wrapper is None
) )
@noPosargs
@noKwargs
@FeatureNew('meson.implementation', '1.3.0')
def implementation_method(self, args: T.List['TYPE_var'], kwargs: 'TYPE_kwargs') -> str:
return 'meson'
@noPosargs @noPosargs
@noKwargs @noKwargs
def is_cross_build_method(self, args: T.List['TYPE_var'], kwargs: 'TYPE_kwargs') -> bool: def is_cross_build_method(self, args: T.List['TYPE_var'], kwargs: 'TYPE_kwargs') -> bool:

@ -0,0 +1,3 @@
project('meson.implementation()')
assert(meson.implementation() == get_option('implementation'))

@ -0,0 +1 @@
option('implementation', type: 'string', value: 'meson')
Loading…
Cancel
Save