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

View File

@@ -357,7 +357,14 @@ val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures
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
javaHome = defaultJavaHome

View File

@@ -2,6 +2,8 @@ import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.npm.NpmTask
import de.undercouch.gradle.tasks.download.Download
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
plugins {
kotlin("jvm")
@@ -18,7 +20,8 @@ node {
val antLauncherJar by configurations.creating
val testJsRuntime by configurations.creating {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(KotlinUsages.KOTLIN_RUNTIME))
attribute(KotlinPlatformType.attribute, KotlinPlatformType.js)
}
}

View File

@@ -11,7 +11,12 @@ pill {
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 {
testCompile(kotlinStdlib())

View File

@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
plugins {
id "com.github.node-gradle.node" version "2.2.0"
}
@@ -8,9 +11,10 @@ apply plugin: 'kotlin-platform-js'
configurations {
nodeModules {
extendsFrom testCompile
extendsFrom compile
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)
}
}
}

View File

@@ -5,7 +5,12 @@ plugins {
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 {
testCompile(commonDep("junit"))

View File

@@ -13,14 +13,11 @@ val jarBaseName = property("archivesBaseName") as String
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))
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_API))
}
}
val relocatedJarContents by configurations.creating
val embedded by configurations

View File

@@ -10,6 +10,10 @@ val testCompile by configurations
testCompile.extendsFrom(allTestsRuntime)
val embeddableTestRuntime by configurations.creating {
extendsFrom(allTestsRuntime)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY))
}
}
dependencies {

View File

@@ -4,7 +4,13 @@ plugins {
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
dependencies {

View File

@@ -11,7 +11,7 @@ dependencies {
runtimeOnly(kotlinStdlib())
runtimeOnly(project(":kotlin-script-runtime"))
runtimeOnly(project(":kotlin-reflect"))
runtime(project(":kotlin-daemon-embeddable"))
runtimeOnly(project(":kotlin-daemon-embeddable"))
runtimeOnly(commonDep("org.jetbrains.intellij.deps", "trove4j"))
testCompile(commonDep("junit:junit"))
testCompile(project(":kotlin-test:kotlin-test-junit"))

View File

@@ -40,9 +40,6 @@ val proguardLibraries by configurations.creating {
// Libraries to copy to the lib directory
val libraries by configurations.creating {
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
val librariesStripVersion by configurations.creating

View File

@@ -142,7 +142,11 @@ val libraries by configurations.creating {
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 {
resolutionStrategy {

View File

@@ -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)"
plugins {
`java`
}
val packedJars by configurations.creating
dependencies {
packedJars(project(":kotlin-daemon")) { isTransitive = false }
embedded(project(":kotlin-daemon")) { isTransitive = false }
}
publish()
noDefaultJar()
runtimeJar(rewriteDepsToShadedCompiler(
tasks.register<ShadowJar>("shadowJar") {
from(packedJars)
}
))
runtimeJar(rewriteDefaultJarDepsToShadedCompiler())
sourcesJar()
javadocJar()