Allow omitting version of standard artifacts when kotlin-android plugin is used
This commit is contained in:
committed by
Sergey Igushkin
parent
0aa80d1912
commit
15feeddc46
+32
@@ -397,6 +397,38 @@ class KotlinAndroid30GradleIT : KotlinAndroid3GradleIT() {
|
|||||||
|
|
||||||
override val defaultGradleVersion: GradleVersionRequired
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
get() = GradleVersionRequired.Until("4.10.2")
|
get() = GradleVersionRequired.Until("4.10.2")
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testOmittedStdlibVersion() = with(Project("AndroidProject", GradleVersionRequired.AtLeast("4.4"))) {
|
||||||
|
setupWorkingDir()
|
||||||
|
|
||||||
|
gradleBuildScript("Lib").modify {
|
||||||
|
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) } + "\n" + """
|
||||||
|
apply plugin: 'maven'
|
||||||
|
group 'com.example'
|
||||||
|
version '1.0'
|
||||||
|
android {
|
||||||
|
defaultPublishConfig 'flavor1Debug'
|
||||||
|
}
|
||||||
|
uploadArchives {
|
||||||
|
repositories {
|
||||||
|
mavenDeployer {
|
||||||
|
repository(url: "file://${'$'}buildDir/repo")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
|
||||||
|
build(":Lib:assembleFlavor1Debug", ":Lib:uploadArchives") {
|
||||||
|
assertSuccessful()
|
||||||
|
assertTasksExecuted(":Lib:compileFlavor1DebugKotlin", ":Lib:uploadArchives")
|
||||||
|
val pomLines = File(projectDir, "Lib/build/repo/com/example/Lib/1.0/Lib-1.0.pom").readLines()
|
||||||
|
val stdlibVersionLineNumber = pomLines.indexOfFirst { "<artifactId>kotlin-stdlib</artifactId>" in it } + 1
|
||||||
|
val versionLine = pomLines[stdlibVersionLineNumber]
|
||||||
|
assertTrue { "<version>${defaultBuildOptions().kotlinVersion}</version>" in versionLine }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class KotlinAndroid3GradleIT : AbstractKotlinAndroidGradleTests() {
|
abstract class KotlinAndroid3GradleIT : AbstractKotlinAndroidGradleTests() {
|
||||||
|
|||||||
+2
@@ -646,6 +646,8 @@ internal open class KotlinAndroidPlugin(
|
|||||||
|
|
||||||
applyUserDefinedAttributes(androidTarget)
|
applyUserDefinedAttributes(androidTarget)
|
||||||
|
|
||||||
|
configureDefaultVersionsResolutionStrategy(project, kotlinPluginVersion)
|
||||||
|
|
||||||
registry.register(KotlinModelBuilder(kotlinPluginVersion, androidTarget))
|
registry.register(KotlinModelBuilder(kotlinPluginVersion, androidTarget))
|
||||||
|
|
||||||
project.whenEvaluated { project.components.addAll(androidTarget.components) }
|
project.whenEvaluated { project.components.addAll(androidTarget.components) }
|
||||||
|
|||||||
Reference in New Issue
Block a user