[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 <Pavel.Punegov@jetbrains.com>
This commit is contained in:
Pavel Punegov
2023-01-26 14:04:46 +00:00
committed by Space Team
parent dd9b0f9fa5
commit 156c2db855
@@ -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("// <MavenPlaceholder>", "maven(\"${mavenUrl()}\")")
val text = it.readText().replaceFirst("// <MavenPlaceholder>", "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("// <MavenPlaceholder>", "maven(\"${mavenUrl()}\")")
val text = it.readText().replaceFirst("// <MavenPlaceholder>", "maven(\"${maven}\")")
it.writeText(text)
}
build("assemble", "-Pkotlin.native.distribution.type=light") {