Revert "Add support for renamed kotlin stdlib."

This reverts commit 66c0c4067f.

Bug: 112674805
Test: m checkbuild
Change-Id: I687888136b570f080b57af352af0130355acd216
This commit is contained in:
Colin Cross 2018-08-27 15:42:25 -07:00
parent e97e68a05a
commit 9b38aef182
3 changed files with 2 additions and 46 deletions

View File

@ -66,7 +66,6 @@ var (
`${config.GenKotlinBuildFileCmd} $classpath $outDir $out.rsp $srcJarDir/list > $outDir/kotlinc-build.xml &&` +
`${config.KotlincCmd} $kotlincFlags ` +
`-jvm-target $kotlinJvmTarget -Xbuild-file=$outDir/kotlinc-build.xml && ` +
`rm $outDir/kotlinc-build.xml && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
CommandDeps: []string{
"${config.KotlincCmd}",

View File

@ -86,10 +86,6 @@ type CompilerProperties struct {
// ext, and framework for device targets)
No_framework_libs *bool
// Use renamed kotlin stdlib (com.android.kotlin.*). This allows kotlin usage without colliding
// with app-provided kotlin stdlib.
Renamed_kotlin_stdlib *bool
// list of module-specific flags that will be used for javac compiles
Javacflags []string `android:"arch_variant"`
@ -1025,8 +1021,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
}
}
var stripFiles []string
var kotlinJars android.Paths
if srcFiles.HasExt(".kt") {
@ -1035,7 +1029,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
// won't emit any classes for them.
flags.kotlincFlags = "-no-stdlib"
if ctx.Device() {
flags.kotlincFlags += " -no-jdk"
}
@ -1060,18 +1053,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
// Jar kotlin classes into the final jar after javac
kotlinJars = append(kotlinJars, kotlinJar)
if Bool(j.properties.Renamed_kotlin_stdlib) {
// Remove any kotlin-reflect related files
// TODO(pszczepaniak): Support kotlin-reflect
stripFiles = append(stripFiles,
"**/*.kotlin_module",
"**/*.kotlin_builtins")
} else {
// Only add kotlin-stdlib if not using (on-device) renamed stdlib
// (it's expected to be on device bootclasspath)
kotlinJars = append(kotlinJars, deps.kotlinStdlib...)
}
kotlinJars = append(kotlinJars, deps.kotlinStdlib...)
}
jars := append(android.Paths(nil), kotlinJars...)
@ -1207,21 +1189,10 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
} else {
combinedJar := android.PathForModuleOut(ctx, "combined", jarName)
TransformJarsToJar(ctx, combinedJar, "for javac", jars, manifest,
false, stripFiles, nil)
false, nil, nil)
outputFile = combinedJar
}
// Use renamed kotlin standard library?
if srcFiles.HasExt(".kt") && Bool(j.properties.Renamed_kotlin_stdlib) {
jarjarFile := android.PathForModuleOut(ctx, "kotlin-renamed", jarName)
TransformJarJar(ctx, jarjarFile, outputFile,
android.PathForSource(ctx, "external/kotlinc/jarjar-rules.txt"))
outputFile = jarjarFile
if ctx.Failed() {
return
}
}
// jarjar implementation jar if necessary
if j.properties.Jarjar_rules != nil {
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)

View File

@ -209,8 +209,6 @@ func testContext(config android.Config, bp string,
"bar-doc/IFoo.aidl": nil,
"bar-doc/known_oj_tags.txt": nil,
"external/doclava/templates-sdk": nil,
"external/kotlinc/jarjar-rules.txt": nil,
}
for k, v := range fs {
@ -823,12 +821,6 @@ func TestKotlin(t *testing.T) {
name: "baz",
srcs: ["c.java"],
}
java_library {
name: "blorg",
renamed_kotlin_stdlib: true,
srcs: ["b.kt"],
}
`)
fooKotlinc := ctx.ModuleForTests("foo", "android_common").Rule("kotlinc")
@ -871,12 +863,6 @@ func TestKotlin(t *testing.T) {
t.Errorf(`expected %q in bar implicits %v`,
bazHeaderJar.Output.String(), barKotlinc.Implicits.Strings())
}
blorgRenamedJar := ctx.ModuleForTests("blorg", "android_common").Output("kotlin-renamed/blorg.jar")
if blorgRenamedJar.Implicit.String() != "external/kotlinc/jarjar-rules.txt" {
t.Errorf(`expected external/kotlinc/jarjar-rules.txt in blorg implicit %q`,
blorgRenamedJar.Implicit.String())
}
}
func TestTurbine(t *testing.T) {