From 86e939e9d545a7cac41c74e6650c9c43e7f101c3 Mon Sep 17 00:00:00 2001 From: DianQK Date: Tue, 9 Apr 2024 21:59:36 +0800 Subject: [PATCH] Change the output artifact path to `$root_dir/obj/$image` when running locally --- src/ci/docker/README.md | 11 ++++------- src/ci/docker/run.sh | 10 +++++++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 2e645683713..9af368ef445 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -14,7 +14,7 @@ for example: ./src/ci/docker/run.sh x86_64-gnu ``` -Images will output artifacts in an `obj` dir at the root of a repository. Note +Images will output artifacts in an `obj/$image_name` dir at the root of a repository. Note that the script will overwrite the contents of this directory. To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e.g.: @@ -22,12 +22,9 @@ To match conditions in rusts CI, also set the environment variable `DEPLOY=1`, e DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu ``` -**NOTE**: Re-using the same `obj` dir with different docker images with -the same target triple (e.g. `dist-x86_64-linux` and `dist-various-1`) -may result in strange linker errors, due shared library versions differing between platforms. - -If you encounter any issues when using multiple Docker images, try deleting your `obj` directory -before running your command. +**NOTE**: In CI, the script outputs the artifacts to the `obj` directory, +while locally, to the `obj/$image_name` directory. This is primarily to prevent +strange linker errors when using multiple Docker images. ## Filesystem layout diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index df90c3875b1..fcc507b572c 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -33,7 +33,13 @@ ci_dir="`dirname $script_dir`" src_dir="`dirname $ci_dir`" root_dir="`dirname $src_dir`" -objdir=$root_dir/obj +source "$ci_dir/shared.sh" + +if isCI; then + objdir=$root_dir/obj +else + objdir=$root_dir/obj/$image +fi dist=$objdir/build/dist @@ -41,8 +47,6 @@ if [ -d "$root_dir/.git" ]; then IS_GIT_SOURCE=1 fi -source "$ci_dir/shared.sh" - CACHE_DOMAIN="${CACHE_DOMAIN:-ci-caches.rust-lang.org}" if [ -f "$docker_dir/$image/Dockerfile" ]; then