1
0
mirror of https://github.com/containers/youki synced 2024-11-22 17:02:00 +01:00

chore: a separate target directory for runtimetest

building static-linked runtimetest requires additional RUSTFLAGS env
var. Unfortunately, the additional env var invalids the build cache,
leading cargo rebuilding everytime.

See https://github.com/rust-lang/cargo/issues/8716

A temporary solution is to build runtimetest in a seperate
`runtimetest-target` directory.

Signed-off-by: Tony Duan <tony84727@gmail.com>
This commit is contained in:
Tony Duan 2022-06-14 22:58:15 +08:00
parent 75d9053014
commit 6e8f869bf3
No known key found for this signature in database
GPG Key ID: 6D7201FAF44DDE0C
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored

@ -2,6 +2,7 @@
.idea/
**/target
/runtimetest-target
.vagrant/
tags

@ -11,6 +11,7 @@ usage_exit() {
VERSION=debug
TARGET=x86_64-unknown-linux-gnu
RUNTIMETEST_TARGET="$ROOT/runtimetest-target"
while getopts ro:h OPT; do
case $OPT in
o) output=${OPTARG}
@ -36,8 +37,9 @@ OUTPUT=${output:-$ROOT/bin}
cargo build --target ${TARGET} ${OPTION} --bin youki
cargo build --target ${TARGET} ${OPTION} --bin integration_test
RUSTFLAGS="-Ctarget-feature=+crt-static" cargo build --target ${TARGET} ${OPTION} --bin runtimetest
CARGO_TARGET_DIR=${RUNTIMETEST_TARGET} RUSTFLAGS="-Ctarget-feature=+crt-static" cargo build --target ${TARGET} ${OPTION} --bin runtimetest
mv ${ROOT}/target/${TARGET}/${VERSION}/{youki,integration_test,runtimetest} ${OUTPUT}/
mv ${ROOT}/target/${TARGET}/${VERSION}/{youki,integration_test} ${OUTPUT}/
mv ${RUNTIMETEST_TARGET}/${TARGET}/${VERSION}/runtimetest ${OUTPUT}/
exit 0