kotlinc: Always pass -jvm-target 1.8
AOSP's current version of kotlinc only supports -jvm-target
1.8 or 1.6. Previously, we were passing the javaVersion
(the value passed to javac -target) but that would fail if
javaVersion was eg. 1.9.
This CL changes the kotlinc invocation to always pass
-jvm-target 1.8, regardless of javaVersion.
Bug: 69160377
Test: Treehugger
Change-Id: Ib12a8c2afbe908319513861a5380e70bf09d0be0
diff --git a/java/builder.go b/java/builder.go
index d2e02fd..4be3b04 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -65,7 +65,7 @@
// maximum number of input files, especially on darwin.
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
`${config.KotlincCmd} $classpath $kotlincFlags ` +
- `-jvm-target $javaVersion -d $outDir $in && ` +
+ `-jvm-target $kotlinJvmTarget -d $outDir $in && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
CommandDeps: []string{
"${config.KotlincCmd}",
@@ -73,7 +73,7 @@
"${config.SoongZipCmd}",
},
},
- "kotlincFlags", "classpath", "outDir", "javaVersion")
+ "kotlincFlags", "classpath", "outDir", "kotlinJvmTarget")
errorprone = pctx.AndroidStaticRule("errorprone",
blueprint.RuleParams{
@@ -208,7 +208,8 @@
"classpath": flags.kotlincClasspath.FormJavaClassPath("-classpath"),
"kotlincFlags": flags.kotlincFlags,
"outDir": classDir.String(),
- "javaVersion": flags.javaVersion,
+ // http://b/69160377 kotlinc only supports -jvm-target 1.6 and 1.8
+ "kotlinJvmTarget": "1.8",
},
})
}