summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Sorin Basca <sorinbasca@google.com> 2021-12-21 07:37:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-12-21 07:37:46 +0000
commit55f84a74c5b824f9ff5e5b320fc8fc598f25f46d (patch)
treecd184b06892f89795ee54be4f3feeb5d1ad27041 /java/base.go
parent1778546f7a861884e83b4d1593c8e5ea796fd708 (diff)
parent9347ae3ba06363a6a8268d6e587f7dcff4e76c38 (diff)
Merge "Adding option to include sources only for Java 11 builds"
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/java/base.go b/java/base.go
index c45ef641e..7cd71a270 100644
--- a/java/base.go
+++ b/java/base.go
@@ -122,6 +122,14 @@ type CommonProperties struct {
Javacflags []string
}
+ Openjdk11 struct {
+ // List of source files that should only be used when passing -source 1.9 or higher
+ Srcs []string `android:"path"`
+
+ // List of javac flags that should only be used when passing -source 1.9 or higher
+ 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
@@ -959,6 +967,10 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
if flags.javaVersion.usesJavaModules() {
j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk9.Srcs...)
}
+ if ctx.Config().TargetsJava11() {
+ j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk11.Srcs...)
+ }
+
srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
if hasSrcExt(srcFiles.Strings(), ".proto") {
flags = protoFlags(ctx, &j.properties, &j.protoProperties, flags)