Revert "Add support for renamed kotlin stdlib."
This reverts commit 66c0c4067f
.
Bug: 112674805
Test: m checkbuild
Change-Id: I687888136b570f080b57af352af0130355acd216
This commit is contained in:
@@ -66,7 +66,6 @@ var (
|
|||||||
`${config.GenKotlinBuildFileCmd} $classpath $outDir $out.rsp $srcJarDir/list > $outDir/kotlinc-build.xml &&` +
|
`${config.GenKotlinBuildFileCmd} $classpath $outDir $out.rsp $srcJarDir/list > $outDir/kotlinc-build.xml &&` +
|
||||||
`${config.KotlincCmd} $kotlincFlags ` +
|
`${config.KotlincCmd} $kotlincFlags ` +
|
||||||
`-jvm-target $kotlinJvmTarget -Xbuild-file=$outDir/kotlinc-build.xml && ` +
|
`-jvm-target $kotlinJvmTarget -Xbuild-file=$outDir/kotlinc-build.xml && ` +
|
||||||
`rm $outDir/kotlinc-build.xml && ` +
|
|
||||||
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
||||||
CommandDeps: []string{
|
CommandDeps: []string{
|
||||||
"${config.KotlincCmd}",
|
"${config.KotlincCmd}",
|
||||||
|
33
java/java.go
33
java/java.go
@@ -86,10 +86,6 @@ type CompilerProperties struct {
|
|||||||
// ext, and framework for device targets)
|
// ext, and framework for device targets)
|
||||||
No_framework_libs *bool
|
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
|
// list of module-specific flags that will be used for javac compiles
|
||||||
Javacflags []string `android:"arch_variant"`
|
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
|
var kotlinJars android.Paths
|
||||||
|
|
||||||
if srcFiles.HasExt(".kt") {
|
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.
|
// won't emit any classes for them.
|
||||||
|
|
||||||
flags.kotlincFlags = "-no-stdlib"
|
flags.kotlincFlags = "-no-stdlib"
|
||||||
|
|
||||||
if ctx.Device() {
|
if ctx.Device() {
|
||||||
flags.kotlincFlags += " -no-jdk"
|
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
|
// Jar kotlin classes into the final jar after javac
|
||||||
kotlinJars = append(kotlinJars, kotlinJar)
|
kotlinJars = append(kotlinJars, kotlinJar)
|
||||||
|
kotlinJars = append(kotlinJars, deps.kotlinStdlib...)
|
||||||
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...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jars := append(android.Paths(nil), kotlinJars...)
|
jars := append(android.Paths(nil), kotlinJars...)
|
||||||
@@ -1207,21 +1189,10 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||||||
} else {
|
} else {
|
||||||
combinedJar := android.PathForModuleOut(ctx, "combined", jarName)
|
combinedJar := android.PathForModuleOut(ctx, "combined", jarName)
|
||||||
TransformJarsToJar(ctx, combinedJar, "for javac", jars, manifest,
|
TransformJarsToJar(ctx, combinedJar, "for javac", jars, manifest,
|
||||||
false, stripFiles, nil)
|
false, nil, nil)
|
||||||
outputFile = combinedJar
|
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
|
// jarjar implementation jar if necessary
|
||||||
if j.properties.Jarjar_rules != nil {
|
if j.properties.Jarjar_rules != nil {
|
||||||
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
|
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
|
||||||
|
@@ -209,8 +209,6 @@ func testContext(config android.Config, bp string,
|
|||||||
"bar-doc/IFoo.aidl": nil,
|
"bar-doc/IFoo.aidl": nil,
|
||||||
"bar-doc/known_oj_tags.txt": nil,
|
"bar-doc/known_oj_tags.txt": nil,
|
||||||
"external/doclava/templates-sdk": nil,
|
"external/doclava/templates-sdk": nil,
|
||||||
|
|
||||||
"external/kotlinc/jarjar-rules.txt": nil,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range fs {
|
for k, v := range fs {
|
||||||
@@ -823,12 +821,6 @@ func TestKotlin(t *testing.T) {
|
|||||||
name: "baz",
|
name: "baz",
|
||||||
srcs: ["c.java"],
|
srcs: ["c.java"],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
|
||||||
name: "blorg",
|
|
||||||
renamed_kotlin_stdlib: true,
|
|
||||||
srcs: ["b.kt"],
|
|
||||||
}
|
|
||||||
`)
|
`)
|
||||||
|
|
||||||
fooKotlinc := ctx.ModuleForTests("foo", "android_common").Rule("kotlinc")
|
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`,
|
t.Errorf(`expected %q in bar implicits %v`,
|
||||||
bazHeaderJar.Output.String(), barKotlinc.Implicits.Strings())
|
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) {
|
func TestTurbine(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user