Skip to content

Commit

Permalink
Unbundle kotlinx.coroutines
Browse files Browse the repository at this point in the history
Renaming of kotlinx.coroutines interfers with kotlin-stdlib.
  • Loading branch information
ting-yuan committed Oct 29, 2024
1 parent 579c9da commit c5fb455
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ val googleTruthVersion: String by project
val agpBaseVersion: String by project
val signingKey: String? by project
val signingPassword: String? by project
val aaCoroutinesVersion: String? by project

tasks.withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.add("-Xjvm-default=all-compatibility")
Expand Down Expand Up @@ -148,6 +149,8 @@ abstract class WriteVersionSrcTask : DefaultTask() {
abstract val kspVersion: Property<String>
@get:Input
abstract val kotlinVersion: Property<String>
@get:Input
abstract val coroutinesVersion: Property<String>

@get:OutputDirectory
abstract val outputSrcDir: DirectoryProperty
Expand All @@ -159,6 +162,7 @@ abstract class WriteVersionSrcTask : DefaultTask() {
package com.google.devtools.ksp.gradle
val KSP_KOTLIN_BASE_VERSION = "${kotlinVersion.get()}"
val KSP_VERSION = "${kspVersion.get()}"
val KSP_COROUTINES_VERSION = "${coroutinesVersion.get()}"
""".trimIndent()
)
}
Expand All @@ -167,6 +171,7 @@ abstract class WriteVersionSrcTask : DefaultTask() {
val writeVersionSrcTask = tasks.register<WriteVersionSrcTask>("generateKSPVersions") {
kspVersion = version.toString()
kotlinVersion = kotlinBaseVersion
coroutinesVersion = aaCoroutinesVersion
outputSrcDir = layout.buildDirectory.dir("generated/ksp-versions")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ abstract class KspAATask @Inject constructor(
"${KspGradleSubplugin.KSP_GROUP_ID}:symbol-processing-aa-embeddable:$KSP_VERSION"
),
project.dependencies.create("org.jetbrains.kotlin:kotlin-stdlib:$KSP_KOTLIN_BASE_VERSION"),
project.dependencies.create(
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$KSP_COROUTINES_VERSION"
),
).apply {
isTransitive = false
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ aaFastutilVersion=8.5.11-18
aaStax2Version=4.2.1
aaAaltoXmlVersion=1.3.0
aaStreamexVersion=0.7.2
aaCoroutinesVersion=1.6.4

compilerTestEnabled=false

Expand Down
5 changes: 4 additions & 1 deletion kotlin-analysis-api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ val aaFastutilVersion: String by project
val aaStax2Version: String by project
val aaAaltoXmlVersion: String by project
val aaStreamexVersion: String by project
val aaCoroutinesVersion: String by project

plugins {
kotlin("jvm")
Expand Down Expand Up @@ -93,7 +94,7 @@ dependencies {
implementation("javax.inject:javax.inject:1")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
implementation("org.lz4:lz4-java:1.7.1") { isTransitive = false }
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0") { isTransitive = false }
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$aaCoroutinesVersion") { isTransitive = false }
implementation(
"org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil:$aaFastutilVersion"
) {
Expand Down Expand Up @@ -157,6 +158,7 @@ tasks.withType<ShadowJar>().configureEach {
exclude(project(":api"))
}
exclude("kotlin/**")
exclude("kotlinx/coroutines/**")
archiveClassifier.set("")
minimize {
exclude(dependency("org.lz4:lz4-java:.*"))
Expand Down Expand Up @@ -235,6 +237,7 @@ publishing {

asNode().appendNode("dependencies").apply {
addDependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlinBaseVersion)
addDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core-jvm", aaCoroutinesVersion)
addDependency("com.google.devtools.ksp", "symbol-processing-api", version)
addDependency("com.google.devtools.ksp", "symbol-processing-common-deps", version)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ fun String?.toKotlinVersion(): KotlinVersion {
@Suppress("unused")
@OptIn(KaImplementationDetail::class)
internal val DEAR_SHADOW_JAR_PLEASE_DO_NOT_REMOVE_THESE = listOf(
kotlinx.coroutines.debug.internal.DebugProbesImpl::class.java,
org.jetbrains.kotlin.analysis.api.impl.base.java.source.JavaElementSourceWithSmartPointerFactory::class.java,
org.jetbrains.kotlin.analysis.api.impl.base.projectStructure.KaBaseModuleProvider::class.java,
org.jetbrains.kotlin.analysis.api.impl.base.references.HLApiReferenceProviderService::class.java,
Expand Down
3 changes: 2 additions & 1 deletion symbol-processing-aa-embeddable/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ val kotlinBaseVersion: String by project

val aaKotlinBaseVersion: String by project
val aaIntellijVersion: String by project
val aaCoroutinesVersion: String by project

plugins {
kotlin("jvm")
Expand Down Expand Up @@ -50,7 +51,6 @@ val prefixesToRelocate = listOf(
"javax.inject.",
"javax.annotation.",
"kotlinx.collections.immutable.",
"kotlinx.coroutines.",
"kotlinx.serialization.",
"org.apache.log4j.",
"org.checkerframework.",
Expand Down Expand Up @@ -264,6 +264,7 @@ publishing {

asNode().appendNode("dependencies").apply {
addDependency("org.jetbrains.kotlin", "kotlin-stdlib", kotlinBaseVersion)
addDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core-jvm", aaCoroutinesVersion)
addDependency("com.google.devtools.ksp", "symbol-processing-api", version)
addDependency("com.google.devtools.ksp", "symbol-processing-common-deps", version)
}
Expand Down

0 comments on commit c5fb455

Please sign in to comment.