summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-08-16 21:19:48 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2024-08-16 21:19:48 +0000
commit45e2c9ba92b13d6d0afd4efccdaece70d86fa0a3 (patch)
tree36f21f861e251d63436763d8f36cc9724659bd68 /java/base.go
parent53c33178d15699d3650b82b3dd60cfad0954f0bc (diff)
parentf0df94a76d2018be5548f9960b5971855c9e9a51 (diff)
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>
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go31
1 files changed, 6 insertions, 25 deletions
diff --git a/java/base.go b/java/base.go
index 5f89b1fea..478fea175 100644
--- a/java/base.go
+++ b/java/base.go
@@ -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: