summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2018-08-15 20:21:55 -0700
committerColin Cross <ccross@android.com>2018-08-16 16:14:09 -0700
commit81440083603fc3723f56f2d5da08d9759e487fde (patch)
tree69c32ad5ebcd0a2c4a4488aaa193cd1399291a18 /java/java.go
parent3063b78ea57a4c206996332c3eb5cb79f65a0c92 (diff)
Support patch_module in java modules
A few tests that have classes in the java.base module need to pass --patch-module=java.base=<classpath> to javac. Test: m checkbuild Change-Id: I246bad92dcde976969b064aace5e2856e2bac971
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/java/java.go b/java/java.go
index 43af2c6b6..c9759d737 100644
--- a/java/java.go
+++ b/java/java.go
@@ -135,6 +135,15 @@ type CompilerProperties struct {
Javacflags []string
}
+ // When compiling language level 9+ .java code in packages that are part of
+ // a system module, patch_module names the module that your sources and
+ // dependencies should be patched into. The Android runtime currently
+ // doesn't implement the JEP 261 module system so this option is only
+ // supported at compile time. It should only be needed to compile tests in
+ // packages that exist in libcore and which are inconvenient to move
+ // elsewhere.
+ Patch_module *string
+
Jacoco struct {
// List of classes to include for instrumentation with jacoco to collect coverage
// information at runtime when building with coverage enabled. If unset defaults to all
@@ -899,11 +908,6 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
// disk and memory usage.
javacFlags = append(javacFlags, "-g:source,lines")
}
- if len(javacFlags) > 0 {
- // optimization.
- ctx.Variable(pctx, "javacFlags", strings.Join(javacFlags, " "))
- flags.javacFlags = "$javacFlags"
- }
if ctx.Config().RunErrorProne() {
if config.ErrorProneClasspath == nil {
@@ -955,6 +959,11 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
}
}
+ if j.properties.Patch_module != nil && ctx.Config().TargetOpenJDK9() {
+ patchClasspath := ".:" + flags.classpath.FormJavaClassPath("")
+ javacFlags = append(javacFlags, "--patch-module="+String(j.properties.Patch_module)+"="+patchClasspath)
+ }
+
// systemModules
if deps.systemModules != nil {
flags.systemModules = append(flags.systemModules, deps.systemModules)
@@ -968,6 +977,12 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
flags.aidlFlags = "$aidlFlags"
}
+ if len(javacFlags) > 0 {
+ // optimization.
+ ctx.Variable(pctx, "javacFlags", strings.Join(javacFlags, " "))
+ flags.javacFlags = "$javacFlags"
+ }
+
return flags
}