Skip to content

Commit

Permalink
sccache indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FooBarWidget committed Oct 6, 2024
1 parent 45b2fe6 commit 6a4df12
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
52 changes: 26 additions & 26 deletions dev/ci/setup-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set -e
## Check parameters & set defaults.

if [[ -z "$ARCH_AND_OS" ]]; then
echo "ARCH_AND_OS is required"
exit 1
echo "ARCH_AND_OS is required"
exit 1
fi

if [[ -z "$SCCACHE_AZURE_CONNECTION_STRING" ]]; then
echo "SCCACHE_AZURE_CONNECTION_STRING is required"
exit 1
echo "SCCACHE_AZURE_CONNECTION_STRING is required"
exit 1
fi

SCCACHE_LOG=${SCCACHE_LOG:-info} # set to 'debug' or 'trace' for more verbose logging
Expand All @@ -23,14 +23,14 @@ exec 2>&1

## Download and install sccache.
if [[ ! -e /usr/local/bin/sccache ]]; then
echo "::group::Download sccache"
wget --output-document sccache.tar.gz "https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-$ARCH_AND_OS.tar.gz"
echo "::endgroup::"
set -x
tar xzf sccache.tar.gz
rm sccache.tar.gz
sudo mv sccache*/sccache /usr/local/bin/sccache
rm -rf sccache*
echo "::group::Download sccache"
wget --output-document sccache.tar.gz "https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-$ARCH_AND_OS.tar.gz"
echo "::endgroup::"
set -x
tar xzf sccache.tar.gz
rm sccache.tar.gz
sudo mv sccache*/sccache /usr/local/bin/sccache
rm -rf sccache*
fi


Expand All @@ -39,29 +39,29 @@ set -x
echo "PATH=/usr/local/libexec/sccache:/usr/local/bin:$PATH" >> "$GITHUB_ENV"
sudo mkdir -p /usr/local/libexec/sccache
for PROG in cc c++; do
FULLPATH=$(command -v "$PROG")
echo '#!/bin/sh' > "$PROG"
echo "exec /usr/local/bin/sccache $FULLPATH \"\$@\"" >> "$PROG"
chmod +x "$PROG"
sudo mv "$PROG" /usr/local/libexec/sccache/
FULLPATH=$(command -v "$PROG")
echo '#!/bin/sh' > "$PROG"
echo "exec /usr/local/bin/sccache $FULLPATH \"\$@\"" >> "$PROG"
chmod +x "$PROG"
sudo mv "$PROG" /usr/local/libexec/sccache/
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"
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
# 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
# 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
else
echo "PATH=/usr/local/libexec/sccache:$PATH" >> "$GITHUB_ENV"
echo "PATH=/usr/local/libexec/sccache:$PATH" >> "$GITHUB_ENV"
fi


Expand All @@ -73,15 +73,15 @@ export SCCACHE_ERROR_LOG="$(pwd)/sccache.log"
echo "SCCACHE_ERROR_LOG=$SCCACHE_ERROR_LOG" >> "$GITHUB_ENV"

if $SUDO; then
sudo -E env SCCACHE_START_SERVER=1 sccache
sudo -E env SCCACHE_START_SERVER=1 sccache
else
env SCCACHE_START_SERVER=1 sccache
env SCCACHE_START_SERVER=1 sccache
fi

set +x
echo "Waiting until sccache server is started..."
while [[ ! -e sccache.log ]]; do
sleep 0.1
sleep 0.1
done
sleep 0.5
echo "sccache server is started."
12 changes: 6 additions & 6 deletions dev/ci/teardown-sccache
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ set -x
# assume that sccache is in PATH and also don't assume that the log file exists.

if [[ -e /usr/local/bin/sccache ]]; then
if $SUDO; then
sudo /usr/local/bin/sccache --stop-server
else
/usr/local/bin/sccache --stop-server
fi
if $SUDO; then
sudo /usr/local/bin/sccache --stop-server
else
/usr/local/bin/sccache --stop-server
fi
fi

if test -e sccache.log; then
cat sccache.log;
cat sccache.log;
fi

# Remove compiler wrappers from PATH.
Expand Down

0 comments on commit 6a4df12

Please sign in to comment.