"Move core-icu4j into I18n APEX" Attempt 2
This reverts commit 864e57d545eba19d25ddd1bd8dceee455f9c4b6f.
Reland https://r.android.com/1294615
Bug: 138994281
Test: treehugger
Change-Id: Ia71f57fc1e0c7bbc40652cd01200b2e795f6a146
diff --git a/src/vogar/android/AndroidSdk.java b/src/vogar/android/AndroidSdk.java
index 464549f..45f11bb 100644
--- a/src/vogar/android/AndroidSdk.java
+++ b/src/vogar/android/AndroidSdk.java
@@ -188,17 +188,31 @@
String jar = jarNames[i];
File file;
if (modeId.isHost()) {
- jar = jar.equals("conscrypt-hostdex") ? "conscrypt-host-hostdex" : jar;
+ if ("conscrypt-hostdex".equals(jar)) {
+ jar = "conscrypt-host-hostdex";
+ } else if ("core-icu4j-hostdex".equals(jar)) {
+ jar = "core-icu4j-host-hostdex";
+ }
file = new File(String.format(pattern, jar));
} else {
- if (jar.equals("conscrypt")) {
- file = new File(String.format(pattern, jar + ".com.android.conscrypt"));
- if (!file.exists()) {
- // With unbundled ART, the intermediate directory is under conscrypt.
- file = new File(String.format(pattern, jar));
- }
+ final String apexPackage;
+ // With unbundled ART, the intermediate directory storing the jar file
+ // outside ART APEX doesn't contain the apex package name.
+ final boolean tryNonApexIntermediate;
+ if ("conscrypt".equals(jar)) {
+ apexPackage = "com.android.conscrypt";
+ tryNonApexIntermediate = true;
+ } else if ("core-icu4j".equals(jar)) {
+ apexPackage = "com.android.i18n";
+ tryNonApexIntermediate = true;
} else {
- file = new File(String.format(pattern, jar + ".com.android.art.testing"));
+ apexPackage = "com.android.art.testing";
+ tryNonApexIntermediate = false;
+ }
+
+ file = new File(String.format(pattern, jar + "." + apexPackage));
+ if (tryNonApexIntermediate && !file.exists()) {
+ file = new File(String.format(pattern, jar));
}
}
compilationClasspath[i] = file;