-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
160 lines (122 loc) · 4.35 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
apply plugin: "java"
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
repositories {
mavenCentral()
}
// find home directory
ext.userHome = System.getProperty("user.home")
// find JPF's site.properties
Properties siteProperties = new java.util.Properties()
try {
FileInputStream file = new FileInputStream("${userHome}/.jpf/site.properties")
siteProperties.load(file)
file.close()
} catch (FileNotFoundException e) {
throw new GradleException("Please install jpf-core first and add the property 'jpf-core' to ${userHome}/.jpf/site.properties pointing to the jpf-core installation")
}
// find jpf-core
ext.jpfCoreExists = false
ext.jpfCore = siteProperties.getProperty("jpf-core")
if (jpfCore != null) {
jpfCore = jpfCore.replace('${user.home}', userHome)
jpfCoreExists = new File(jpfCore).exists()
}
if (!jpfCoreExists) {
throw new GradleException("${userHome}/.jpf/site.properties points to the jpf-core installation at ${jpfCore} but that directory does not exist")
}
// find jpf-label
ext.jpfLabel = siteProperties.getProperty("jpf-label")
ext.jpfLabelExists = false
if (jpfLabel != null) {
jpfLabel = jpfLabel.replace('${user.home}', userHome)
jpfLabelExists = new File(jpfLabel).exists()
}
configurations {
examplesImplementation
}
dependencies {
implementation files("${jpfCore}/build/jpf.jar")
if (jpfLabelExists) {
implementation files("${jpfLabel}/build/jpf-label.jar")
}
testImplementation "junit:junit:4.12"
examplesImplementation("net.objecthunter:exp4j:0.4.8", "org.apache.commons:commons-math3:3.6.1")
}
apply from: "gradle/source-sets.gradle"
configurations.examplesImplementation.setCanBeResolved(true)
task copyDependencies(type: Copy) {
from configurations.examplesImplementation
into "lib"
}
task compile {
group = "jpf-probabilistic build"
description = "Compiles all jpf-probabilistic sources."
dependsOn compilePeersJava
dependsOn compileExamplesJava
dependsOn copyDependencies
}
task createJpfProbabilisticJar(type: Jar) {
archiveName = "jpf-probabilistic.jar"
destinationDir = file("${buildDir}")
group = "jpf-probabilistic jars"
description = "Creates the ${archiveName} file."
dependsOn compile
from sourceSets.main.java.outputDir
from sourceSets.peers.java.outputDir
}
task createJpfProbabilisticClassesJar(type: Jar) {
archiveName = "jpf-probabilistic-classes.jar"
destinationDir = file("${buildDir}")
group = "jpf-probabilistic jars"
description = "Creates the ${archiveName} file."
dependsOn compile
from sourceSets.classes.java.outputDir
}
task createJpfProbabilisticExamplesJar(type: Jar) {
archiveName = "jpf-probabilistic-examples.jar"
destinationDir = file("${buildDir}")
group = "jpf-probabilistic jars"
description = "Creates the ${archiveName} file."
dependsOn compile
from sourceSets.examples.java.outputDir
}
task buildJars {
group = "jpf-probabilistic build"
description = "Generates all jpf-probabilistic jar files."
dependsOn createJpfProbabilisticJar
dependsOn createJpfProbabilisticClassesJar
dependsOn createJpfProbabilisticExamplesJar
}
task api(type: Javadoc) {
group = "documentation"
description = "Generates the jpf-probabilistic API."
source = sourceSets.main.allJava
classpath = configurations.testCompileClasspath
options.tags = [ 'pre.:a:Preconditions:' ]
}
test {
description = "Runs tests"
dependsOn buildJars
forkEvery = 1
enableAssertions = true
maxHeapSize = "1024m"
include "**/*Test.class"
if (!jpfLabelExists) {
exclude "**/StateSpaceTest.class"
}
testLogging {
events "passed", "skipped", "failed"
}
afterSuite { testDescriptor, result ->
if (!testDescriptor.parent) {
println "Test Execution: ${result.resultType}"
def summaryFields = ["${result.testCount} tests",
"${result.successfulTestCount} passed",
"${result.failedTestCount} failed",
"${result.skippedTestCount} skipped"]
println "Summary: " + summaryFields.join(", ")
}
}
}
defaultTasks "buildJars"