Merge "Move kotlin stdlib to normal dependency tag" into main am: f0df94a76d

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3216738

Change-Id: Ib86bb51550db89f2e926229610b969fa98e2a79a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Colin Cross
2024-08-16 21:19:48 +00:00
committed by Automerger Merge Worker
3 changed files with 139 additions and 91 deletions

View File

@@ -872,9 +872,12 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if j.hasSrcExt(".kt") {
// TODO(ccross): move this to a mutator pass that can tell if generated sources contain
// Kotlin files
ctx.AddVariationDependencies(nil, kotlinStdlibTag,
"kotlin-stdlib", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8")
ctx.AddVariationDependencies(nil, kotlinAnnotationsTag, "kotlin-annotations")
tag := staticLibTag
if !BoolDefault(j.properties.Static_kotlin_stdlib, true) {
tag = libTag
}
ctx.AddVariationDependencies(nil, tag,
"kotlin-stdlib", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8", "kotlin-annotations")
}
// Framework libraries need special handling in static coverage builds: they should not have
@@ -1206,7 +1209,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
var kotlinJars android.Paths
var kotlinHeaderJars android.Paths
var kotlinExtraJars android.Paths
// Prepend extraClasspathJars to classpath so that the resource processor R.jar comes before
// any dependencies so that it can override any non-final R classes from dependencies with the
@@ -1285,9 +1287,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
// Collect common .kt files for AIDEGen
j.expandIDEInfoCompiledSrcs = append(j.expandIDEInfoCompiledSrcs, kotlinCommonSrcFiles.Strings()...)
flags.classpath = append(flags.classpath, deps.kotlinStdlib...)
flags.classpath = append(flags.classpath, deps.kotlinAnnotations...)
flags.kotlincClasspath = append(flags.kotlincClasspath, flags.bootClasspath...)
flags.kotlincClasspath = append(flags.kotlincClasspath, flags.classpath...)
@@ -1317,8 +1316,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
kotlinJars = append(kotlinJars, kotlinJarPath)
kotlinHeaderJars = append(kotlinHeaderJars, kotlinHeaderJar)
kotlinExtraJars = append(kotlinExtraJars, deps.kotlinStdlib...)
kotlinExtraJars = append(kotlinExtraJars, deps.kotlinAnnotations...)
}
jars := slices.Clone(kotlinJars)
@@ -1337,9 +1334,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
// with sharding enabled. See: b/77284273.
}
extraJars := slices.Clone(kotlinHeaderJars)
if BoolDefault(j.properties.Static_kotlin_stdlib, true) {
extraJars = append(extraJars, kotlinExtraJars...)
}
extraJars = append(extraJars, extraCombinedJars...)
var combinedHeaderJarFile android.Path
headerJarFileWithoutDepsOrJarjar, combinedHeaderJarFile =
@@ -1418,13 +1412,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
}
}
// Jar kotlin classes into the final jar after javac
if BoolDefault(j.properties.Static_kotlin_stdlib, true) {
jars = append(jars, kotlinExtraJars...)
} else {
flags.dexClasspath = append(flags.dexClasspath, kotlinExtraJars...)
}
jars = append(jars, extraCombinedJars...)
j.srcJarArgs, j.srcJarDeps = resourcePathsToJarArgs(srcFiles), srcFiles
@@ -2338,10 +2325,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
} else {
ctx.PropertyErrorf("exported_plugins", "%q is not a java_plugin module", otherName)
}
case kotlinStdlibTag:
deps.kotlinStdlib = append(deps.kotlinStdlib, dep.HeaderJars...)
case kotlinAnnotationsTag:
deps.kotlinAnnotations = dep.HeaderJars
case kotlinPluginTag:
deps.kotlinPlugins = append(deps.kotlinPlugins, dep.ImplementationAndResourcesJars...)
case syspropPublicStubDepTag:
@@ -2565,8 +2548,6 @@ func collectDirectDepsProviders(ctx android.ModuleContext) (result *JarJarProvid
return RenameUseInclude, "tagswitch"
case exportedPluginTag:
return RenameUseInclude, "tagswitch"
case kotlinStdlibTag, kotlinAnnotationsTag:
return RenameUseExclude, "tagswitch"
case kotlinPluginTag:
return RenameUseInclude, "tagswitch"
default: