Fix KT-39063 by not adding extendsFrom with metadata configurations
Issue #KT-39063 Fixed
This commit is contained in:
+12
@@ -422,6 +422,18 @@ class HierarchicalMppIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testHmppDependenciesInJsTests() {
|
||||||
|
val thirdPartyRepo = publishThirdPartyLib(withGranularMetadata = true).projectDir.parentFile.resolve("repo")
|
||||||
|
with(Project("hierarchical-mpp-js-test")) {
|
||||||
|
val taskToExecute = ":jsNodeTest"
|
||||||
|
build(taskToExecute, "-PthirdPartyRepo=$thirdPartyRepo") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(taskToExecute)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testProcessingDependencyDeclaredInNonRootSourceSet() {
|
fun testProcessingDependencyDeclaredInNonRootSourceSet() {
|
||||||
publishThirdPartyLib(withGranularMetadata = true)
|
publishThirdPartyLib(withGranularMetadata = true)
|
||||||
|
|||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
group = "com.h0tk3y.mpp.demo"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform")
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
val thirdPartyRepo: String by project
|
||||||
|
maven(thirdPartyRepo)
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
sourceSets {
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation("com.example.thirdparty:third-party-lib:1.0")
|
||||||
|
implementation(kotlin("stdlib-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonTest by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-common"))
|
||||||
|
implementation(kotlin("test-annotations-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jvm {
|
||||||
|
compilations["main"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("stdlib"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compilations["test"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-junit"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
js {
|
||||||
|
nodejs()
|
||||||
|
browser()
|
||||||
|
|
||||||
|
compilations["main"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("stdlib-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compilations["test"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
implementation(kotlin("test-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
val kotlin_version: String by settings
|
||||||
|
plugins {
|
||||||
|
kotlin("multiplatform").version(kotlin_version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "my-lib-foo"
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example
|
||||||
|
|
||||||
|
import com.example.thirdparty.thirdPartyFun
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
|
class TestUseCoroutines {
|
||||||
|
@Test
|
||||||
|
fun testThirdPartyLibAvailable() {
|
||||||
|
assertEquals("thirdPartyFun @ js", thirdPartyFun())
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-2
@@ -20,6 +20,8 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJsCompilation
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinUsages
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.disambiguateName
|
import org.jetbrains.kotlin.gradle.plugin.mpp.disambiguateName
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.sources.KotlinDependencyScope
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.sources.sourceSetDependencyConfigurationByScope
|
||||||
import org.jetbrains.kotlin.gradle.plugin.usesPlatformOf
|
import org.jetbrains.kotlin.gradle.plugin.usesPlatformOf
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
|
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.npm.*
|
import org.jetbrains.kotlin.gradle.targets.js.npm.*
|
||||||
@@ -123,8 +125,8 @@ internal class KotlinCompilationNpmResolver(
|
|||||||
all.description = "NPM configuration for $compilation."
|
all.description = "NPM configuration for $compilation."
|
||||||
|
|
||||||
compilation.allKotlinSourceSets.forEach { sourceSet ->
|
compilation.allKotlinSourceSets.forEach { sourceSet ->
|
||||||
sourceSet.relatedConfigurationNames.forEach { configurationName ->
|
KotlinDependencyScope.values().forEach { scope ->
|
||||||
val configuration = project.configurations.getByName(configurationName)
|
val configuration = project.sourceSetDependencyConfigurationByScope(sourceSet, scope)
|
||||||
all.extendsFrom(configuration)
|
all.extendsFrom(configuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user