Add wrapper for sccache command in Linux and macOS

The sccache tends to fail every now and then. Adding a wrapper
which calls build tools directly if first call with sccacche fails.

Task-number: COIN-740
Pick-to: 6.2 6.3 6.4
Change-Id: Ic03cf991da585d1569387118183763497ea73b72
Reviewed-by: Toni Saario <toni.saario@qt.io>
This commit is contained in:
Simo Fält
2022-08-05 09:47:45 +03:00
parent a992ba9205
commit e8495fc86e
2 changed files with 21 additions and 0 deletions

View File

@@ -62,4 +62,11 @@ function installSccache {
# disable sccache server from shutting down after being idle
SetEnvVar "SCCACHE_IDLE_TIMEOUT" "0"
# copy sccache wrapper and place as a first in PATH
mkdir -p $HOME/sccache_wrapper
cp ${BASH_SOURCE%/*}/sccache_wrapper $HOME/sccache_wrapper/sccache
chmod 755 $HOME/sccache_wrapper/sccache
SetEnvVar "PATH" "$HOME/sccache_wrapper:\$PATH"
}

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Call real sccache with original arguments
# sccache /opt/android/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-none ......
real_sccache=/usr/local/sccache/sccache
$real_sccache "$@"
retval=$?
if test $retval -ne 0
then
echo "Sccache command failed, re-try calling build tool directly"
"$@"
retval=$?
fi
exit $retval