HEAD UPS! Global move: experiments -> kotlin-native

This commit is contained in:
Vasily Levchenko
2016-09-28 13:22:36 +03:00
parent 541f9ac1e7
commit 0eaaa58ed9
49 changed files with 1 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
apply plugin: 'groovy'
dependencies {
compile gradleApi()
compile localGroovy()
}
@@ -0,0 +1,61 @@
package org.jetbrains.kotlin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.JavaExec
class NativeInteropPlugin implements Plugin<Project> {
@Override
void apply(Project prj) {
// TODO: handle other source sets
def srcDir = prj.file("src/main/kotlin")
def generatedSrcDir = new File(prj.buildDir, "nativeInteropStubs/kotlin")
def nativeLibsDir = new File(prj.buildDir, "nativelibs")
prj.configurations {
interopStubGenerator
}
prj.dependencies {
compile project(path: ':Interop:Runtime')
interopStubGenerator project(path: ":Interop:StubGenerator")
}
def genStubsTaskName = "genInteropStubs"
prj.task(genStubsTaskName, type: JavaExec) {
classpath = prj.configurations.interopStubGenerator
main = "org.jetbrains.kotlin.native.interop.gen.jvm.MainKt"
args = [srcDir, generatedSrcDir, nativeLibsDir]
systemProperties "java.library.path" : new File(prj.findProject(":Interop:Indexer").buildDir, "nativelibs")
systemProperties "llvmInstallPath" : prj.llvmInstallPath
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
environment "DYLD_LIBRARY_PATH": "${prj.llvmInstallPath}/lib"
inputs.files prj.fileTree(srcDir.path).include('**/*.def')
outputs.dir generatedSrcDir
outputs.dir nativeLibsDir
}
prj.sourceSets {
main {
kotlin {
srcDirs generatedSrcDir
}
}
}
prj.tasks.getByName("compileKotlin") {
dependsOn genStubsTaskName
}
// FIXME: choose tasks more wisely
prj.tasks.withType(JavaExec) {
if (name != genStubsTaskName) {
systemProperties "java.library.path": nativeLibsDir
}
}
}
}