Fix build failure when OUT_DIR is outside ANDROID_BUILD_TOP

Caused by use of --patch-module=java.base=. where . means current
directory, i.e. build top. When there are some sources outside the
current directory, such as generated stubs source from external/icu,
then it fails because sources outside are not patched in. Similar
behavior is seen when OUT_DIR_COMMON_BASE is outside the top directory.

Using patch_module: "java.base" causes Soong to add
  --patch-module=java.base=<paths to each source root>
Which means that it works correctly irrespective of where the sources
are.

Using an OUT_DIR outside top does increase the length of command lines,
presumably because it prevents paths being relativized against
ANDROID_BUILD_TOP. So, using a short OUT_DIR path is required otherwise
some targets fail with argument list too long errors. However, that
issue is orthogonal to this and only mentioned because it came up
during testing of this fix.

Bug: 142397121
Test: OUT_DIR=<path-outside-top> m java
Change-Id: Idb2826d58818cd33be8054418006bbbac513be5e
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 7425695..b1c4d59 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -209,9 +209,9 @@
 
     sdk_version: "none",
     system_modules: "none",
+    patch_module: "java.base",
     openjdk9: {
         srcs: ["luni/src/module/java/module-info.java"],
-        javacflags: ["--patch-module=java.base=."],
     },
 
     java_resources: core_resources,
@@ -266,9 +266,7 @@
 
     sdk_version: "none",
     system_modules: "core-all-system-modules",
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
 
     jacoco: {
         exclude_filter: [
@@ -312,9 +310,7 @@
 
     sdk_version: "none",
     system_modules: "core-all-system-modules",
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
 
     jacoco: {
         exclude_filter: [
@@ -370,9 +366,7 @@
 
     sdk_version: "none",
     system_modules: "core-all-system-modules",
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
 }
 
 //
@@ -416,9 +410,7 @@
 
     sdk_version: "none",
     system_modules: "core-all-system-modules",
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
 
     notice: "ojluni/NOTICE",
 
@@ -470,9 +462,7 @@
     hostdex: true,
     sdk_version: "none",
     system_modules: "core-all-system-modules",
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
     notice: "ojluni/NOTICE",
     installable: false,
     include_srcs: true,
@@ -644,7 +634,7 @@
     // code if it's declared to also be in java.base at
     // compile time.
     //
-    // For now, we use --patch-module to put all sources
+    // For now, we use patch_module to put all sources
     // and dependencies from this make target into java.base;
     // other source directories in this make target are in
     // packages not from java.base; if this becomes a problem
@@ -758,9 +748,7 @@
             "-Xep:MissingOverride:OFF",
         ],
     },
-    openjdk9: {
-        javacflags: ["--patch-module=java.base=."],
-    },
+    patch_module: "java.base",
     sdk_version: "none",
     system_modules: "none",
 }