forked from JetBrains/kotlin-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplatform.gradle
46 lines (37 loc) · 1.44 KB
/
platform.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
apply plugin: 'konan'
buildscript {
def konanVersion = gradle.startParameter.projectProperties['konanVersion']
dependencies {
classpath files("../tools/kotlin-native-gradle-plugin/build/libs/kotlin-native-gradle-plugin-${konanVersion}.jar")
}
}
def taskName = "${gradle.startParameter.projectProperties['name']}"
String konanHome = gradle.startParameter.projectProperties['konan.home']
List<String> libs = gradle.startParameter.projectProperties.libraries.split(" ").findAll { !it.isEmpty() }
String targetName = gradle.startParameter.projectProperties.target
konan.targets = [targetName]
konanArtifacts {
interop("$taskName") {
defFile gradle.startParameter.projectProperties.defFile
noDefaultLibs true
libraries {
files libs.collect { "$konanHome/klib/platform/$targetName/$it" }
}
extraOpts '--purge_user_libs'
}
}
def suffix = gradle.startParameter.projectProperties['suffix']
def klibProgram = suffix?"$konanHome/bin/klib.$suffix" : "$konanHome/bin/klib"
task klibInstall(type:Exec) {
String repo = "$konanHome/klib/platform/$targetName"
doFirst {
new File(repo).mkdirs()
}
dependsOn konanArtifacts."$taskName"."$targetName"
commandLine klibProgram,
'install',
konanArtifacts."$taskName"."$targetName".artifact,
'-target', gradle.startParameter.projectProperties.target,
'-repository',
repo
}