summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Jaewoong Jung <jungjw@google.com> 2018-12-12 09:01:34 -0800
committer Jaewoong Jung <jungjw@google.com> 2019-01-04 15:37:20 +0000
commit38e4fb2ce65fb3503b527f1457587c6c06c15335 (patch)
tree0cf2a2f09255e8b622eb13f7e0d5bb72f3f6551c /java/java.go
parent9b84d34be3c267616951c442a8fc374774841ec4 (diff)
Add buildDir to java patch-module paths.
This solves a problem where javac fails to find patch-module targets when a build diretory is not under the project root. Bug: 117770838 Test: java_test.go + manual build Change-Id: If70d0d388a3f6c87b3f78a927df2063616d50c8a
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/java/java.go b/java/java.go
index 71967a867..c02ccd347 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1011,8 +1011,15 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
}
if j.properties.Patch_module != nil && flags.javaVersion == "1.9" {
- patchClasspath := ".:" + flags.classpath.FormJavaClassPath("")
- javacFlags = append(javacFlags, "--patch-module="+String(j.properties.Patch_module)+"="+patchClasspath)
+ // Manually specify build directory in case it is not under the repo root.
+ // (javac doesn't seem to expand into symbolc links when searching for patch-module targets, so
+ // just adding a symlink under the root doesn't help.)
+ patchPaths := ".:" + ctx.Config().BuildDir()
+ classPath := flags.classpath.FormJavaClassPath("")
+ if classPath != "" {
+ patchPaths += ":" + classPath
+ }
+ javacFlags = append(javacFlags, "--patch-module="+String(j.properties.Patch_module)+"="+patchPaths)
}
// systemModules