summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
authorJingwen Chen <jingwen@google.com>2020-10-30 01:01:35 -0400
committerJingwen Chen <jingwen@google.com>2020-11-02 17:49:57 -0500
commit5136a6e5aa5b8e9cb2705e81ab587ae8cba6ab5c (patch)
treece4592cf9d6b8b670d06bd98d613a8f007213ec4 /java/java_test.go
parente83dea5aac2c307441af85c2ef5bc744bc015326 (diff)
Add ctx.ModuleDir and top level module dirs of input sources to JDK9
--patch-module lookup. javac --patch-module accepts a list of directories and/or jars for JDK9 module patching (see bug for more details). In Bazel-Ninja execution, Bazel executes the javac action in its own execution root working directory, unlike Ninja, which works in the Android top level directory. The Bazel execution root is formed of a symlink forest of top level directories. This symlink forest is a problem for javac because it doesn't traverse into symlinks. To support Bazel executing these javac actions, we explicitly encode the module directory, and the top level directory of any other source file inputs into the --patch-module javac flag. For example, the "core-all" libcore module compiles into `java.base`, and depends on filegroups outside of `libcore` (`tools`). This CL adds `tools` to the --patch-module lookup dir, on top of `libcore`. See java_test.go for more details. Bug: 150878007 Fixes: 150878007 Test: m Test: bazel build droid (aosp_flame) Change-Id: Id95b0a9a675fc75678f7b5e600344b4403f0c518
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/java/java_test.go b/java/java_test.go
index cdb437538..6c0a90856 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2046,7 +2046,14 @@ func TestPatchModule(t *testing.T) {
java_library {
name: "baz",
- srcs: ["c.java"],
+ srcs: [
+ "c.java",
+ // Tests for b/150878007
+ "dir/d.java",
+ "dir2/e.java",
+ "dir2/f.java",
+ "nested/dir/g.java"
+ ],
patch_module: "java.base",
}
`
@@ -2055,7 +2062,8 @@ func TestPatchModule(t *testing.T) {
checkPatchModuleFlag(t, ctx, "foo", "")
expected := "java.base=.:" + buildDir
checkPatchModuleFlag(t, ctx, "bar", expected)
- expected = "java.base=" + strings.Join([]string{".", buildDir, moduleToPath("ext"), moduleToPath("framework")}, ":")
+ expected = "java.base=" + strings.Join([]string{
+ ".", buildDir, "dir", "dir2", "nested", moduleToPath("ext"), moduleToPath("framework")}, ":")
checkPatchModuleFlag(t, ctx, "baz", expected)
})
}