diff options
author | Charles Brunet <charles.brunet@optelgroup.com> | 2023-03-15 09:29:13 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-03-17 02:05:23 -0400 |
commit | 91b88b1a763c21b899a4c673a84859c8bc63b127 (patch) | |
tree | 9390cb388c97469fa613480b5b057a49614dd425 | |
parent | 72cd2a395a240f050b6225b9aed876ee214ecd8c (diff) | |
download | meson-91b88b1a763c21b899a4c673a84859c8bc63b127.zip meson-91b88b1a763c21b899a4c673a84859c8bc63b127.tar.gz meson-91b88b1a763c21b899a4c673a84859c8bc63b127.tar.bz2 |
fix meson compile with alias target
this fixes a bug introduced by #11528
-rw-r--r-- | docs/markdown/Commands.md | 2 | ||||
-rw-r--r-- | mesonbuild/mcompile.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/docs/markdown/Commands.md b/docs/markdown/Commands.md index b7b72c4..52eb76c 100644 --- a/docs/markdown/Commands.md +++ b/docs/markdown/Commands.md @@ -61,7 +61,7 @@ Builds a default or a specified target of a configured Meson project. `TARGET` has the following syntax `[PATH/]NAME[:TYPE]`, where: - `NAME`: name of the target from `meson.build` (e.g. `foo` from `executable('foo', ...)`). - `PATH`: path to the target relative to the root `meson.build` file. Note: relative path for a target specified in the root `meson.build` is `./`. -- `TYPE`: type of the target. Can be one of the following: 'executable', 'static_library', 'shared_library', 'shared_module', 'custom', 'run', 'jar'. +- `TYPE`: type of the target. Can be one of the following: 'executable', 'static_library', 'shared_library', 'shared_module', 'custom', 'alias', 'run', 'jar'. `PATH` and/or `TYPE` can be omitted if the resulting `TARGET` can be used to uniquely identify the target in `meson.build`. diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index ce002bd..8179784 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -89,6 +89,7 @@ class ParsedTargetName: 'shared_library', 'shared_module', 'custom', + 'alias', 'run', 'jar', } @@ -130,7 +131,7 @@ def get_target_from_intro_data(target: ParsedTargetName, builddir: Path, introsp def generate_target_names_ninja(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> T.List[str]: intro_target = get_target_from_intro_data(target, builddir, introspect_data) - if intro_target['type'] == 'run': + if intro_target['type'] in {'alias', 'run'}: return [target.name] else: return [str(Path(out_file).relative_to(builddir.resolve())) for out_file in intro_target['filename']] @@ -169,7 +170,7 @@ def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path) -> T.Tu def generate_target_name_vs(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> str: intro_target = get_target_from_intro_data(target, builddir, introspect_data) - assert intro_target['type'] != 'run', 'Should not reach here: `run` targets must be handle above' + assert intro_target['type'] not in {'alias', 'run'}, 'Should not reach here: `run` targets must be handle above' # Normalize project name # Source: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe @@ -189,7 +190,7 @@ def get_parsed_args_vs(options: 'argparse.Namespace', builddir: Path) -> T.Tuple if options.targets: intro_data = parse_introspect_data(builddir) has_run_target = any( - get_target_from_intro_data(ParsedTargetName(t), builddir, intro_data)['type'] == 'run' + get_target_from_intro_data(ParsedTargetName(t), builddir, intro_data)['type'] in {'alias', 'run'} for t in options.targets) if has_run_target: |