First part of boolean flip seems to be clean; need to debug the second part and figur...
[jpf-core.git] / build.gradle
1 apply plugin: "java"
2
3 sourceCompatibility = 1.8
4 targetCompatibility = 1.8
5
6 repositories {
7     mavenCentral()
8 }
9
10 buildscript {
11     repositories {
12         maven {
13             url "https://plugins.gradle.org/m2/"
14         }
15     }
16     dependencies {
17         classpath "gradle.plugin.com.palantir.gradle.gitversion:gradle-git-version:0.11.0"
18     }
19 }
20
21 dependencies {
22     testImplementation "junit:junit:4.12"
23 }
24
25 apply plugin: "com.palantir.git-version"
26 version gitVersion()
27 def gitDetails = versionDetails()
28
29 ext.manifestCommonAttrbutes = manifest {
30     attributes(
31         "Built-By": System.getProperty("user.name"),
32         "Implementation-Vendor": "NASA Ames Research Center",
33         "Specification-Version": gitDetails.lastTag,
34         "Implementation-Version": gitDetails.gitHashFull
35     )
36 }
37
38 apply from: "gradle/ide-support.gradle"
39 apply from: "gradle/distribution.gradle"
40 apply from: "gradle/source-sets.gradle"
41 apply from: "gradle/build-resources.gradle"
42
43 task compile {
44     group = "JPF Build"
45     description = "Compiles all JPF core sources."
46
47     // These are automatic generated tasks from the Java Gradle Plugin.
48     // Gradle is able to infer the order of the source sets
49     // due to the compileClasspath attribute
50     dependsOn compileTestJava
51     dependsOn compileExamplesJava
52 }
53
54 task createJpfClassesJar(type: Jar) {
55     archiveName = "jpf-classes.jar"
56     destinationDir = file("${buildDir}")
57
58     group = "JPF Jars"
59     description = "Creates the ${archiveName} file."
60
61     dependsOn compile
62     dependsOn copyResources
63
64     from sourceSets.classes.java.outputDir
65     from sourceSets.annotations.java.outputDir
66     from(sourceSets.main.java.outputDir) {
67         include "gov/nasa/jpf/JPFShell.class"
68         include "gov/nasa/jpf/vm/Verify.class"
69         include "gov/nasa/jpf/util/TypeRef.class"
70         include "gov/nasa/jpf/util/test/TestJPF.class"
71         include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
72         include "gov/nasa/jpf/util/test/TestJPFHelper.class"
73     }
74 }
75
76 task createJpfJar(type: Jar) {
77     archiveName = "jpf.jar"
78     destinationDir = file("${buildDir}")
79
80     group = "JPF Jars"
81     description = "Creates the ${archiveName} file."
82
83     dependsOn compile
84     dependsOn copyResources
85
86     from sourceSets.main.java.outputDir
87     from sourceSets.peers.java.outputDir
88     from sourceSets.annotations.java.outputDir
89     from(sourceSets.classes.java.outputDir) {
90         include "org/junit/*.class"
91     }
92
93     manifest {
94         attributes "Implementation-Title": "Java Pathfinder core system"
95         from manifestCommonAttrbutes
96     }
97 }
98
99 task createAnnotationsJar(type: Jar) {
100     archiveName = "jpf-annotations.jar"
101     destinationDir = file("${buildDir}")
102
103     group = "JPF Jars"
104     description = "Creates the ${archiveName} file."
105
106     dependsOn compile
107     dependsOn copyResources
108
109     from sourceSets.annotations.java.outputDir
110 }
111
112 task createClassloaderSpecificTestsJar(type: Jar) {
113     archiveName = "classloader_specific_tests.jar"
114     destinationDir = file("${buildDir}")
115
116     group = "JPF Jars"
117     description = "Creates the ${archiveName} file."
118
119     dependsOn compile
120     dependsOn copyResources
121
122     from(sourceSets.test.java.outputDir) {
123         include "classloader_specific_tests/*.class"
124     }
125 }
126
127 task createRunJpfJar(type: Jar) {
128     archiveName = "RunJPF.jar"
129     destinationDir = file("${buildDir}")
130
131     description = "Creates the ${archiveName} file."
132     group = "JPF Jars"
133
134     dependsOn compile
135     dependsOn copyResources
136
137     from(sourceSets.main.java.outputDir) {
138         include "gov/nasa/jpf/tool/Run.class"
139         include "gov/nasa/jpf/tool/RunJPF.class"
140         include "gov/nasa/jpf/Config.class"
141         include "gov/nasa/jpf/ConfigChangeListener.class"
142         include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
143         include "gov/nasa/jpf/JPFClassLoader.class"
144         include "gov/nasa/jpf/JPFShell.class"
145         include "gov/nasa/jpf/JPFException.class"
146         include "gov/nasa/jpf/JPFConfigException.class"
147         include "gov/nasa/jpf/JPFTargetException.class"
148         include "gov/nasa/jpf/util/JPFSiteUtils.class"
149         include "gov/nasa/jpf/util/FileUtils.class"
150         include "gov/nasa/jpf/util/StringMatcher.class"
151         include "gov/nasa/jpf/util/Pair.class"
152     }
153     manifest {
154         attributes(
155             "Implementation-Title": "Java Pathfinder core launch system",
156             "Main-Class": "gov.nasa.jpf.tool.RunJPF"
157         )
158         from manifestCommonAttrbutes
159     }
160 }
161
162 task createRunTestJar(type: Jar) {
163     archiveName = "RunTest.jar"
164     destinationDir = file("${buildDir}")
165
166     description = "Creates the ${archiveName} file."
167     group = "JPF Jars"
168
169     dependsOn compile
170     dependsOn copyResources
171
172     from(sourceSets.main.java.outputDir) {
173         include "gov/nasa/jpf/tool/Run.class"
174         include "gov/nasa/jpf/tool/RunTest.class"
175         include "gov/nasa/jpf/tool/RunTest\$Failed.class"
176         include "gov/nasa/jpf/Config.class"
177         include "gov/nasa/jpf/ConfigChangeListener.class"
178         include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
179         include "gov/nasa/jpf/JPFClassLoader.class"
180         include "gov/nasa/jpf/JPFException.class"
181         include "gov/nasa/jpf/JPFConfigException.class"
182         include "gov/nasa/jpf/util/JPFSiteUtils.class"
183         include "gov/nasa/jpf/util/FileUtils.class"
184         include "gov/nasa/jpf/util/StringMatcher.class"
185         include "gov/nasa/jpf/util/DevNullPrintStream.class"
186     }
187     manifest {
188         attributes(
189             "Implementation-Title": "Java Pathfinder test launch system",
190             "Main-Class": "gov.nasa.jpf.tool.RunTest"
191         )
192         from manifestCommonAttrbutes
193     }
194 }
195
196 task buildJars {
197     group = "JPF Build"
198     description = "Generates all core JPF jar files."
199
200     dependsOn createClassloaderSpecificTestsJar
201     dependsOn createAnnotationsJar
202     dependsOn createJpfClassesJar
203     dependsOn createJpfJar
204     dependsOn createRunJpfJar
205     dependsOn createRunTestJar
206 }
207
208 test {
209     description = "Runs core regression tests."
210
211     dependsOn buildJars
212
213     forkEvery = 1
214     enableAssertions = true
215     maxHeapSize = "1024m"
216
217     include "**/*Test.class"
218     exclude "**/SplitInputStreamTest.class"
219     exclude "**/JPF_*.class"
220
221     testLogging {
222         events "passed", "skipped", "failed"
223     }
224
225     afterSuite { testDescriptor, result ->
226         if (!testDescriptor.parent) {
227             println "Test Execution: ${result.resultType}"
228
229             def summaryFields = ["${result.testCount} tests",
230                                  "${result.successfulTestCount} passed",
231                                  "${result.failedTestCount} failed",
232                                  "${result.skippedTestCount} skipped"]
233
234             println "Summary: " + summaryFields.join(", ")
235         }
236     }
237 }
238
239 defaultTasks "buildJars"