Add system modules

This is the first step towards compiling with
EXPERIMENTAL_USE_OPENJDK9=true.

Bug: 63986449
Test: m EXPERIMENTAL_USE_OPENJDK9=true
Change-Id: I8ece7f6d27c2292f42bd18a0106b2bae2e7bed73
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 98fe24c..ded08c9 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -76,17 +76,28 @@
         ":android_icu4j_src_files",
         ":openjdk_lambda_stub_files",
     ],
+    openjdk9: {
+        srcs: ["luni/src/module/java/module-info.java"],
+        javacflags: ["--patch-module=java.base=."],
+    },
     java_resource_dirs: core_resource_dirs,
-    static_libs: ["android_icu4j_res"],
+    java_resources: [":android_icu4j_resources"],
 
     required: [
         "tzdata",
         "tzlookup.xml",
     ],
 
+    system_modules: "none",
+
     installable: false,
 }
 
+java_system_modules {
+    name: "core-all-system-modules",
+    libs: ["core-all"],
+}
+
 java_library {
     name: "core-oj",
     defaults: ["libcore_java_defaults"],
@@ -95,6 +106,10 @@
     srcs: [":openjdk_java_files"],
     java_resource_dirs: core_resource_dirs,
     libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
 
     notice: "ojluni/NOTICE",
 
@@ -115,9 +130,13 @@
         ":non_openjdk_java_files",
         ":android_icu4j_src_files",
     ],
-    static_libs: ["android_icu4j_res"],
+    java_resources: [":android_icu4j_resources"],
 
     libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
 
     required: [
         "tzdata",
@@ -137,9 +156,22 @@
     ],
 
     libs: ["core-all"],
+    system_modules: "core-all-system-modules",
+    openjdk9: {
+        javacflags: ["--patch-module=java.base=."],
+    },
 
     notice: "ojluni/NOTICE",
 
     installable: false,
     include_srcs: true,
 }
+
+java_system_modules {
+    name: "core-system-modules",
+    libs: [
+        "core-oj",
+        "core-libart",
+        "core-lambda-stubs",
+    ],
+}