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
This commit is contained in:
Tobias Thierer 2017-11-18 03:10:51 +00:00
parent 393667285e
commit 96427d63bc
1 changed files with 4 additions and 3 deletions

View File

@ -65,7 +65,7 @@ var (
// 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 @@ var (
"${config.SoongZipCmd}",
},
},
"kotlincFlags", "classpath", "outDir", "javaVersion")
"kotlincFlags", "classpath", "outDir", "kotlinJvmTarget")
errorprone = pctx.AndroidStaticRule("errorprone",
blueprint.RuleParams{
@ -208,7 +208,8 @@ func TransformKotlinToClasses(ctx android.ModuleContext, outputFile android.Writ
"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",
},
})
}