From 1bab27c4c1593a9e7ffc35c8fdd0b3b931f44084 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 6 Apr 2020 12:44:44 +0300 Subject: [PATCH] Add immutable collections to compiler dist (required for FIR) --- build.gradle.kts | 4 ++- buildSrc/src/main/kotlin/embeddable.kt | 25 +++++++++++-------- .../tools/kotlin-main-kts/build.gradle.kts | 19 ++++++++++++-- prepare/compiler/build.gradle.kts | 1 + 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d07993e0962..6007fd0238b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -173,7 +173,9 @@ extra["versions.markdown"] = "0.1.25" extra["versions.trove4j"] = "1.0.20181211" extra["versions.completion-ranking-kotlin"] = "0.1.2" extra["versions.r8"] = "1.5.70" -extra["versions.kotlinx-collections-immutable"] = "0.3.1" +val immutablesVersion = "0.3.1" +extra["versions.kotlinx-collections-immutable"] = immutablesVersion +extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion // NOTE: please, also change KTOR_NAME in pathUtil.kt and all versions in corresponding jar names in daemon tests. extra["versions.ktor-network"] = "1.0.1" diff --git a/buildSrc/src/main/kotlin/embeddable.kt b/buildSrc/src/main/kotlin/embeddable.kt index aa98dee657e..36b20f25fe1 100644 --- a/buildSrc/src/main/kotlin/embeddable.kt +++ b/buildSrc/src/main/kotlin/embeddable.kt @@ -11,17 +11,20 @@ import java.io.File val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin" val packagesToRelocate = - listOf( "com.intellij", - "com.google", - "com.sampullara", - "org.apache", - "org.jdom", - "org.picocontainer", - "org.jline", - "org.fusesource", - "kotlinx.coroutines", - "net.jpountz", - "one.util.streamex") + listOf( + "com.intellij", + "com.google", + "com.sampullara", + "org.apache", + "org.jdom", + "org.picocontainer", + "org.jline", + "org.fusesource", + "kotlinx.coroutines", + "net.jpountz", + "one.util.streamex", + "kotlinx.collections.immutable" + ) // The shaded compiler "dummy" is used to rewrite dependencies in projects that are used with the embeddable compiler // on the runtime and use some shaded dependencies from the compiler diff --git a/libraries/tools/kotlin-main-kts/build.gradle.kts b/libraries/tools/kotlin-main-kts/build.gradle.kts index 97839efd114..50701fea34f 100644 --- a/libraries/tools/kotlin-main-kts/build.gradle.kts +++ b/libraries/tools/kotlin-main-kts/build.gradle.kts @@ -11,8 +11,17 @@ plugins { val JDK_18: String by rootProject.extra val jarBaseName = property("archivesBaseName") as String -val proguardLibraryJars by configurations.creating -val relocatedJarContents by configurations.creating +val proguardLibraryJars by configurations.creating { + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + } +} +val relocatedJarContents by configurations.creating { + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + } +} + val embedded by configurations dependencies { @@ -32,6 +41,12 @@ dependencies { embedded(project(":kotlin-script-util")) { isTransitive = false } embedded("org.apache.ivy:ivy:2.5.0") embedded(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false } + embedded(commonDep("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm")) { + isTransitive = false + attributes { + attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) + } + } proguardLibraryJars(kotlinStdlib()) proguardLibraryJars(project(":kotlin-reflect")) diff --git a/prepare/compiler/build.gradle.kts b/prepare/compiler/build.gradle.kts index e3cb2e62487..440129a83a5 100644 --- a/prepare/compiler/build.gradle.kts +++ b/prepare/compiler/build.gradle.kts @@ -198,6 +198,7 @@ dependencies { 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") } fatJarContents(intellijDep()) { includeJars("jna-platform") }