Fix KT-39063 by not adding extendsFrom with metadata configurations

Issue #KT-39063 Fixed
上级 6fcdab23
......@@ -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
fun testProcessingDependencyDeclaredInNonRootSourceSet() {
publishThirdPartyLib(withGranularMetadata = true)
......
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"))
}
}
}
}
\ No newline at end of file
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
val kotlin_version: String by settings
plugins {
kotlin("multiplatform").version(kotlin_version)
}
}
rootProject.name = "my-lib-foo"
\ No newline at end of file
package com.example
import com.example.thirdparty.thirdPartyFun
import kotlin.test.*
class TestUseCoroutines {
@Test
fun testThirdPartyLibAvailable() {
assertEquals("thirdPartyFun @ js", thirdPartyFun())
}
}
\ No newline at end of file
......@@ -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.KotlinUsages
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.targets.js.ir.KotlinJsIrTarget
import org.jetbrains.kotlin.gradle.targets.js.npm.*
......@@ -123,8 +125,8 @@ internal class KotlinCompilationNpmResolver(
all.description = "NPM configuration for $compilation."
compilation.allKotlinSourceSets.forEach { sourceSet ->
sourceSet.relatedConfigurationNames.forEach { configurationName ->
val configuration = project.configurations.getByName(configurationName)
KotlinDependencyScope.values().forEach { scope ->
val configuration = project.sourceSetDependencyConfigurationByScope(sourceSet, scope)
all.extendsFrom(configuration)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册