Skip to content

Commit

Permalink
Add support for downloading Konan home from Maven.
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipDolnik committed May 21, 2024
1 parent 3d8b916 commit 20859a1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,26 @@ private object KotlinNativeDownloaderProperties {

const val main = "kotlin.native.version"
const val deprecated = "org.jetbrains.kotlin.native.version"
const val downloadFromMaven = "kotlin.native.distribution.downloadFromMaven"
}

fun Project.kotlinNativeCompilerHome(kotlinVersion: KotlinToolingVersion): File {
return NativeCompilerDownloader(project, CompilerVersion.fromString(kotlinVersion.toString()))
.also { downloader ->
val originalVersionProperty = backupProperty<String?>(getKotlinNativeVersionPropertyName())
val originalDownloadFromMavenProperty = backupProperty<String>(KotlinNativeDownloaderProperties.downloadFromMaven)

extra.set(KotlinNativeDownloaderProperties.main, kotlinVersion.toString())
if (kotlinVersion >= KotlinToolingVersion("1.9.20")) {
extra.set(KotlinNativeDownloaderProperties.downloadFromMaven, "true")
}

downloader.downloadIfNeeded()

extra.set(KotlinNativeDownloaderProperties.main, null)

restoreProperty(originalVersionProperty)
restoreProperty(originalDownloadFromMavenProperty)
}
.compilerDirectory
}
Expand Down

0 comments on commit 20859a1

Please sign in to comment.