Fix test was using removed publication plugin.
Replace usage of removed 'maven' plugin with 'maven-publish'. ^KT-44949 In Progress
This commit is contained in:
+32
-16
@@ -522,27 +522,43 @@ open class KotlinAndroid34GradleIT : KotlinAndroid3GradleIT() {
|
|||||||
setupWorkingDir()
|
setupWorkingDir()
|
||||||
|
|
||||||
gradleBuildScript("Lib").modify {
|
gradleBuildScript("Lib").modify {
|
||||||
it.checkedReplace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib") + "\n" + """
|
|
||||||
apply plugin: 'maven'
|
it.checkedReplace(
|
||||||
group 'com.example'
|
"kotlin-stdlib:\$kotlin_version",
|
||||||
version '1.0'
|
"kotlin-stdlib"
|
||||||
android {
|
) + "\n" +
|
||||||
defaultPublishConfig 'flavor1Debug'
|
"""
|
||||||
}
|
apply plugin: 'maven-publish'
|
||||||
uploadArchives {
|
|
||||||
repositories {
|
android {
|
||||||
mavenDeployer {
|
defaultPublishConfig 'flavor1Debug'
|
||||||
repository(url: "file://${'$'}buildDir/repo")
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
flavorDebug(MavenPublication) {
|
||||||
|
from components.flavor1Debug
|
||||||
|
|
||||||
|
group = 'com.example'
|
||||||
|
artifactId = 'flavor1Debug'
|
||||||
|
version = '1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = "file://${'$'}buildDir/repo"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
""".trimIndent()
|
||||||
""".trimIndent()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build(":Lib:assembleFlavor1Debug", ":Lib:uploadArchives") {
|
build(":Lib:assembleFlavor1Debug", ":Lib:publish") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksExecuted(":Lib:compileFlavor1DebugKotlin", ":Lib:uploadArchives")
|
assertTasksExecuted(":Lib:compileFlavor1DebugKotlin", ":Lib:publishFlavorDebugPublicationToMavenRepository")
|
||||||
val pomLines = File(projectDir, "Lib/build/repo/com/example/Lib/1.0/Lib-1.0.pom").readLines()
|
val pomLines = File(projectDir, "Lib/build/repo/com/example/flavor1Debug/1.0/flavor1Debug-1.0.pom").readLines()
|
||||||
val stdlibVersionLineNumber = pomLines.indexOfFirst { "<artifactId>kotlin-stdlib</artifactId>" in it } + 1
|
val stdlibVersionLineNumber = pomLines.indexOfFirst { "<artifactId>kotlin-stdlib</artifactId>" in it } + 1
|
||||||
val versionLine = pomLines[stdlibVersionLineNumber]
|
val versionLine = pomLines[stdlibVersionLineNumber]
|
||||||
assertTrue { "<version>${defaultBuildOptions().kotlinVersion}</version>" in versionLine }
|
assertTrue { "<version>${defaultBuildOptions().kotlinVersion}</version>" in versionLine }
|
||||||
|
|||||||
+23
-4
@@ -387,15 +387,34 @@ class KotlinGradleIT : BaseGradleIT() {
|
|||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
File(project.projectDir, "build.gradle").modify {
|
File(project.projectDir, "build.gradle").modify {
|
||||||
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) } + "\n" + """
|
it.replace("kotlin-stdlib:\$kotlin_version", "kotlin-stdlib").apply { check(!equals(it)) } + "\n" + """
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven-publish'
|
||||||
install.repositories { maven { url "file://${'$'}buildDir/repo" } }
|
|
||||||
|
group = "com.example"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
myLibrary(MavenPublication) {
|
||||||
|
from components.kotlin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url = "${'$'}buildDir/repo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
project.build("build", "install", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
|
project.build(
|
||||||
|
"build",
|
||||||
|
"publishAllPublicationsToMavenRepository",
|
||||||
|
options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)
|
||||||
|
) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
|
||||||
val pomLines = File(project.projectDir, "build/poms/pom-default.xml").readLines()
|
val pomLines = File(project.projectDir, "build/publications/myLibrary/pom-default.xml").readLines()
|
||||||
val stdlibVersionLineNumber = pomLines.indexOfFirst { "<artifactId>kotlin-stdlib</artifactId>" in it } + 1
|
val stdlibVersionLineNumber = pomLines.indexOfFirst { "<artifactId>kotlin-stdlib</artifactId>" in it } + 1
|
||||||
val versionLine = pomLines[stdlibVersionLineNumber]
|
val versionLine = pomLines[stdlibVersionLineNumber]
|
||||||
assertTrue { "<version>${defaultBuildOptions().kotlinVersion}</version>" in versionLine }
|
assertTrue { "<version>${defaultBuildOptions().kotlinVersion}</version>" in versionLine }
|
||||||
|
|||||||
+6
-15
@@ -1532,26 +1532,19 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
assertFileExists(groupDir + "mpp-lib-myjvm")
|
assertFileExists(groupDir + "mpp-lib-myjvm")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doTestPomRewriting(mppProjectDependency: Boolean, legacyPublishing: Boolean, keepPomIntact: Boolean? = null) {
|
fun doTestPomRewriting(mppProjectDependency: Boolean, keepPomIntact: Boolean? = null) {
|
||||||
|
|
||||||
val params = mutableListOf("clean", ":jvm-app:publish", ":js-app:publish").apply {
|
val params = mutableListOf("clean", ":jvm-app:publish", ":js-app:publish").apply {
|
||||||
if (mppProjectDependency)
|
if (mppProjectDependency)
|
||||||
add("-PmppProjectDependency=true")
|
add("-PmppProjectDependency=true")
|
||||||
if (legacyPublishing)
|
|
||||||
add("-PlegacyPublishing=true")
|
|
||||||
if (keepPomIntact == true)
|
if (keepPomIntact == true)
|
||||||
add("-Pkotlin.mpp.keepMppDependenciesIntactInPoms=true")
|
add("-Pkotlin.mpp.keepMppDependenciesIntactInPoms=true")
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
|
|
||||||
build(*params, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
|
build(*params, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
if (legacyPublishing) {
|
assertTasksExecuted(":jvm-app:publishMainPublicationToMavenRepository")
|
||||||
assertTasksExecuted(":jvm-app:uploadArchives")
|
assertTasksExecuted(":js-app:publishMainPublicationToMavenRepository")
|
||||||
assertTasksExecuted(":js-app:uploadArchives")
|
|
||||||
} else {
|
|
||||||
assertTasksExecuted(":jvm-app:publishMainPublicationToMavenRepository")
|
|
||||||
assertTasksExecuted(":js-app:publishMainPublicationToMavenRepository")
|
|
||||||
}
|
|
||||||
|
|
||||||
val jvmModuleDir = groupDir + "jvm-app/1.0/"
|
val jvmModuleDir = groupDir + "jvm-app/1.0/"
|
||||||
val jsModuleDir = groupDir + "js-app/1.0/"
|
val jsModuleDir = groupDir + "js-app/1.0/"
|
||||||
@@ -1584,16 +1577,14 @@ class NewMultiplatformIT : BaseGradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doTestPomRewriting(mppProjectDependency = false, legacyPublishing = false)
|
doTestPomRewriting(mppProjectDependency = false)
|
||||||
doTestPomRewriting(mppProjectDependency = false, legacyPublishing = true)
|
doTestPomRewriting(mppProjectDependency = true)
|
||||||
doTestPomRewriting(mppProjectDependency = true, legacyPublishing = false)
|
|
||||||
|
|
||||||
// This case doesn't work and never did; TODO investigate KT-29975
|
// This case doesn't work and never did; TODO investigate KT-29975
|
||||||
// doTestPomRewriting(mppProjectDependency = true, legacyPublishing = true)
|
// doTestPomRewriting(mppProjectDependency = true, legacyPublishing = true)
|
||||||
|
|
||||||
// Also check that the flag for keeping POMs intact works:
|
// Also check that the flag for keeping POMs intact works:
|
||||||
doTestPomRewriting(mppProjectDependency = false, legacyPublishing = false, keepPomIntact = true)
|
doTestPomRewriting(mppProjectDependency = false, keepPomIntact = true)
|
||||||
doTestPomRewriting(mppProjectDependency = false, legacyPublishing = true, keepPomIntact = true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+7
-29
@@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "kotlin2js"
|
id "kotlin2js"
|
||||||
|
id "maven-publish"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.example"
|
group = "com.example"
|
||||||
@@ -27,36 +28,13 @@ if (project.findProperty("mppProjectDependency") == "true") {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
if (project.findProperty("legacyPublishing") == "true") {
|
publications {
|
||||||
|
main(MavenPublication) {
|
||||||
apply plugin: 'maven'
|
from components.java
|
||||||
|
|
||||||
uploadArchives {
|
|
||||||
repositories {
|
|
||||||
mavenDeployer {
|
|
||||||
repository(url: "file://${rootProject.buildDir}/repo")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
tasks.create("publish") {
|
maven { setUrl("${rootProject.buildDir}/repo") }
|
||||||
dependsOn uploadArchives
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
main(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven { setUrl("${rootProject.buildDir}/repo") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+7
-29
@@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.jvm"
|
id "org.jetbrains.kotlin.jvm"
|
||||||
|
id "maven-publish"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.example"
|
group = "com.example"
|
||||||
@@ -27,36 +28,13 @@ if (project.findProperty("mppProjectDependency") == "true") {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
if (project.findProperty("legacyPublishing") == "true") {
|
publications {
|
||||||
|
main(MavenPublication) {
|
||||||
apply plugin: 'maven'
|
from components.java
|
||||||
|
|
||||||
uploadArchives {
|
|
||||||
repositories {
|
|
||||||
mavenDeployer {
|
|
||||||
repository(url: "file://${rootProject.buildDir}/repo")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
repositories {
|
||||||
tasks.create("publish") {
|
maven { setUrl("${rootProject.buildDir}/repo") }
|
||||||
dependsOn uploadArchives
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
main(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven { setUrl("${rootProject.buildDir}/repo") }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user