From 8d8da0acf27da331472b7e7e9b2dca9160637e09 Mon Sep 17 00:00:00 2001 From: Ilya Matveev Date: Wed, 8 Nov 2017 20:07:05 +0300 Subject: [PATCH] gradle-plugin: Update compiler downloading path --- .../plugin/tasks/KonanCompilerDownloadTask.kt | 26 +++++++++---------- tools/publish-release.sh | 5 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/tasks/KonanCompilerDownloadTask.kt b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/tasks/KonanCompilerDownloadTask.kt index f5c5598777d..33bd6c682ef 100644 --- a/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/tasks/KonanCompilerDownloadTask.kt +++ b/tools/kotlin-native-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/tasks/KonanCompilerDownloadTask.kt @@ -28,18 +28,14 @@ import java.io.IOException open class KonanCompilerDownloadTask : DefaultTask() { internal companion object { - internal const val DOWNLOAD_URL = "https://download.jetbrains.com/kotlin/native" + internal const val BASE_DOWNLOAD_URL = "https://download.jetbrains.com/kotlin/native/builds" internal val KONAN_PARENT_DIR = "${System.getProperty("user.home")}/.konan" } /** - * A list of tasks used to download dependencies. If empty then dependencies will be downloaded for the host. - * Isn't used if [downloadDependencies] is false. + * If true the task will also download dependencies for targets specified by the konan.targets project extension. */ - @Internal var targets: MutableCollection = mutableSetOf() - - /** If true the task will also download dependencies for targets specified by [targets] property. */ @Internal var downloadDependencies: Boolean = false @TaskAction @@ -55,9 +51,16 @@ open class KonanCompilerDownloadTask : DefaultTask() { } } else { try { + val downloadUrlDirectory = buildString { + append("$BASE_DOWNLOAD_URL/") + val version = project.konanVersion + append(if (version.contains("dev")) "dev/" else "releases/") + append("$version/") + append(project.simpleOsName) + } val konanCompiler = project.konanCompilerName() - logger.info("Downloading Kotlin/Native compiler from ${DOWNLOAD_URL}/$konanCompiler into ${KONAN_PARENT_DIR}") - DependencyProcessor(File(KONAN_PARENT_DIR), DOWNLOAD_URL, listOf(konanCompiler)).run() + logger.info("Downloading Kotlin/Native compiler from $downloadUrlDirectory/$konanCompiler into $KONAN_PARENT_DIR") + DependencyProcessor(File(KONAN_PARENT_DIR), downloadUrlDirectory, listOf(konanCompiler)).run() } catch (e: IOException) { throw GradleScriptException("Cannot download Kotlin/Native compiler", e) } @@ -66,11 +69,8 @@ open class KonanCompilerDownloadTask : DefaultTask() { // Download dependencies if a user said so. if (downloadDependencies) { val runner = KonanCompilerRunner(project) - if (targets.isEmpty()) { - // Download for the host. - runner.run("--check_dependencies") - } else { - targets.forEach { runner.run("--check_dependencies", "-target", it) } + project.konanExtension.konanTargets.forEach { + runner.run("--check_dependencies", "-target", it.userName) } } } diff --git a/tools/publish-release.sh b/tools/publish-release.sh index 62d0c3fa000..65be73b3f70 100755 --- a/tools/publish-release.sh +++ b/tools/publish-release.sh @@ -107,8 +107,9 @@ if [ "$UPLOAD" == "true" ]; then ./gradlew build --refresh-dependencies # 6. Upload the bundle to the CDN - stage "Uploading the bundle to CDN: $BUNDLE_TAR -> ftp://uploadcds.labs.intellij.net/kotlin/native/" - curl --upload-file "$BUNDLE_TAR" "ftp://$CDN_USER:$CDN_PASS@uploadcds.labs.intellij.net/kotlin/native/" + stage "Uploading the bundle to CDN: $BUNDLE_TAR -> ftp://uploadcds.labs.intellij.net/builds/releases/$VERSION/$OS" + curl --upload-file "$BUNDLE_TAR" "ftp://$CDN_USER:$CDN_PASS@uploadcds.labs.intellij.net/builds/releases/$VERSION/$OS" + echo "Available at https://download.jetbrains.com/kotlin/native/builds/releases/$VERSION/$OS/$BUNDLE_TAR" echo "Wait ${WAIT_TIME} seconds to ensure that the bundle can be downloaded." sleep ${WAIT_TIME}