Skip to content

Commit

Permalink
sccache sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Oct 8, 2024
1 parent 2a6df76 commit 056ac67
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions dev/ci/setup-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ for PROG in cc c++; do
done


## Update environment variables.

HAS_SCCACHE_IN_PATH=$(ruby -e 'puts ENV["PATH"].split(":").include?("/usr/local/bin")')
if !$HAS_SCCACHE_IN_PATH; then
echo "PATH=/usr/local/bin:$PATH" >> "$GITHUB_ENV"
fi

HAS_COMPILER_WRAPPERS_IN_PATH=$(ruby -e 'puts ENV["PATH"].split(":").include?("/usr/local/libexec/sccache")')
if ! $HAS_COMPILER_WRAPPERS_IN_PATH; then
echo "PATH=/usr/local/libexec/sccache:/usr/local/bin:$PATH" >> "$GITHUB_ENV"
else
# When starting the sccache server, the compiler wrappers must *not* be in PATH
# so that the sccache server uses the non-wrapped compilers.
PATH=$(ruby -e 'paths = ENV["PATH"].split(":"); paths.delete("/usr/local/libexec/sccache"); puts paths.join(":")')
export PATH
fi


## Start sccache server.

## Uncomment this to have the sccache server write debug logs to sccache.log.
Expand All @@ -58,5 +76,8 @@ else
env SCCACHE_START_SERVER=1 sccache
fi

# Give sccache server some time to start.
sleep 0.5
echo "Waiting until sccache server is started..."
while [[ -z "$(cat sccache.log)" ]]; then
sleep 0.1
fi
echo "sccache server is started."

0 comments on commit 056ac67

Please sign in to comment.