Support omitting version of org.jetbrains.kotlin dependencies
Related to #KT-12792
This commit is contained in:
+14
@@ -464,4 +464,18 @@ class KotlinGradleIT: BaseGradleIT() {
|
|||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testOmittedStdlibVersion() {
|
||||||
|
val project = Project("kotlinProject", "2.3")
|
||||||
|
project.setupWorkingDir()
|
||||||
|
File(project.projectDir, "build.gradle").modify {
|
||||||
|
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) }
|
||||||
|
}
|
||||||
|
|
||||||
|
project.build("build") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertContains(":compileKotlin", ":compileTestKotlin")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+12
@@ -274,6 +274,7 @@ internal abstract class AbstractKotlinPlugin(
|
|||||||
project.plugins.apply(JavaPlugin::class.java)
|
project.plugins.apply(JavaPlugin::class.java)
|
||||||
|
|
||||||
configureSourceSetDefaults(project, javaBasePlugin, javaPluginConvention)
|
configureSourceSetDefaults(project, javaBasePlugin, javaPluginConvention)
|
||||||
|
configureDefaultVersionsResolutionStrategy(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
open protected fun configureSourceSetDefaults(
|
open protected fun configureSourceSetDefaults(
|
||||||
@@ -285,6 +286,17 @@ internal abstract class AbstractKotlinPlugin(
|
|||||||
buildSourceSetProcessor(project, javaBasePlugin, sourceSet, kotlinPluginVersion).run()
|
buildSourceSetProcessor(project, javaBasePlugin, sourceSet, kotlinPluginVersion).run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun configureDefaultVersionsResolutionStrategy(project: Project) {
|
||||||
|
project.configurations.all { configuration ->
|
||||||
|
configuration.resolutionStrategy.eachDependency { details ->
|
||||||
|
val requested = details.requested
|
||||||
|
if (requested.group == "org.jetbrains.kotlin" && requested.version.isEmpty()) {
|
||||||
|
details.useVersion(kotlinPluginVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal open class KotlinPlugin(
|
internal open class KotlinPlugin(
|
||||||
|
|||||||
Reference in New Issue
Block a user