Skip to content

Commit f07b32a

Browse files
committed
Bug fixes for Android major versions.
1 parent 031fcfd commit f07b32a

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

docker/android-system.sh

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,24 @@ set -euo pipefail
99
main() {
1010
local arch="${1}"
1111
local version="${ANDROID_VERSION}"
12+
local major_version="${version//.*/}"
1213
local gcc_version=4.9
13-
local glibc_version=glibc2.15-4.8
14+
local glibc_version
15+
case "${major_version}" in
16+
4)
17+
glibc_version=glibc2.7-4.6
18+
;;
19+
5|6|7|8|9)
20+
glibc_version=glibc2.15-4.8
21+
;;
22+
10|11|12|13)
23+
glibc_version=glibc2.17-4.8
24+
;;
25+
*)
26+
# current master branch as of 9/15/2022
27+
glibc_version=glibc2.19-4.9
28+
;;
29+
esac
1430
# FIXME: android is currently migrating from make to soong, so
1531
# `platform/build/make` may be missing from a future version of
1632
# android. version-gate this when make is removed.
@@ -70,7 +86,9 @@ EOF
7086
python3 ./repo sync -c build/make
7187
fi
7288
python3 ./repo sync -c build/blueprint
73-
python3 ./repo sync -c build/soong
89+
if [[ "${major_version}" -ge 7 ]]; then
90+
python3 ./repo sync -c build/soong
91+
fi
7492
python3 ./repo sync -c external/clang
7593
python3 ./repo sync -c external/compiler-rt
7694
python3 ./repo sync -c external/elfutils
@@ -82,9 +100,13 @@ EOF
82100
python3 ./repo sync -c external/llvm
83101
python3 ./repo sync -c external/lzma
84102
python3 ./repo sync -c external/mksh
85-
python3 ./repo sync -c external/safe-iop
86-
python3 ./repo sync -c external/valgrind
87-
python3 ./repo sync -c external/vixl
103+
if [[ "${major_version}" -le 9 ]]; then
104+
python3 ./repo sync -c external/safe-iop
105+
python3 ./repo sync -c external/valgrind
106+
fi
107+
if [[ "${major_version}" -ge 5 ]]; then
108+
python3 ./repo sync -c external/vixl
109+
fi
88110
python3 ./repo sync -c external/zlib
89111
python3 ./repo sync -c frameworks/hardware/interfaces
90112
python3 ./repo sync -c hardware/interfaces
@@ -93,12 +115,16 @@ EOF
93115
python3 ./repo sync -c prebuilts/clang/host/linux-x86
94116
python3 ./repo sync -c prebuilts/clang-tools
95117
python3 ./repo sync -c "prebuilts/gcc/linux-x86/host/x86_64-linux-${glibc_version}"
96-
python3 ./repo sync -c prebuilts/go/linux-x86
118+
if [[ "${major_version}" -ge 7 ]]; then
119+
python3 ./repo sync -c prebuilts/go/linux-x86
120+
fi
97121
python3 ./repo sync -c prebuilts/misc
98122
python3 ./repo sync -c prebuilts/sdk
99123
python3 ./repo sync -c system/core
100-
python3 ./repo sync -c system/libhidl
101-
python3 ./repo sync -c system/tools/hidl
124+
if [[ "${major_version}" -ge 8 ]]; then
125+
python3 ./repo sync -c system/libhidl
126+
python3 ./repo sync -c system/tools/hidl
127+
fi
102128

103129
case "${arch}" in
104130
arm)
@@ -116,14 +142,16 @@ EOF
116142
;;
117143
esac
118144

119-
# avoid build tests
145+
# avoid build tests. these can fail in newer versions, so allow failures.
146+
set +e
120147
rm bionic/linker/tests/Android.mk
121148
rm bionic/tests/Android.mk
122149
rm bionic/tests/Android.bp
123150
rm bionic/benchmarks/Android.bp
124151
rm bionic/tests/libs/Android.bp
125152
rm bionic/tests/headers/Android.bp
126153
rm bionic/tests/headers/posix/Android.bp
154+
set -e
127155

128156
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_debug/Android.bp
129157
sed -i -z -e 's/cc_test {.*}//g' bionic/libc/malloc_hooks/Android.bp

0 commit comments

Comments
 (0)