95 lines
2.4 KiB
Groovy
95 lines
2.4 KiB
Groovy
apply plugin: 'cpp'
|
|
apply plugin: 'eclipse'
|
|
|
|
eclipse.project.natures 'org.eclipse.pde.PluginNature'
|
|
|
|
sourceSets.main.java.srcDirs = ['source/java']
|
|
|
|
dependencies {
|
|
compile(
|
|
'commons-io:commons-io:2.4',
|
|
project(':com.ibm.wala.core'),
|
|
project(':com.ibm.wala.shrike'),
|
|
project(':com.ibm.wala.util'),
|
|
)
|
|
}
|
|
|
|
javadoc {
|
|
dependsOn ':com.ibm.wala.cast.js:compileJava'
|
|
|
|
doFirst {
|
|
classpath += files(project(':com.ibm.wala.cast.js').compileJava)
|
|
}
|
|
}
|
|
|
|
def currentJavaHome = org.gradle.internal.jvm.Jvm.current().javaHome
|
|
|
|
model {
|
|
repositories {
|
|
libs(PrebuiltLibraries) {
|
|
jdk {
|
|
def jniIncludeDir = "$currentJavaHome/include"
|
|
headers.srcDir jniIncludeDir
|
|
binaries.withType(SharedLibraryBinary) {
|
|
switch (targetPlatform.operatingSystem.name) {
|
|
case 'linux':
|
|
headers.srcDirs "$jniIncludeDir/linux"
|
|
break
|
|
case 'osx':
|
|
headers.srcDirs "$jniIncludeDir/darwin"
|
|
break
|
|
case 'windows':
|
|
headers.srcDirs "$jniIncludeDir/win32"
|
|
break
|
|
}
|
|
switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") {
|
|
case 'linux/x86-64':
|
|
sharedLibraryLinkFile = file("$currentJavaHome/jre/lib/amd64/server/libjvm.so")
|
|
break
|
|
case 'osx/x86-64':
|
|
sharedLibraryLinkFile = file("$currentJavaHome/jre/lib/server/libjvm.dylib")
|
|
break
|
|
case 'windows/x86-64':
|
|
// TODO: determine JVM library name and location on Windows
|
|
// sharedLibraryLinkFile = '???'
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
components {
|
|
cast(NativeLibrarySpec) {
|
|
sources.cpp {
|
|
def cSourceDir = 'source/c'
|
|
source {
|
|
srcDirs = ["$cSourceDir/jni"]
|
|
include '*.cpp'
|
|
}
|
|
exportedHeaders.srcDirs = ["$cSourceDir/include"]
|
|
lib library: 'jdk'
|
|
}
|
|
binaries.all {
|
|
switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") {
|
|
case 'linux/x86-64':
|
|
// TODO: compute path on following line from 'jdk' library properties somehow
|
|
linker.args '-Wl,-rpath', "$currentJavaHome/jre/lib/amd64/server"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// TODO: if we eventually stop supporting Maven, then we may be able
|
|
// to discard the "copyJarsIntoLib" task and the corresponding lines
|
|
// in "META-INF/MANIFEST.MF" and "build.properties"
|
|
|
|
task copyJarsIntoLib(type: Copy) {
|
|
def commonsIoJar = configurations.runtimeClasspath.files[0]
|
|
assert commonsIoJar.name.startsWith('commons-io-')
|
|
from commonsIoJar
|
|
into 'lib'
|
|
}
|
|
|
|
assemble.dependsOn copyJarsIntoLib
|