Merge "Separate icu4j from core-libart"
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index fc07815..e1d8145 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -99,7 +99,6 @@
     ],
     srcs: [
         ":non_openjdk_java_files",
-        ":android_icu4j_src_files",
     ],
 }
 
@@ -109,7 +108,6 @@
     name: "core_libart_api_files",
     srcs: [
         ":non_openjdk_javadoc_files",
-        ":android_icu4j_src_files",
     ],
 }
 
@@ -122,6 +120,7 @@
         "//frameworks/base",
     ],
     srcs: [
+        ":android_icu4j_src_files",
         ":core_oj_api_files",
         ":core_libart_api_files",
         ":conscrypt_public_api_files",
@@ -142,6 +141,7 @@
         "//libcore:__subpackages__",
     ],
     srcs: [
+        ":android_icu4j_src_files",
         ":apache-xml_api_files",
         ":bouncycastle_java_files",
         ":conscrypt_java_files",
@@ -192,6 +192,7 @@
     defaults: ["libcore_java_defaults"],
 
     srcs: [
+        ":android_icu4j_src_files",
         ":core_oj_java_files",
         ":core_libart_java_files",
         ":openjdk_lambda_stub_files",
@@ -225,7 +226,7 @@
 // core-libart as well as the lambda stubs needed to compile Java lambda code.
 // It does not contain other parts of core library like conscrypt, bouncycastle,
 // etc. This system_modules definition is used to bootstrap compilation for
-// other parts of the core library like core-oj, core-libart, conscrypt,
+// other parts of the core library like core-oj, core-libart, core-icu4j, conscrypt,
 // bouncycastle, etc.
 //
 // If you want to compile against the entire core library implementation, for
@@ -280,8 +281,8 @@
 }
 
 // Contains parts of core library not associated with OpenJDK. Contains not
-// just java.*, javax.* code but also android.icu.*, android.system.* and
-// various internal libcore.* packages.
+// just java.*, javax.* code but also android.system.* and various internal
+// libcore.* packages.
 java_library {
     name: "core-libart",
     visibility: [
@@ -296,7 +297,6 @@
     hostdex: true,
 
     srcs: [":core_libart_java_files"],
-    static_libs: ["android_icu4j_resources_lib"],
     java_version: "1.9",
 
     sdk_version: "none",
@@ -329,6 +329,28 @@
     },
 }
 
+java_library {
+    name: "core-icu4j",
+    visibility: [
+        "//art/build/apex",
+        "//external/robolectric-shadows",
+        "//frameworks/layoutlib",
+    ],
+    defaults: ["libcore_java_defaults"],
+    installable: true,
+    hostdex: true,
+
+    srcs: [":android_icu4j_src_files"],
+    static_libs: ["android_icu4j_resources_lib"],
+
+    sdk_version: "none",
+    libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
+}
+
 // Provided solely to contribute information about which hidden parts of the
 // core-oj API are used by apps.
 //
@@ -367,7 +389,7 @@
 }
 
 //
-// Guaranteed unstripped versions of core-oj and core-libart.
+// Guaranteed unstripped versions of core-icu4j, core-oj and core-libart.
 //
 // The build system may or may not strip the core-oj and core-libart jars,
 // but these will not be stripped. See b/24535627.
@@ -402,6 +424,19 @@
     notice: "ojluni/NOTICE",
 }
 
+java_library {
+    name: "core-icu4j-testdex",
+    installable: true,
+    static_libs: ["core-icu4j"],
+    sdk_version: "none",
+    libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    dxflags: ["--core-library"],
+    dex_preopt: {
+        enabled: false,
+    },
+}
+
 java_defaults {
     name: "core_lambda_stubs_defaults",
     defaults: ["libcore_java_defaults"],
@@ -490,6 +525,7 @@
     libs: [
         "core-oj",
         "core-libart",
+        "core-icu4j",
         "bouncycastle",
         "conscrypt",
         "okhttp",
diff --git a/mmodules/intracoreapi/Android.bp b/mmodules/intracoreapi/Android.bp
index fab9d83..dc0099a 100644
--- a/mmodules/intracoreapi/Android.bp
+++ b/mmodules/intracoreapi/Android.bp
@@ -71,13 +71,14 @@
     libs: ["core.intra.stubs"],
 }
 
-// A rule that checks we can build core-libart and core-oj using only the source
-// for core-libart and core-oj and the APIs in core-intra-stubs. This proves we
-// don't actually depend on things from (for example) conscrypt we haven't added
-// to the intra-core API.
+// A rule that checks we can build core-icu4j, core-libart and core-oj using only
+// the source for core-libart and core-oj and the APIs in core-intra-stubs.
+// This proves we don't actually depend on things from (for example) conscrypt we
+// haven't added to the intra-core API.
 java_library {
     name: "core-libart-oj.depscheck",
     srcs: [
+        ":android_icu4j_src_files",
         ":core_libart_java_files",
         ":core_oj_java_files",
     ],