Build: Fix variant resolution ambiguity

This commit is contained in:
Vyacheslav Gerasimov
2020-05-07 14:27:06 +03:00
parent eeb2f7d3d1
commit b4df4e5525
12 changed files with 52 additions and 32 deletions
+8 -1
View File
@@ -357,7 +357,14 @@ val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures
allprojects { allprojects {
configurations.maybeCreate("embedded") configurations.maybeCreate("embedded").apply {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
jvmTarget = defaultJvmTarget jvmTarget = defaultJvmTarget
javaHome = defaultJavaHome javaHome = defaultJavaHome
+4 -1
View File
@@ -2,6 +2,8 @@ import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.npm.NpmTask import com.moowork.gradle.node.npm.NpmTask
import de.undercouch.gradle.tasks.download.Download import de.undercouch.gradle.tasks.download.Download
import org.gradle.internal.os.OperatingSystem import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
plugins { plugins {
kotlin("jvm") kotlin("jvm")
@@ -18,7 +20,8 @@ node {
val antLauncherJar by configurations.creating val antLauncherJar by configurations.creating
val testJsRuntime by configurations.creating { val testJsRuntime by configurations.creating {
attributes { attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR)) attribute(Usage.USAGE_ATTRIBUTE, objects.named(KotlinUsages.KOTLIN_RUNTIME))
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
} }
} }
@@ -11,7 +11,12 @@ pill {
variant = PillExtension.Variant.FULL variant = PillExtension.Variant.FULL
} }
val compilerClasspath by configurations.creating val compilerClasspath by configurations.creating {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
}
dependencies { dependencies {
testCompile(kotlinStdlib()) testCompile(kotlinStdlib())
+6 -2
View File
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
plugins { plugins {
id "com.github.node-gradle.node" version "2.2.0" id "com.github.node-gradle.node" version "2.2.0"
} }
@@ -8,9 +11,10 @@ apply plugin: 'kotlin-platform-js'
configurations { configurations {
nodeModules { nodeModules {
extendsFrom testCompile extendsFrom compile
attributes { attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR)) attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, KotlinUsages.KOTLIN_RUNTIME))
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
} }
} }
} }
@@ -5,7 +5,12 @@ plugins {
jvmTarget = "1.6" jvmTarget = "1.6"
val embeddableTestRuntime by configurations.creating val embeddableTestRuntime by configurations.creating {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
}
dependencies { dependencies {
testCompile(commonDep("junit")) testCompile(commonDep("junit"))
@@ -13,14 +13,11 @@ val jarBaseName = property("archivesBaseName") as String
val proguardLibraryJars by configurations.creating { val proguardLibraryJars by configurations.creating {
attributes { attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
}
}
val relocatedJarContents by configurations.creating {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
} }
} }
val relocatedJarContents by configurations.creating
val embedded by configurations val embedded by configurations
@@ -10,6 +10,10 @@ val testCompile by configurations
testCompile.extendsFrom(allTestsRuntime) testCompile.extendsFrom(allTestsRuntime)
val embeddableTestRuntime by configurations.creating { val embeddableTestRuntime by configurations.creating {
extendsFrom(allTestsRuntime) extendsFrom(allTestsRuntime)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
} }
dependencies { dependencies {
@@ -4,7 +4,13 @@ plugins {
kotlin("jvm") kotlin("jvm")
} }
val testCompilerClasspath by configurations.creating val testCompilerClasspath by configurations.creating {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
}
val testCompilationClasspath by configurations.creating val testCompilationClasspath by configurations.creating
dependencies { dependencies {
+1 -1
View File
@@ -11,7 +11,7 @@ dependencies {
runtimeOnly(kotlinStdlib()) runtimeOnly(kotlinStdlib())
runtimeOnly(project(":kotlin-script-runtime")) runtimeOnly(project(":kotlin-script-runtime"))
runtimeOnly(project(":kotlin-reflect")) runtimeOnly(project(":kotlin-reflect"))
runtime(project(":kotlin-daemon-embeddable")) runtimeOnly(project(":kotlin-daemon-embeddable"))
runtimeOnly(commonDep("org.jetbrains.intellij.deps", "trove4j")) runtimeOnly(commonDep("org.jetbrains.intellij.deps", "trove4j"))
testCompile(commonDep("junit:junit")) testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-junit")) testCompile(project(":kotlin-test:kotlin-test-junit"))
-3
View File
@@ -40,9 +40,6 @@ val proguardLibraries by configurations.creating {
// Libraries to copy to the lib directory // Libraries to copy to the lib directory
val libraries by configurations.creating { val libraries by configurations.creating {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common") exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
} }
val librariesStripVersion by configurations.creating val librariesStripVersion by configurations.creating
+5 -1
View File
@@ -142,7 +142,11 @@ val libraries by configurations.creating {
exclude("org.jetbrains.intellij.deps", "trove4j") // Idea already has trove4j exclude("org.jetbrains.intellij.deps", "trove4j") // Idea already has trove4j
} }
val jpsPlugin by configurations.creating val jpsPlugin by configurations.creating {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurations.all { configurations.all {
resolutionStrategy { resolutionStrategy {
@@ -1,28 +1,16 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.jvm.tasks.Jar
description = "Kotlin Daemon (for using with embeddable compiler)" description = "Kotlin Daemon (for using with embeddable compiler)"
plugins { plugins {
`java` `java`
} }
val packedJars by configurations.creating
dependencies { dependencies {
packedJars(project(":kotlin-daemon")) { isTransitive = false } embedded(project(":kotlin-daemon")) { isTransitive = false }
} }
publish() publish()
noDefaultJar() runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
sourcesJar() sourcesJar()
javadocJar() javadocJar()