diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2020-11-26 18:12:42 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2021-01-04 14:26:45 +0300 |
commit | dfdbd370f9708bccfaec71589d12da77ea0b43c7 (patch) | |
tree | d4ca594c7d41b661744976e7a45552fd64e4b2f9 /cargo_wrapper.py | |
parent | 8bc2e5ebb872612140a986897a78b37d3e52f78e (diff) |
meson: use cargo-c
We now have to run 'cbuild' and 'ctest' on each plugin individually.
Replace plugins_rep key by the source path so we can easily discard the
excluded plugins.
Diffstat (limited to 'cargo_wrapper.py')
-rw-r--r-- | cargo_wrapper.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py index 23c0dabc0..4a7d79b46 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -7,6 +7,8 @@ import shutil import subprocess import sys +PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video'] + command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env = sys.argv[ 1:8] @@ -33,30 +35,34 @@ if command == 'build': except IndexError: ext2 = None - cargo_cmd = ['cargo', 'build', '--all-targets', - '--manifest-path', os.path.join( - meson_current_source_dir, 'Cargo.toml'), - '--workspace'] + # Build with the 'static' feature enforcing the minimal gst version required for static builds + cargo_cmd = ['cargo', 'cbuild', '--features', 'static'] if target == 'release': cargo_cmd.append('--release') elif command == 'test': # cargo test - cargo_cmd = ['cargo', 'test', '--no-fail-fast', '--color=always', '--manifest-path', - os.path.join(meson_current_source_dir, 'Cargo.toml'), - '--workspace'] + cargo_cmd = ['cargo', 'ctest', '--no-fail-fast', '--color=always'] else: print("Unknown command:", command) sys.exit(1) -if len(exclude) > 0: - for e in exclude.split(','): - cargo_cmd.append('--exclude') - cargo_cmd.append(e) -try: - subprocess.run(cargo_cmd, env=env, check=True) -except subprocess.SubprocessError: - sys.exit(1) +def run(cargo_cmd, env): + try: + subprocess.run(cargo_cmd, env=env, check=True) + except subprocess.SubprocessError: + sys.exit(1) + + +for d in PLUGIN_DIRS: + for name in os.listdir(os.path.join(meson_current_source_dir, d)): + if '{}/{}'.format(d, name) in exclude: + continue + + cargo_toml = os.path.join( + meson_current_source_dir, d, name, 'Cargo.toml') + cmd = cargo_cmd + ['--manifest-path', cargo_toml] + run(cmd, env) if command == 'build': # Copy so files to build dir |