gradle-plugin: Update compiler downloading path

This commit is contained in:
Ilya Matveev
2017-11-08 20:07:05 +03:00
committed by ilmat192
parent d745e80135
commit 8d8da0acf2
2 changed files with 16 additions and 15 deletions
@@ -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<String> = mutableSetOf<String>()
/** 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)
}
}
}
+3 -2
View File
@@ -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}