diff --git a/tools/helpers/build.gradle b/tools/helpers/build.gradle index b177bfcf1ed..52ddb8dded9 100644 --- a/tools/helpers/build.gradle +++ b/tools/helpers/build.gradle @@ -25,17 +25,11 @@ apply plugin: 'kotlin' apply plugin: NativeInteropPlugin configurations { - unTar - compile.extendsFrom unTar cli_bc.extendsFrom compile } dependencies { compile project(path: ':backend.native', configuration: 'cli_bc') - // https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-archiver - unTar group: 'org.codehaus.plexus', name: 'plexus-archiver', version: '3.4' - // https://mvnrepository.com/artifact/org.codehaus.plexus/plexus-container-default - unTar group: 'org.codehaus.plexus', name: 'plexus-container-default', version: '1.7.1' cli_bc jar.outputs.files } @@ -45,13 +39,6 @@ sourceSets { } } -// TODO: shrink jar -jar { - from { - configurations.unTar.collect { it.isDirectory() ? it : zipTree(it) } - } -} - def testDependencies = project.file("${sourceSets.testOutputLocal.output.dirs.singleFile.absolutePath}/dependencies") void prepareDependenciesDir(File testDependencies) { diff --git a/tools/helpers/src/main/kotlin/DependencyDownloader.kt b/tools/helpers/src/main/kotlin/DependencyDownloader.kt index 58fa0afced5..c7637dc087a 100644 --- a/tools/helpers/src/main/kotlin/DependencyDownloader.kt +++ b/tools/helpers/src/main/kotlin/DependencyDownloader.kt @@ -1,8 +1,5 @@ package org.jetbrains.kotlin.konan -import org.codehaus.plexus.archiver.tar.TarGZipUnArchiver -import org.codehaus.plexus.logging.Logger -import org.codehaus.plexus.logging.console.ConsoleLogger import java.io.* import java.net.URL import java.util.Properties @@ -54,12 +51,14 @@ class DependencyDownloader(dependenciesRoot: File, val properties: Properties, v } private fun extract(tarGz: File) { - val ua = TarGZipUnArchiver() - ua.sourceFile = tarGz - ua.destDirectory = dependenciesRoot - // Workaround. This archive library crashes if the logger is not set. - ua.enableLogging(ConsoleLogger(Logger.LEVEL_DISABLED, "Logger")) - ua.extract() + val tarProcess = ProcessBuilder().apply { + command("tar", "-x", "-f", "${tarGz.canonicalPath}") + directory(tarGz.parentFile) + }.start() + tarProcess.waitFor() + if (tarProcess.exitValue() != 0) { + throw RuntimeException("Cannot extract archive with dependency: ${tarGz.canonicalPath}") + } } private val Long.humanReadable: String @@ -115,6 +114,7 @@ class DependencyDownloader(dependenciesRoot: File, val properties: Properties, v Thread.sleep(1000) // We can use condition variable here. updateProgressMsg(url.toString(), currentBytes, totalBytes) } + println("Done.") if (downloadError != null) { throw RuntimeException("Cannot download dependency: $url", downloadError) }