summaryrefslogtreecommitdiff
path: root/test/etc/default-build
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-02-09 16:50:44 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-02-15 14:58:26 +0000
commitdd0a65de714b1673c802da170e6b61ed4f2afac0 (patch)
tree888e8116f66a69def2dfd62c1053c87944932c2c /test/etc/default-build
parent7116f80c7caaebba8d45be72d28d44a8d8a6c632 (diff)
Allow more cross-referencing between run-test sources.
Allow all primary sources (src/, src-multidex/, src-aotex/, src-bcpex/, src-ex/) to reference each other and jasmin*/ classes. Allow all replacement sources (src-art/, src2/, src-ex2/) to reference the above classes. The src/ folder needs to exist for this to take place, so we moved src-art/ files to src/ in some tests. As we're now compiling more files together into the `-cp` folder "classes-tmp-all", classes defined in both src/ and src-ex/ would clash, so we moved the src-ex/ version into src-ex2/. Test: testrunner.py --host --optimizing --jvm Test: testrunner.py --target --optimizing Bug: 203171409 Change-Id: Ic890038b273f9ed7a99313f8d94323a2b612af43
Diffstat (limited to 'test/etc/default-build')
-rwxr-xr-xtest/etc/default-build84
1 files changed, 38 insertions, 46 deletions
diff --git a/test/etc/default-build b/test/etc/default-build
index 070293057e..c2c0b6a606 100755
--- a/test/etc/default-build
+++ b/test/etc/default-build
@@ -252,20 +252,39 @@ def has_multidex():
return HAS_SRC_MULTIDEX or HAS_JASMIN_MULTIDEX or HAS_SMALI_MULTIDEX
+def add_to_cp_args(old_cp_args, path):
+ if len(old_cp_args) == 0:
+ return ["-cp", path]
+ else:
+ return ["-cp", old_cp_args[1] + ":" + path]
+
+
src_tmp_all = []
-if HAS_SRC and (HAS_SRC_MULTIDEX or HAS_SRC_AOTEX or HAS_SRC_BCPEX):
- # To allow circular references, compile src/, src-multidex/, src-aotex/ and
- # src-bcpex/ together and pass the output as class path argument.
- # Replacement sources in src-art/ and src2 can replace symbols used by the
- # other src-* sources we compile here but everything needed to compile the
- # other src-* sources should be present in src/.
+
+if HAS_JASMIN:
+ make_jasmin("jasmin_classes", find("jasmin", "*.j"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "jasmin_classes")
+
+if HAS_JASMIN_MULTIDEX:
+ make_jasmin("jasmin_classes2", find("jasmin-multidex", "*.j"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "jasmin_classes2")
+
+if HAS_SRC and (HAS_SRC_MULTIDEX or HAS_SRC_AOTEX or HAS_SRC_BCPEX or
+ HAS_SRC_EX or HAS_SRC_ART or HAS_SRC2 or HAS_SRC_EX2):
+ # To allow circular references, compile src/, src-multidex/, src-aotex/,
+ # src-bcpex/, src-ex/ together and pass the output as class path argument.
+ # Replacement sources in src-art/, src2/ and src-ex2/ can replace symbols
+ # used by the other src-* sources we compile here but everything needed to
+ # compile the other src-* sources should be present in src/ (and jasmin*/).
os.makedirs("classes-tmp-all")
- javac_with_bootclasspath(["-implicit:none", "-d", "classes-tmp-all"] +
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-tmp-all"] +
find("src", "*.java") +
find("src-multidex", "*.java") +
find("src-aotex", "*.java") +
- find("src-bcpex", "*.java"))
- src_tmp_all = ["-cp", "classes-tmp-all"]
+ find("src-bcpex", "*.java") +
+ find("src-ex", "*.java"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "classes-tmp-all")
if HAS_SRC_AOTEX:
os.makedirs("classes-aotex")
@@ -309,7 +328,8 @@ if HAS_SRC_MULTIDEX:
if HAS_SRC2:
os.makedirs("classes", exist_ok=True)
- javac_with_bootclasspath(["-classpath", "classes", "-d", "classes"] +
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes"] +
find("src2", "*.java"))
# If the classes directory is not-empty, package classes in a DEX file.
@@ -320,7 +340,6 @@ if find("classes", "*"):
if HAS_JASMIN:
# Compile Jasmin classes as if they were part of the classes.dex file.
- make_jasmin("jasmin_classes", find("jasmin", "*.j"))
if NEED_DEX:
make_dex("jasmin_classes")
make_dexmerge("classes.dex", "jasmin_classes.dex")
@@ -342,8 +361,6 @@ if HAS_SMALI and NEED_DEX:
# Compile Jasmin classes in jasmin-multidex as if they were part of
# the classes2.jar
if HAS_JASMIN_MULTIDEX:
- make_jasmin("jasmin_classes2", find("jasmin-multidex", "*.j"))
-
if NEED_DEX:
make_dex("jasmin_classes2")
make_dexmerge("classes2.dex", "jasmin_classes2.dex")
@@ -362,40 +379,15 @@ if HAS_SMALI_MULTIDEX and NEED_DEX:
# Merge smali_classes2.dex into classes2.dex
make_dexmerge("classes2.dex", "smali_classes2.dex")
-if HAS_SRC_EX or HAS_SRC_EX2:
- # Build src-ex into classes-ex.
- # Includes 'src', 'src-art' and 'jasmin' source when compiling classes-ex,
- # but exclude their .class files.
- src_tmp_for_ex = []
- if HAS_SRC or HAS_SRC_ART or HAS_JASMIN:
- os.makedirs("classes-tmp-for-ex", exist_ok=True)
- src_tmp_for_ex = ["-cp", "classes-tmp-for-ex"]
- if HAS_SRC and HAS_SRC_MULTIDEX:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src", "*.java") +
- find("src-multidex", "*.java"))
- elif HAS_SRC:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src", "*.java"))
- elif HAS_SRC_MULTIDEX:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src-multidex", "*.java"))
- if HAS_SRC_ART:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src-art", "*.java"))
- if HAS_JASMIN:
- make_jasmin("classes-tmp-for-ex", find("jasmin", "*.j"))
+if HAS_SRC_EX:
os.makedirs("classes-ex", exist_ok=True)
- if HAS_SRC_EX:
- javac_with_bootclasspath(["-d", "classes-ex"] + src_tmp_for_ex +
- find("src-ex", "*.java"))
- if not src_tmp_for_ex:
- src_tmp_for_ex = ["-cp", "classes-ex"]
- else:
- src_tmp_for_ex[-1] += ":classes-ex"
- if HAS_SRC_EX2:
- javac_with_bootclasspath(["-d", "classes-ex"] + src_tmp_for_ex +
- find("src-ex2", "*.java"))
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-ex"] + find("src-ex", "*.java"))
+
+if HAS_SRC_EX2:
+ os.makedirs("classes-ex", exist_ok=True)
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-ex"] + find("src-ex2", "*.java"))
if path.exists("classes-ex") and NEED_DEX:
make_dex("classes-ex")