build: Place target in meson build dir
Instead of putting target/ and target_test/ in the source directory, we can tell our cargo script to put both target and our cargo-home in meson's build directory. In addition, makes tests and builds use the same target directory, significantly reducing the time it takes to run tests.
This commit is contained in:
parent
78f29e726e
commit
7a77f31aa3
@ -78,6 +78,7 @@ meson.add_dist_script(
|
||||
test(
|
||||
'cargo-test',
|
||||
test_script,
|
||||
args: meson.build_root(),
|
||||
workdir: meson.source_root(),
|
||||
timeout: 3000
|
||||
)
|
||||
|
||||
@ -41,8 +41,6 @@ cargo_release = custom_target('cargo-build',
|
||||
command: [cargo_script,
|
||||
'@SOURCE_ROOT@',
|
||||
'@OUTPUT@',
|
||||
podcasts_localedir,
|
||||
application_id,
|
||||
podcasts_version + version_suffix,
|
||||
meson.build_root(),
|
||||
profile
|
||||
])
|
||||
|
||||
@ -2,11 +2,10 @@
|
||||
|
||||
set -ex
|
||||
|
||||
export CARGO_HOME=$1/target/cargo-home
|
||||
export LOCALEDIR="$3"
|
||||
export APP_ID="$4"
|
||||
export VERSION="$5"
|
||||
export PROFILE="$6"
|
||||
export OUTPUT="$2"
|
||||
export CARGO_TARGET_DIR="$3"/target
|
||||
export CARGO_HOME="$CARGO_TARGET_DIR"/cargo-home
|
||||
export PROFILE="$4"
|
||||
|
||||
TARGET=debug
|
||||
ARGS=()
|
||||
@ -23,4 +22,4 @@ if test -d vendor; then
|
||||
fi
|
||||
|
||||
cargo build ${ARGS[@]} --manifest-path="$1"/Cargo.toml -p podcasts-gtk &&
|
||||
cp $1/target/${TARGET}/podcasts-gtk $2
|
||||
cp "$CARGO_TARGET_DIR"/${TARGET}/podcasts-gtk "$OUTPUT"
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
#! /usr/bin/sh
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
export CARGO_HOME="target/cargo-home"
|
||||
export CARGO_TARGET_DIR="target_test/"
|
||||
export CARGO_TARGET_DIR="$1/target/"
|
||||
export CARGO_HOME="$CARGO_TARGET_DIR/cargo-home"
|
||||
|
||||
cargo test -j 1 -- --test-threads=1 --nocapture
|
||||
|
||||
Loading…
Reference in New Issue
Block a user