-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
125 lines (102 loc) · 2.67 KB
/
build.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
apply plugin: "java"
apply plugin: "c"
// Find JNI directories
def JNI_BASE_DIR
if (new File(System.properties["java.home"], "include").exists()) {
JNI_BASE_DIR = System.properties["java.home"]
} else {
JNI_BASE_DIR = System.properties["java.home"] + "/.."
}
def JNI_INCLUDE_DIR = JNI_BASE_DIR + "/include"
def JNI_LIB_DIR = JNI_BASE_DIR + "/lib"
println "Found JNI include directory: " + JNI_INCLUDE_DIR
repositories {
mavenCentral()
}
dependencies {
implementation group: 'com.google.guava', name: 'guava', version: '25.1-jre'
testImplementation group: 'junit', name: 'junit', version: '4.+'
testImplementation group: 'com.tngtech.java', name: 'junit-dataprovider', version: '1.10+'
}
model {
repositories {
libs(PrebuiltLibraries) {
yices {
binaries.withType(SharedLibraryBinary) {
sharedLibraryFile = file(projectDir.getPath() + "/libs/libyices.so")
}
}
}
}
binaries {
withType(SharedLibraryBinarySpec) {
cCompiler.args "-I" + JNI_INCLUDE_DIR, "-I" + JNI_INCLUDE_DIR + "/linux"
if (component.baseName == "yicesjni") {
lib library: "yices", linkage: "shared"
}
}
withType(StaticLibraryBinarySpec) {
cCompiler.args "-I" + JNI_INCLUDE_DIR, "-I" + JNI_INCLUDE_DIR + "/linux"
}
}
components {
yicesjni(NativeLibrarySpec) {
sources {
c {
source {
srcDir "src/main/c"
include "yices/*.c"
}
exportedHeaders {
srcDir "src/main/c/yices"
}
}
}
}
}
}
sourceSets {
testData {
java {
compileClasspath += main.output
runtimeClasspath += main.output
}
}
test {
java {
compileClasspath += testData.output
runtimeClasspath += testData.output
}
}
}
configurations {
testDataCompile.extendsFrom implementation
testDataRuntime.extendsFrom runtime
testImplementation.extendsFrom testDataCompile
testRuntime.extendsFrom testDataRuntime
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
test {
environment "LD_LIBRARY_PATH", "libs:build/libs/yicesjni/shared"
systemProperty "java.library.path", "libs:build/libs/yicesjni/shared"
}
classes.dependsOn 'yicesjniSharedLibrary'
// Task to run the synthesizer shell
task synthShell(description: "Runs a shell for the synthesizer", type: JavaExec) {
doFirst {
if (gradle.startParameter.consoleOutput != ConsoleOutput.Plain) {
throw new GradleScriptException("synthShell requires --console=plain", null)
}
}
classpath = sourceSets.main.runtimeClasspath
jvmArgs "-ea"
main "synth.SynthesizerShell"
environment.put("LD_LIBRARY_PATH", "libs:build/libs/yicesjni/shared")
standardInput = System.in
standardOutput = System.out
}
synthShell.dependsOn 'classes'
build.dependsOn 'jar'