Run test build: Create special HiddenApi shard.
Very few tests depend on hiddenapi so build them in their own shard.
This removes the hiddenapi dependency from all other shards,
which in turn removes the dependency on ART headers and C++ code.
Bug: 213297521
Test: ./art/test.py -b -r --host
Test: ./art/test.py -b -r --host -t 674-hiddenapi
Change-Id: I5d18d49b70bdaf9c3492ff4a82d32f7e9ba96873
diff --git a/test/Android.run-test.bp.py b/test/Android.run-test.bp.py
index 10714a6..d1e3027 100755
--- a/test/Android.run-test.bp.py
+++ b/test/Android.run-test.bp.py
@@ -51,6 +51,39 @@
}}
""".format(name=name, mode=mode, shard=shard)))
+ # Build all hiddenapi tests in their own shard.
+ # This removes the dependency on hiddenapi from all other shards,
+ # which in turn removes dependency on ART C++ source code.
+ name = "art-run-test-{mode}-data-shardHiddenApi".format(mode=mode)
+ names.append(name)
+ f.write(textwrap.dedent("""
+ java_genrule {{
+ name: "{name}-tmp",
+ out: ["{name}.zip"],
+ srcs: ["???-*hiddenapi*/**/*", "????-*hiddenapi*/**/*"],
+ defaults: ["art-run-test-{mode}-data-defaults"],
+ tools: ["hiddenapi"],
+ cmd: "$(location run_test_build.py) --out $(out) --mode {mode} " +
+ "--bootclasspath $(location :art-run-test-bootclasspath) " +
+ "--d8 $(location d8) " +
+ "--hiddenapi $(location hiddenapi) " +
+ "--jasmin $(location jasmin) " +
+ "--smali $(location smali) " +
+ "--soong_zip $(location soong_zip) " +
+ "--zipalign $(location zipalign) " +
+ "$(in)",
+ }}
+
+ // Install in the output directory to make it accessible for tests.
+ prebuilt_etc_host {{
+ name: "{name}",
+ defaults: ["art_module_source_build_prebuilt_defaults"],
+ src: ":{name}-tmp",
+ sub_dir: "art",
+ filename: "{name}.zip",
+ }}
+ """.format(name=name, mode=mode)))
+
f.write(textwrap.dedent("""
genrule_defaults {{
name: "art-run-test-{mode}-data-defaults",
@@ -65,7 +98,6 @@
],
tools: [
"d8",
- "hiddenapi",
"jasmin",
"smali",
"soong_zip",
@@ -74,7 +106,6 @@
cmd: "$(location run_test_build.py) --out $(out) --mode {mode} " +
"--bootclasspath $(location :art-run-test-bootclasspath) " +
"--d8 $(location d8) " +
- "--hiddenapi $(location hiddenapi) " +
"--jasmin $(location jasmin) " +
"--smali $(location smali) " +
"--soong_zip $(location soong_zip) " +