Add the expectedBy dependency to the compile configuration
Enable its propagation through transitive dependencies (including POMs generated by Gradle) Issue #KT-22824 Fixed
This commit is contained in:
+21
@@ -201,4 +201,25 @@ class MultiplatformGradleIT : BaseGradleIT() {
|
|||||||
assertTasksExecuted(listOf(":lib:compileKotlinCommon", ":libJvm:compileKotlin", ":libJs:compileKotlin2Js"))
|
assertTasksExecuted(listOf(":lib:compileKotlinCommon", ":libJvm:compileKotlin", ":libJs:compileKotlin2Js"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testCommonModuleAsTransitiveDependency() = with(Project("multiplatformProject")) {
|
||||||
|
setupWorkingDir()
|
||||||
|
gradleBuildScript("libJvm").appendText("""
|
||||||
|
${'\n'}
|
||||||
|
task printCompileConfiguration(type: DefaultTask) {
|
||||||
|
doFirst {
|
||||||
|
configurations.compile.resolvedConfiguration.resolvedArtifacts.each {
|
||||||
|
println("Dependency: '" + it.name + "'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent())
|
||||||
|
|
||||||
|
build("printCompileConfiguration") {
|
||||||
|
assertSuccessful()
|
||||||
|
// Check that `lib` is contained in the resolved compile artifacts of `libJvm`:
|
||||||
|
assertContains("Dependency: 'lib'")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
@@ -72,6 +72,10 @@ open class KotlinPlatformImplementationPluginBase(platformName: String) : Kotlin
|
|||||||
config.dependencies.whenObjectAdded { dep ->
|
config.dependencies.whenObjectAdded { dep ->
|
||||||
if (dep is ProjectDependency) {
|
if (dep is ProjectDependency) {
|
||||||
addCommonProject(dep.dependencyProject, project)
|
addCommonProject(dep.dependencyProject, project)
|
||||||
|
|
||||||
|
// Needed for the projects that depend on this one to recover the common module sources through
|
||||||
|
// the transitive dependency (also, it will be added to the POM generated by Gradle):
|
||||||
|
project.configurations.getByName("compile").dependencies.add(dep)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw GradleException("$project '${config.name}' dependency is not a project: $dep")
|
throw GradleException("$project '${config.name}' dependency is not a project: $dep")
|
||||||
|
|||||||
Reference in New Issue
Block a user