From ccc630d528e4dc91961b9d8e92ed9ea6c2d54b14 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Fri, 8 Dec 2017 11:59:53 +0300 Subject: [PATCH] [gradle][dependencies] don't try to deal with unstable dependencies in tools just in :dependencies:update task --- dependencies/build.gradle | 2 +- .../kotlin/konan/util/DependencyProcessor.kt | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dependencies/build.gradle b/dependencies/build.gradle index d94ea96d39c..9bfd696b840 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -201,7 +201,7 @@ class HelperNativeDep extends TgzNativeDep { @TaskAction public void downloadAndExtract() { - def downloader = new DependencyProcessor(baseOutDir, konanProperties, [baseName], baseUrl) + def downloader = new DependencyProcessor(baseOutDir, konanProperties, [baseName], baseUrl, false) downloader.showInfo = false downloader.run() } diff --git a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DependencyProcessor.kt b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DependencyProcessor.kt index f9ef1a6c0bd..00eee2c0294 100644 --- a/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DependencyProcessor.kt +++ b/shared/src/main/kotlin/org/jetbrains/kotlin/konan/util/DependencyProcessor.kt @@ -65,7 +65,8 @@ class DependencyProcessor(dependenciesRoot: File, val airplaneMode: Boolean = false, maxAttempts: Int = DependencyDownloader.DEFAULT_MAX_ATTEMPTS, attemptIntervalMs: Long = DependencyDownloader.DEFAULT_ATTEMPT_INTERVAL_MS, - customProgressCallback: ProgressCallback? = null) { + customProgressCallback: ProgressCallback? = null, + val keepUnstable:Boolean = true) { val dependenciesDirectory = dependenciesRoot.apply { mkdirs() } val cacheDirectory = System.getProperty("user.home")?.let { @@ -85,22 +86,26 @@ class DependencyProcessor(dependenciesRoot: File, constructor(dependenciesRoot: File, properties: KonanProperties, - dependenciesUrl: String = properties.dependenciesUrl) : this( + dependenciesUrl: String = properties.dependenciesUrl, + keepUnstable:Boolean = true) : this( dependenciesRoot, properties.properties, properties.dependencies, - dependenciesUrl) + dependenciesUrl, + keepUnstable = keepUnstable) constructor(dependenciesRoot: File, properties: Properties, dependencies: List, - dependenciesUrl: String = properties.dependenciesUrl) : this( + dependenciesUrl: String = properties.dependenciesUrl, + keepUnstable:Boolean = true) : this( dependenciesRoot, dependenciesUrl, dependencies, airplaneMode = properties.airplaneMode, maxAttempts = properties.downloadingAttempts, - attemptIntervalMs = properties.downloadingAttemptIntervalMs) + attemptIntervalMs = properties.downloadingAttemptIntervalMs, + keepUnstable = keepUnstable) class DependencyFile(directory: File, fileName: String) { @@ -146,7 +151,7 @@ class DependencyProcessor(dependenciesRoot: File, depDir.isDirectory && depDir.list().isNotEmpty()) { - if (depDir.list().contains(".unstable")) { + if (!keepUnstable && depDir.list().contains(".unstable")) { // The downloaded version of the dependency is unstable -> redownload it. depDir.deleteRecursively() archive.delete()