Merge "Add makefile targets for ojluni jaif-annotated source files."
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",
+    ],
+}
diff --git a/luni/src/module/java/module-info.java b/luni/src/module/java/module-info.java
new file mode 100644
index 0000000..acb4dc3
--- /dev/null
+++ b/luni/src/module/java/module-info.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+module java.base {
+    // oj
+    exports com.sun.net.ssl.internal.ssl;
+    exports com.sun.nio.file;
+    exports com.sun.security.cert.internal.x509;
+    exports java.awt.font;
+    exports java.beans;
+    exports java.io;
+    exports java.lang;
+    exports java.lang.annotation;
+    exports java.lang.invoke;
+    exports java.lang.ref;
+    exports java.lang.reflect;
+    exports java.net;
+    exports java.nio;
+    exports java.nio.channels;
+    exports java.nio.channels.spi;
+    exports java.nio.charset;
+    exports java.nio.charset.spi;
+    exports java.nio.file;
+    exports java.nio.file.attribute;
+    exports java.nio.file.spi;
+    exports java.security;
+    exports java.security.acl;
+    exports java.security.cert;
+    exports java.security.interfaces;
+    exports java.security.spec;
+    exports java.sql;
+    exports java.text;
+    exports java.time;
+    exports java.time.chrono;
+    exports java.time.format;
+    exports java.time.temporal;
+    exports java.time.zone;
+    exports java.util;
+    exports java.util.concurrent;
+    exports java.util.concurrent.atomic;
+    exports java.util.concurrent.locks;
+    exports java.util.function;
+    exports java.util.jar;
+    exports java.util.logging;
+    exports java.util.prefs;
+    exports java.util.regex;
+    exports java.util.stream;
+    exports java.util.zip;
+    exports javax.crypto;
+    exports javax.crypto.interfaces;
+    exports javax.crypto.spec;
+    exports javax.net;
+    exports javax.net.ssl;
+    exports javax.security.auth;
+    exports javax.security.auth.callback;
+    exports javax.security.auth.login;
+    exports javax.security.auth.x500;
+    exports javax.security.cert;
+    exports javax.sql;
+    exports jdk.net;
+    exports sun.invoke.util;
+    exports sun.misc;
+    exports sun.net;
+    exports sun.net.ftp;
+    exports sun.net.ftp.impl;
+    exports sun.net.spi;
+    exports sun.net.spi.nameservice;
+    exports sun.net.util;
+    exports sun.net.www;
+    exports sun.net.www.protocol.file;
+    exports sun.net.www.protocol.ftp;
+    exports sun.net.www.protocol.jar;
+    exports sun.nio;
+    exports sun.nio.ch;
+    exports sun.nio.cs;
+    exports sun.nio.fs;
+    exports sun.reflect;
+    exports sun.reflect.misc;
+    exports sun.security.action;
+    exports sun.security.jca;
+    exports sun.security.pkcs;
+    exports sun.security.provider;
+    exports sun.security.provider.certpath;
+    exports sun.security.timestamp;
+    exports sun.security.util;
+    exports sun.security.x509;
+    exports sun.util;
+    exports sun.util.calendar;
+    exports sun.util.locale;
+    exports sun.util.locale.provider;
+    exports sun.util.logging;
+    exports sun.util.resources;
+    // non-oj
+    exports android.system;
+    exports android.icu.impl;
+    exports android.icu.math;
+    exports android.icu.text;
+    exports android.icu.util;
+    exports dalvik.annotation.optimization;
+    exports dalvik.system;
+    exports java.math;
+    exports javax.xml.parsers;
+    exports libcore.io;
+    exports libcore.icu;
+    exports libcore.net.http;
+    exports libcore.reflect;
+    exports libcore.util;
+}