Skip to content

Commit 06ca77f

Browse files
committed
Minor android 8 changes.
1 parent 7c76477 commit 06ca77f

File tree

2 files changed

+116
-10
lines changed

2 files changed

+116
-10
lines changed

docker/android-system.sh

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# 6.0: 23 (tested at NDK r21dm 6.0.1_r81)
1111
# 7.0: 24 (tested at NDK r21d, 7.0.0_r36)
1212
# 7.1: 25 (tested at NDK r21d, 7.1.2_r39, not supported)
13-
# 8.0: 26
14-
# 8.1: 27
13+
# 8.0: 26 (tested at NDK r21d, 8.0.0_r51) TODO
14+
# 8.1: 27 (tested at NDK r21d, 8.1.0_r81) TODO
1515
# 9.0: 28 (tested at NDK r21d and r25b)
1616
# 10.0: 29
1717
# 11.0: 30
@@ -91,10 +91,9 @@ main() {
9191
7)
9292
android_repo_v7
9393
;;
94-
# 8)
95-
# #android_repo_v8
96-
# # TODO(ahuszagh) Here.
97-
# ;;
94+
8)
95+
android_repo_v8
96+
;;
9897
9)
9998
android_repo_v9
10099
;;
@@ -353,6 +352,75 @@ android_repo_v7() {
353352
ANDROID_MAJOR=7 python3 /remove_android_tests.py
354353
}
355354

355+
# TODO: tested on 8.0.0_r51 (SDK 26)
356+
# TODO: tested on 8.1.0_r81 (SDK 2278.0.0_r516)
357+
android_repo_v8() {
358+
sync bionic
359+
sync build
360+
sync build/make
361+
sync build/blueprint
362+
sync build/soong
363+
sync external/boringssl
364+
sync external/clang
365+
sync external/compiler-rt
366+
sync external/jemalloc
367+
sync external/libcxx
368+
sync external/libcxxabi
369+
sync external/libnl
370+
sync external/libunwind
371+
sync external/libunwind_llvm
372+
sync external/llvm
373+
sync external/lzma
374+
sync external/mksh
375+
sync external/pcre
376+
sync external/selinux
377+
sync external/zlib
378+
sync hardware/interfaces
379+
sync hardware/libhardware
380+
sync frameworks/native
381+
sync libnativehelper
382+
sync prebuilts/build-tools
383+
sync prebuilts/clang/host/linux-x86
384+
sync prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8
385+
sync prebuilts/go/linux-x86
386+
# needed for libnativehelper_compat_libc++
387+
sync prebuilts/ndk
388+
sync system/core
389+
sync system/libfmq
390+
sync system/libhidl
391+
sync system/libhwbinder
392+
sync system/media
393+
sync system/tools/hidl
394+
# TODO(ahuszagh) Android 8 is a mess
395+
396+
# avoid build tests
397+
rm bionic/linker/tests/Android.mk
398+
rm bionic/tests/Android.mk
399+
rm bionic/tests/Android.bp
400+
rm bionic/benchmarks/Android.bp
401+
rm bionic/tests/libs/Android.bp
402+
rm hardware/interfaces/tests/Android.bp
403+
rm system/tools/hidl/test/Android.bp
404+
# we don't need the relocation packer, and removing
405+
# the unittests from it is a bit of work.
406+
rm bionic/tools/relocation_packer/Android.bp
407+
rm bionic/tools/relocation_packer/Android.mk
408+
409+
# extra utilities we don't need
410+
rm frameworks/native/libs/vr/Android.bp
411+
rm frameworks/native/services/Android.bp
412+
rm frameworks/native/services/*/Android.bp
413+
rm hardware/interfaces/automotive/Android.bp
414+
rm hardware/interfaces/camera/Android.bp
415+
rm system/libhidl/transport/Android.bp
416+
rm system/media/alsa_utils/Android.bp
417+
rm system/media/audio_route/Android.bp
418+
rm system/media/audio_utils/tests/Android.bp
419+
# TODO(ahuszagh) Need to remove the tests here
420+
421+
ANDROID_MAJOR=8 python3 /remove_android_tests.py
422+
}
423+
356424
# tested on 9.0.0_r1 (SDK 28)
357425
android_repo_v9() {
358426
sync art

docker/remove_android_tests.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,59 @@ def windows(sequence, count):
1313
for i in range(len(sequence) - count + 1):
1414
yield sequence[i:i + count]
1515

16-
def process_blueprint(contents):
16+
def process_blueprint(contents, path):
17+
gtest_paths = ['system/core/libmetricslogger/Android.bp']
18+
subdir_test_paths = [
19+
'system/media/audio_utils/Android.bp',
20+
'system/tools/hidl/Android.bp',
21+
]
22+
subdir_transport_paths = [
23+
'system/libhidl/Android.bp',
24+
]
25+
remove_gtest = (
26+
os.environ.get('ANDROID_MAJOR') == '8' and
27+
any(i in path for i in gtest_paths)
28+
)
29+
remove_subdir_test = (
30+
os.environ.get('ANDROID_MAJOR') == '8' and
31+
any(i in path for i in subdir_test_paths)
32+
)
33+
remove_subdir_transport = (
34+
os.environ.get('ANDROID_MAJOR') == '8' and
35+
any(i in path for i in subdir_transport_paths)
36+
)
37+
1738
result = []
1839
in_match = False
1940
for line in contents.splitlines():
20-
if re.match(r'^cc_test\w*\s*{', line) or re.match(r'^java_test\w*\s*{', line):
41+
if re.match(r'^cc_test\w*\s*{', line):
42+
assert not in_match
43+
in_match = True
44+
elif re.match(r'^java_test\w*\s*{', line):
45+
assert not in_match
46+
in_match = True
47+
elif re.match(r'^cc_benchmark\w*\s*{', line):
2148
assert not in_match
2249
in_match = True
2350
elif in_match and line.startswith('}'):
2451
in_match = False
52+
elif not in_match and line.startswith(' name: "memtrack_test",'):
53+
# bug fix for Android 8.0
54+
assert not in_match
55+
result.pop()
56+
in_match = True
57+
elif remove_gtest and not in_match and 'libgtest' in line:
58+
pass
59+
elif remove_subdir_test and not in_match and (line.startswith(' "test",') or line.startswith('subdirs = ["tests"]')):
60+
pass
61+
elif remove_subdir_transport and not in_match and (line.startswith(' "transport",') or line.startswith('subdirs = ["transport"]')):
62+
pass
2563
elif not in_match:
2664
result.append(line)
2765

2866
return '\n'.join(result)
2967

30-
def process_makefile(contents):
68+
def process_makefile(contents, path):
3169
def is_test(title):
3270
return 'test' in title.lower()
3371

@@ -58,7 +96,7 @@ def process_file(path, process_contents):
5896
with open(path + '.bak', 'w') as file:
5997
file.write(contents)
6098
with open(path, 'w') as file:
61-
output = process_contents(contents)
99+
output = process_contents(contents, path)
62100
file.write(output)
63101

64102
def main():

0 commit comments

Comments
 (0)