build: implement downloading (native) dependencies from the JFrog repo
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/shelf
|
.idea/shelf
|
||||||
dependencies
|
/dependencies/all
|
||||||
dist
|
dist
|
||||||
translator/src/test/kotlin/tests/*/linked
|
translator/src/test/kotlin/tests/*/linked
|
||||||
out
|
out
|
||||||
|
|||||||
@@ -4,4 +4,10 @@ if (new File("$project.rootDir/local.properties").exists()) {
|
|||||||
Properties props = new Properties()
|
Properties props = new Properties()
|
||||||
props.load(new FileInputStream("$project.rootDir/local.properties"))
|
props.load(new FileInputStream("$project.rootDir/local.properties"))
|
||||||
props.each {prop -> project.ext.set(prop.key, prop.value)}
|
props.each {prop -> project.ext.set(prop.key, prop.value)}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
if (path != ":dependencies") {
|
||||||
|
evaluationDependsOn(":dependencies")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Vendored
+84
@@ -0,0 +1,84 @@
|
|||||||
|
abstract class NativeDep extends DefaultTask {
|
||||||
|
|
||||||
|
private static String getCurrentHostTarget() {
|
||||||
|
String osName = System.properties['os.name']
|
||||||
|
String osArch = System.properties['os.arch']
|
||||||
|
|
||||||
|
// TODO: implement more generally
|
||||||
|
if (osArch in ['x86_64', 'amd64']) {
|
||||||
|
if (osName == 'Mac OS X') {
|
||||||
|
return 'darwin-macos'
|
||||||
|
} else if (osName == 'Linux') {
|
||||||
|
return 'linux-x86-64'
|
||||||
|
} else {
|
||||||
|
throw new Error("Unsupported OS: $osName")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Error("Unsupported arch: $osArch")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final String target = getCurrentHostTarget();
|
||||||
|
|
||||||
|
@Input
|
||||||
|
abstract String getFileName()
|
||||||
|
|
||||||
|
protected String getUrl() {
|
||||||
|
return "http://repo.labs.intellij.net/kotlin-native/$fileName"
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File getBaseOutDir() {
|
||||||
|
final File res = project.file("all")
|
||||||
|
res.mkdirs()
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File download() {
|
||||||
|
File result = new File(baseOutDir, fileName)
|
||||||
|
ant.get(src: url, dest: result, usetimestamp: true)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TgzNativeDep extends NativeDep {
|
||||||
|
String baseName
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String getFileName() {
|
||||||
|
return "${baseName}.tar.gz"
|
||||||
|
}
|
||||||
|
|
||||||
|
@OutputDirectory
|
||||||
|
File getOutputDir() {
|
||||||
|
return new File(baseOutDir, baseName)
|
||||||
|
}
|
||||||
|
|
||||||
|
@TaskAction
|
||||||
|
public void downloadAndExtract() {
|
||||||
|
File archived = this.download()
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Builtin Gradle unpacking tools seem to unable to handle symlinks;
|
||||||
|
// Use external "tar" executable as workaround:
|
||||||
|
project.exec {
|
||||||
|
executable "tar"
|
||||||
|
workingDir baseOutDir
|
||||||
|
args "xf", archived
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
project.delete(outputDir)
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: do not extract if already extracted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task update {
|
||||||
|
dependsOn tasks.withType(NativeDep)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(TgzNativeDep) {
|
||||||
|
rootProject.ext.set("${name}Dir", outputDir.path)
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
include ':dependencies'
|
||||||
include ':Interop:Indexer'
|
include ':Interop:Indexer'
|
||||||
include ':Interop:StubGenerator'
|
include ':Interop:StubGenerator'
|
||||||
include ':Interop:Runtime'
|
include ':Interop:Runtime'
|
||||||
|
|||||||
Reference in New Issue
Block a user