build: Use dependency downloading helper in dependencies:update
This commit is contained in:
Vendored
+36
-10
@@ -1,3 +1,13 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
abstract class NativeDep extends DefaultTask {
|
abstract class NativeDep extends DefaultTask {
|
||||||
|
|
||||||
private String getCurrentHostTarget() {
|
private String getCurrentHostTarget() {
|
||||||
@@ -63,39 +73,55 @@ class TgzNativeDep extends NativeDep {
|
|||||||
project.delete(outputDir)
|
project.delete(outputDir)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: improve downloaded files caching
|
class HelperNativeDep extends TgzNativeDep {
|
||||||
// TODO: do not extract if already extracted
|
|
||||||
|
public HelperNativeDep() {
|
||||||
|
dependsOn(':tools:helpers:jar')
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
public void downloadAndExtract() {
|
||||||
|
project.javaexec {
|
||||||
|
main = "org.jetbrains.kotlin.konan.MainKt"
|
||||||
|
classpath += project.findProject(':tools:helpers').getConfigurations().getByName("runtime")
|
||||||
|
classpath += project.findProject(':tools:helpers').getConfigurations().getByName("runtime").artifacts.files
|
||||||
|
args baseOutDir.canonicalPath,
|
||||||
|
project.findProject(":backend.native").file("konan.properties").canonicalPath,
|
||||||
|
baseName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task hostLibffi(type: TgzNativeDep) {
|
task hostLibffi(type: HelperNativeDep) {
|
||||||
baseName = "libffi-3.2.1-2-$host"
|
baseName = "libffi-3.2.1-2-$host"
|
||||||
}
|
}
|
||||||
|
|
||||||
task llvm(type: TgzNativeDep) {
|
task llvm(type: HelperNativeDep) {
|
||||||
baseName = "clang+llvm-$llvmVersion-$host"
|
baseName = "clang+llvm-$llvmVersion-$host"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLinux()) {
|
if (isLinux()) {
|
||||||
task gccToolchain(type: TgzNativeDep) {
|
task gccToolchain(type: HelperNativeDep) {
|
||||||
baseName = "target-gcc-toolchain-3-$host"
|
baseName = "target-gcc-toolchain-3-$host"
|
||||||
}
|
}
|
||||||
task raspberryPiSysroot(type: TgzNativeDep) {
|
task raspberryPiSysroot(type: HelperNativeDep) {
|
||||||
baseName = "target-sysroot-1-raspberrypi"
|
baseName = "target-sysroot-1-raspberrypi"
|
||||||
}
|
}
|
||||||
task raspberrypiLibffi(type: TgzNativeDep) {
|
task raspberrypiLibffi(type: HelperNativeDep) {
|
||||||
baseName = "libffi-3.2.1-2-raspberrypi"
|
baseName = "libffi-3.2.1-2-raspberrypi"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
task hostSysroot(type: TgzNativeDep) {
|
task hostSysroot(type: HelperNativeDep) {
|
||||||
baseName = "target-sysroot-1-$host"
|
baseName = "target-sysroot-1-$host"
|
||||||
}
|
}
|
||||||
task iphoneSysroot(type: TgzNativeDep) {
|
task iphoneSysroot(type: HelperNativeDep) {
|
||||||
baseName = "target-sysroot-2-darwin-ios"
|
baseName = "target-sysroot-2-darwin-ios"
|
||||||
}
|
}
|
||||||
task iphoneLibffi(type: TgzNativeDep) {
|
task iphoneLibffi(type: HelperNativeDep) {
|
||||||
baseName = "libffi-3.2.1-2-darwin-ios"
|
baseName = "libffi-3.2.1-2-darwin-ios"
|
||||||
}
|
}
|
||||||
// TODO: re-enable when we known how to bring the simulator
|
// TODO: re-enable when we known how to bring the simulator
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.jetbrains.kotlin.konan
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
// TODO: Add command line keys
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
if (args.size < 2) {
|
||||||
|
System.exit(1)
|
||||||
|
}
|
||||||
|
val dependenciesDir = File(args[0])
|
||||||
|
val properties = Properties().apply { load(File(args[1]).inputStream()) }
|
||||||
|
val dependencies = List<String>(args.size - 2) { args[2 + it] }
|
||||||
|
DependencyDownloader(dependenciesDir, properties, dependencies).run()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user