From 9d98c9088159c070afd8e792df5692a0f436e8ca Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Wed, 20 May 2020 15:14:51 +0200 Subject: [PATCH] Drop coroutines from compiler jar, add appropriate plugin dependency #KT-30778 fixed --- buildSrc/src/main/kotlin/embeddable.kt | 1 - .../util/src/org/jetbrains/kotlin/utils/PathUtil.kt | 4 +++- include/kotlin-compiler/build.gradle.kts | 1 - libraries/tools/kotlin-main-kts/build.gradle.kts | 2 +- libraries/tools/kotlin-main-kts/main-kts.pro | 2 ++ prepare/compiler/build.gradle.kts | 10 +++++++++- prepare/compiler/compiler.pro | 5 ----- prepare/compiler/compiler.pro.191 | 3 --- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/buildSrc/src/main/kotlin/embeddable.kt b/buildSrc/src/main/kotlin/embeddable.kt index 36b20f25fe1..83f21aa310b 100644 --- a/buildSrc/src/main/kotlin/embeddable.kt +++ b/buildSrc/src/main/kotlin/embeddable.kt @@ -20,7 +20,6 @@ val packagesToRelocate = "org.picocontainer", "org.jline", "org.fusesource", - "kotlinx.coroutines", "net.jpountz", "one.util.streamex", "kotlinx.collections.immutable" diff --git a/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt b/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt index 30eab6d8536..6ea91f88635 100644 --- a/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt +++ b/compiler/util/src/org/jetbrains/kotlin/utils/PathUtil.kt @@ -83,7 +83,9 @@ object PathUtil { val KOTLIN_SCRIPTING_PLUGIN_CLASSPATH_JARS = arrayOf( KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMPILER_IMPL_JAR, - KOTLIN_SCRIPTING_COMMON_JAR, KOTLIN_SCRIPTING_JVM_JAR, KOTLIN_SCRIPTING_JS_JAR, JS_ENGINES_JAR + KOTLINX_COROUTINES_CORE_JAR, + KOTLIN_SCRIPTING_COMMON_JAR, KOTLIN_SCRIPTING_JVM_JAR, + KOTLIN_SCRIPTING_JS_JAR, JS_ENGINES_JAR ) const val KOTLIN_TEST_NAME = "kotlin-test" diff --git a/include/kotlin-compiler/build.gradle.kts b/include/kotlin-compiler/build.gradle.kts index c781c85920f..9dc0eeb961e 100644 --- a/include/kotlin-compiler/build.gradle.kts +++ b/include/kotlin-compiler/build.gradle.kts @@ -22,7 +22,6 @@ dependencies { fatJarContents(protobufFull()) fatJarContents(commonDep("com.google.code.findbugs", "jsr305")) fatJarContents(commonDep("io.javaslang", "javaslang")) - fatJarContents(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } fatJarContents(intellijCoreDep()) { includeJars("intellij-core") } fatJarContents(intellijDep()) { includeIntellijCoreJarDependencies(project, { !(it.startsWith("jdom") || it.startsWith("log4j")) }) } diff --git a/libraries/tools/kotlin-main-kts/build.gradle.kts b/libraries/tools/kotlin-main-kts/build.gradle.kts index 6f83d40d1aa..19dc6208446 100644 --- a/libraries/tools/kotlin-main-kts/build.gradle.kts +++ b/libraries/tools/kotlin-main-kts/build.gradle.kts @@ -83,7 +83,7 @@ val proguard by task { dependsOn(relocatedJar) configuration("main-kts.pro") - injars(mapOf("filter" to "!META-INF/versions/**"), relocatedJar.get().outputs.files) + injars(mapOf("filter" to "!META-INF/versions/**,!kotlinx/coroutines/debug/**"), relocatedJar.get().outputs.files) outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar")) diff --git a/libraries/tools/kotlin-main-kts/main-kts.pro b/libraries/tools/kotlin-main-kts/main-kts.pro index ec98d891385..9eae5e37f90 100644 --- a/libraries/tools/kotlin-main-kts/main-kts.pro +++ b/libraries/tools/kotlin-main-kts/main-kts.pro @@ -15,6 +15,8 @@ -dontwarn org.bouncycastle.** -dontwarn org.apache.ivy.ant.** -dontwarn kotlin.annotations.jvm.** +# hopefully temporarily, for coroutines +-dontwarn kotlin.time.** -keep class org.jetbrains.kotlin.mainKts.** { *; } -keep class kotlin.script.experimental.** { *; } diff --git a/prepare/compiler/build.gradle.kts b/prepare/compiler/build.gradle.kts index bbda1b24e29..c777a329f2e 100644 --- a/prepare/compiler/build.gradle.kts +++ b/prepare/compiler/build.gradle.kts @@ -46,6 +46,8 @@ val libraries by configurations.creating { } } +val librariesStripVersion by configurations.creating + // Compiler plugins should be copied without `kotlin-` prefix val compilerPlugins by configurations.creating { exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") @@ -153,6 +155,8 @@ dependencies { libraries(project(":kotlin-test:kotlin-test-js", configuration = "distLibrary")) } + librariesStripVersion(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } + distLibraryProjects.forEach { libraries(project(it)) { isTransitive = false } } @@ -196,7 +200,6 @@ dependencies { fatJarContents(protobufFull()) fatJarContents(commonDep("com.google.code.findbugs", "jsr305")) fatJarContents(commonDep("io.javaslang", "javaslang")) - fatJarContents(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } fatJarContents(commonDep("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm")) { isTransitive = false } fatJarContents(intellijCoreDep()) { includeJars("intellij-core") } @@ -342,6 +345,11 @@ val distKotlinc = distTask("distKotlinc") { into("lib") { from(jar) { rename { "$compilerBaseName.jar" } } from(libraries) + from(librariesStripVersion) { + rename { + it.replace(Regex("-\\d.*\\.jar\$"), ".jar") + } + } from(sources) from(compilerPlugins) { rename { it.removePrefix("kotlin-") } diff --git a/prepare/compiler/compiler.pro b/prepare/compiler/compiler.pro index f1ab6a674de..e42c58b9a18 100644 --- a/prepare/compiler/compiler.pro +++ b/prepare/compiler/compiler.pro @@ -13,7 +13,6 @@ -dontwarn com.intellij.ui.** -dontwarn com.intellij.util.IconUtil -dontwarn com.intellij.util.ImageLoader --dontwarn kotlinx.coroutines.flow.FlowKt__MergeKt -dontwarn net.sf.cglib.** -dontwarn org.objectweb.asm.** # this is ASM3, the old version that we do not use -dontwarn com.sun.jna.NativeString @@ -64,7 +63,6 @@ -dontwarn org.w3c.dom.Window -dontwarn org.slf4j.** - #-libraryjars '' #-libraryjars '' #-libraryjars '' @@ -219,9 +217,6 @@ -keep class com.sun.tools.javac.** { *; } -keep class com.sun.source.** { *; } -# for coroutines --keep class kotlinx.coroutines.** { *; } - # for webdemo -keep class com.intellij.openapi.progress.ProgressManager { *; } diff --git a/prepare/compiler/compiler.pro.191 b/prepare/compiler/compiler.pro.191 index 219031a3413..bd793925a7a 100644 --- a/prepare/compiler/compiler.pro.191 +++ b/prepare/compiler/compiler.pro.191 @@ -218,9 +218,6 @@ -keep class com.sun.tools.javac.** { *; } -keep class com.sun.source.** { *; } -# for coroutines --keep class kotlinx.coroutines.** { *; } - # for webdemo -keep class com.intellij.openapi.progress.ProgressManager { *; }