diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-02-22 20:03:07 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-02-23 19:37:03 -0500 |
commit | 691eb0250a58fa8e63a2cf6b256043a5479c2722 (patch) | |
tree | afafa5bda0ce230f4d6d6dcfc23067c71ee2b8f3 /mesonbuild/mcompile.py | |
parent | 671647188ce0caf6f734a898ff8ae6784f556c25 (diff) | |
download | meson-691eb0250a58fa8e63a2cf6b256043a5479c2722.zip meson-691eb0250a58fa8e63a2cf6b256043a5479c2722.tar.gz meson-691eb0250a58fa8e63a2cf6b256043a5479c2722.tar.bz2 |
mcompile: make sure arguments are passed in the correct order
meson compile itself doesn't permit GNU-style argument permutation, i.e.
TARGET to precede options, so why should we expect ninja to?
And indeed, ninja doesn't document support for this -- but it does
accept it anyway, which is confusing and results in people thinking it's
"supposed to" work.
However, if NINJA=samu then this is in fact enforced. samu does not
permit GNU-style argument permutation. As a result, the arguments passed
to mcompile are actively re-ordered before being passed to the
subprocess, and samu dies with a fatal error.
Fix ordering in mcompile.py and add a comment to warn future readers
that the order does, in fact, matter.
Diffstat (limited to 'mesonbuild/mcompile.py')
-rw-r--r-- | mesonbuild/mcompile.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index 16eb82a..b623dbe 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -144,13 +144,6 @@ def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path) -> T.Tu cmd = runner + ['-C', builddir.as_posix()] - if options.targets: - intro_data = parse_introspect_data(builddir) - for t in options.targets: - cmd.extend(generate_target_names_ninja(ParsedTargetName(t), builddir, intro_data)) - if options.clean: - cmd.append('clean') - # If the value is set to < 1 then don't set anything, which let's # ninja/samu decide what to do. if options.jobs > 0: @@ -163,6 +156,14 @@ def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path) -> T.Tu cmd += options.ninja_args + # operands must be processed after options/option-arguments + if options.targets: + intro_data = parse_introspect_data(builddir) + for t in options.targets: + cmd.extend(generate_target_names_ninja(ParsedTargetName(t), builddir, intro_data)) + if options.clean: + cmd.append('clean') + return cmd, None def generate_target_name_vs(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> str: |