[K/N][gradle] Remove download url property.
This commit is contained in:
committed by
Space Team
parent
41332f7fc7
commit
d735fa6567
+8
-47
@@ -313,11 +313,12 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
fun `download prebuilt Native bundle with maven`() {
|
||||
with(transformNativeTestProjectWithPluginDsl("native-download-maven")) {
|
||||
gradleProperties().appendText(
|
||||
"""
|
||||
kotlin.native.distribution.mavenDownloadUrl=${mavenUrl()}
|
||||
kotlin.native.distribution.downloadFromMaven=true
|
||||
""".trimIndent()
|
||||
"kotlin.native.distribution.downloadFromMaven=true"
|
||||
)
|
||||
gradleBuildScript().let {
|
||||
val text = it.readText().replaceFirst("// <MavenPlaceholder>", "maven(\"${mavenUrl()}\")")
|
||||
it.writeText(text)
|
||||
}
|
||||
build("assemble") {
|
||||
assertSuccessful()
|
||||
assertContains("Unpack Kotlin/Native compiler to ")
|
||||
@@ -330,35 +331,16 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
fun `download light Native bundle with maven`() {
|
||||
with(transformNativeTestProjectWithPluginDsl("native-download-maven")) {
|
||||
gradleProperties().appendText(
|
||||
"""
|
||||
kotlin.native.distribution.mavenDownloadUrl=${mavenUrl()}
|
||||
kotlin.native.distribution.downloadFromMaven=true
|
||||
""".trimIndent()
|
||||
)
|
||||
build("assemble", "-Pkotlin.native.distribution.type=light") {
|
||||
assertSuccessful()
|
||||
assertContains("Unpack Kotlin/Native compiler to ")
|
||||
assertContains("Generate platform libraries for ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `download from maven specified in the build`() {
|
||||
with(transformNativeTestProjectWithPluginDsl("native-download-maven")) {
|
||||
gradleProperties().appendText(
|
||||
"""
|
||||
kotlin.native.distribution.downloadFromMaven=true
|
||||
""".trimIndent()
|
||||
"kotlin.native.distribution.downloadFromMaven=true"
|
||||
)
|
||||
gradleBuildScript().let {
|
||||
val text = it.readText().replaceFirst("// <MavenPlaceholder>", "maven(\"${mavenUrl()}\")")
|
||||
it.writeText(text)
|
||||
}
|
||||
|
||||
build("assemble") {
|
||||
build("assemble", "-Pkotlin.native.distribution.type=light") {
|
||||
assertSuccessful()
|
||||
assertContains("Unpack Kotlin/Native compiler to ")
|
||||
assertContains("Generate platform libraries for ")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,25 +360,4 @@ class NativeDownloadAndPlatformLibsIT : BaseGradleIT() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `download from maven specified in the build and with parameter`() {
|
||||
with(transformNativeTestProjectWithPluginDsl("native-download-maven")) {
|
||||
gradleProperties().appendText(
|
||||
"""
|
||||
kotlin.native.distribution.mavenDownloadUrl=${mavenUrl()}
|
||||
kotlin.native.distribution.downloadFromMaven=true
|
||||
""".trimIndent()
|
||||
)
|
||||
gradleBuildScript().let {
|
||||
val text = it.readText().replaceFirst("// <MavenPlaceholder>", "maven(\"${mavenUrl()}\")")
|
||||
it.writeText(text)
|
||||
}
|
||||
|
||||
build("assemble") {
|
||||
assertSuccessful()
|
||||
assertContains("Unpack Kotlin/Native compiler to ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-10
@@ -277,19 +277,10 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
val nativeBaseDownloadUrl: String
|
||||
get() = this.property("kotlin.native.distribution.baseDownloadUrl") ?: NativeCompilerDownloader.BASE_DOWNLOAD_URL
|
||||
|
||||
/**
|
||||
* Allows setting Kotlin/Native maven url to download bundles from.
|
||||
*
|
||||
* This path will be added as a maven repository to the project.
|
||||
*/
|
||||
val nativeMavenDownloadUrl: String?
|
||||
get() = this.property("kotlin.native.distribution.mavenDownloadUrl")
|
||||
|
||||
/**
|
||||
* Allows downloading Kotlin/Native distribution with maven.
|
||||
*
|
||||
* Makes downloader search for bundles in maven repositories.
|
||||
* Property `kotlin.native.distribution.mavenDownloadUrl` allows to specify custom maven url.
|
||||
* Makes downloader search for bundles in maven repositories specified in the project.
|
||||
*/
|
||||
val nativeDownloadFromMaven: Boolean
|
||||
get() = this.booleanProperty("kotlin.native.distribution.downloadFromMaven") ?: false
|
||||
|
||||
+10
-25
@@ -108,37 +108,22 @@ class NativeCompilerDownloader(
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupMavenRepo(repoUrl: String): ArtifactRepository {
|
||||
return project.repositories.maven { repo ->
|
||||
repo.setUrl(repoUrl)
|
||||
repo.metadataSources {
|
||||
it.artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeRepo(repo: ArtifactRepository) {
|
||||
project.repositories.remove(repo)
|
||||
}
|
||||
|
||||
private fun downloadAndExtract() {
|
||||
val repoUrl = if (kotlinProperties.nativeDownloadFromMaven) {
|
||||
kotlinProperties.nativeMavenDownloadUrl
|
||||
} else {
|
||||
buildString {
|
||||
append("${kotlinProperties.nativeBaseDownloadUrl}/")
|
||||
append(if (compilerVersion.meta == MetaVersion.DEV) "dev/" else "releases/")
|
||||
append("$compilerVersion/")
|
||||
append(simpleOsName)
|
||||
}
|
||||
private val repoUrl by lazy {
|
||||
buildString {
|
||||
append("${kotlinProperties.nativeBaseDownloadUrl}/")
|
||||
append(if (compilerVersion.meta == MetaVersion.DEV) "dev/" else "releases/")
|
||||
append("$compilerVersion/")
|
||||
append(simpleOsName)
|
||||
}
|
||||
}
|
||||
|
||||
val repo = if (repoUrl != null) {
|
||||
if (kotlinProperties.nativeDownloadFromMaven) {
|
||||
setupMavenRepo(repoUrl)
|
||||
} else {
|
||||
setupRepo(repoUrl)
|
||||
}
|
||||
private fun downloadAndExtract() {
|
||||
val repo = if (!kotlinProperties.nativeDownloadFromMaven) {
|
||||
setupRepo(repoUrl)
|
||||
} else null
|
||||
|
||||
val compilerDependency = if (kotlinProperties.nativeDownloadFromMaven) {
|
||||
|
||||
Reference in New Issue
Block a user