From 156c2db8556395e494a7fc1de71583edc4157df0 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Thu, 26 Jan 2023 14:04:46 +0000 Subject: [PATCH] [K/N][test] Fine tune the Maven downloading test Only final builds (without build number) should be placed to Central. Don't run the test for these builds while they are not published there. Merge-request: KT-MR-8491 Merged-by: Pavel Punegov --- .../native/NativeDownloadAndPlatformLibsIT.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativeDownloadAndPlatformLibsIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativeDownloadAndPlatformLibsIT.kt index 2795a0370bb..0f836b30611 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativeDownloadAndPlatformLibsIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/native/NativeDownloadAndPlatformLibsIT.kt @@ -277,18 +277,23 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() { private fun mavenUrl(): String = when (currentCompilerVersion.meta) { MetaVersion.DEV -> KOTLIN_SPACE_DEV - MetaVersion.RELEASE, MetaVersion.RC, MetaVersion("RC2"), MetaVersion.BETA -> MAVEN_CENTRAL + MetaVersion.RELEASE, MetaVersion.RC, MetaVersion("RC2"), MetaVersion.BETA -> + if (currentCompilerVersion.build != -1) KOTLIN_SPACE_DEV else MAVEN_CENTRAL else -> throw IllegalStateException("Not a published version $currentCompilerVersion") } @Test fun `download prebuilt Native bundle with maven`() { + val maven = mavenUrl() + // Don't run this test for build that are not yet published to central + Assume.assumeTrue(maven != MAVEN_CENTRAL) + with(transformNativeTestProjectWithPluginDsl("native-download-maven")) { gradleProperties().appendText( "kotlin.native.distribution.downloadFromMaven=true" ) gradleBuildScript().let { - val text = it.readText().replaceFirst("// ", "maven(\"${mavenUrl()}\")") + val text = it.readText().replaceFirst("// ", "maven(\"${maven}\")") it.writeText(text) } build("assemble") { @@ -301,6 +306,10 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() { @Test fun `download light Native bundle with maven`() { + val maven = mavenUrl() + // Don't run this test for build that are not yet published to central + Assume.assumeTrue(maven != MAVEN_CENTRAL) + if (HostManager.hostIsMac) { val xcodeVersion = Xcode!!.currentVersion val versionSplit = xcodeVersion.split("(\\s+|\\.|-)".toRegex()) @@ -318,7 +327,7 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() { "kotlin.native.distribution.downloadFromMaven=true" ) gradleBuildScript().let { - val text = it.readText().replaceFirst("// ", "maven(\"${mavenUrl()}\")") + val text = it.readText().replaceFirst("// ", "maven(\"${maven}\")") it.writeText(text) } build("assemble", "-Pkotlin.native.distribution.type=light") {