Skip to content

Commit

Permalink
Add workaround for compiler downloader for 1.5.20 release binaries
Browse files Browse the repository at this point in the history
Because of migration K/N to kotlin repo we still have some problems
with version transformation.
Right now, when in 1.5.20-release branch we have build number
(and DeployVersion) something like 1.5.20-256 K/N mechanic interprets it
as Release version and almost all artifacts have names just 1.5.20.
For example: kotlin-native-prebuilt-linux-1.5.20.tar.gz
But they are stored in the separate folder releases/1.5.20-256
and I use this in this commit.

For release version the build number should be -1, because the version
should be just 1.5.20 but we should check it or even revert the commit
  • Loading branch information
erokhins authored and Space committed Jun 15, 2021
1 parent 7d180b8 commit 6b8cae2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,22 @@ open class KonanCompilerDownloadTask : DefaultTask() {
logger.info("Use a user-defined compiler path: $konanHome")
} else {
try {
// WOrkaround. see org.jetbrains.kotlin.gradle.utils.NativeCompilerDownloader.downloadAndExtract
val compilerVersion = project.konanVersion
val compilerVersionWorkaround =
if (compilerVersion.build != -1 && compilerVersion.meta == MetaVersion.RELEASE)
"$compilerVersion-${compilerVersion.build}"
else
"$compilerVersion"

val downloadUrlDirectory = buildString {
append("$BASE_DOWNLOAD_URL/")
val version = project.konanVersion
when (version.meta) {
MetaVersion.DEV -> append("dev/")
else -> append("releases/")
}
append("$version/")
append("$compilerVersionWorkaround/")
append(project.simpleOsName)
}
val konanCompiler = project.konanCompilerName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,18 @@ class NativeCompilerDownloader(
}

private fun downloadAndExtract() {
// For release branch we have numeration like 1.5.20-256 and compilerVersion.toString() returns 1.5.20 and meta is RELEASE
// TODO: fix that in 1.5.30 release, but for now this workaround could be ok
val compilerVersionWorkaround =
if (compilerVersion.build != -1 && compilerVersion.meta == MetaVersion.RELEASE)
"$compilerVersion-${compilerVersion.build}"
else
"$compilerVersion"

val repoUrl = buildString {
append("$BASE_DOWNLOAD_URL/")
append(if (compilerVersion.meta == MetaVersion.DEV) "dev/" else "releases/")
append("$compilerVersion/")
append("$compilerVersionWorkaround/")
append(simpleOsName)
}
val dependencyUrl = "$repoUrl/$dependencyFileName"
Expand Down

0 comments on commit 6b8cae2

Please sign in to comment.