Skip to content

Commit ad1167a

Browse files
authored
Update install_android.sh
1 parent 879b94f commit ad1167a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.ci/docker/common/install_android.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,23 @@ install_sdk() {
7676
yes | /opt/cmdline-tools/bin/sdkmanager --sdk_root="${SDK_INSTALLATION_DIR}" --install "tools"
7777
}
7878

79+
function write_android_sccache_stub() {
80+
BINARY=$1
81+
mv "/opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/$1" "/opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/.$1"
82+
cat >"/opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/$1" <<EOF
83+
#!/bin/sh
84+
if [ command -v sccache && \$(env -u LD_PRELOAD ps -p \$PPID -o comm=) != sccache ]; then
85+
exec sccache /opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/.$1 "\$@"
86+
else
87+
exec /opt/ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/.$1 "\$@"
88+
fi
89+
EOF
90+
chmod a+x "/opt/toolchains/llvm/prebuilt/linux-x86_64/bin/${BINARY}"
91+
}
92+
7993
install_prerequiresites
8094
install_ndk
8195
install_cmdtools
8296
install_sdk
97+
write_android_sccache_stub clang++
98+
write_android_sccache_stub clang

0 commit comments

Comments
 (0)