3 sourceCompatibility = 1.8
4 targetCompatibility = 1.8
11 testImplementation "junit:junit:4.12"
16 java.srcDirs = ["src/annotations"]
17 java.outputDir = file("${buildDir}/annotations")
20 java.srcDirs = ["src/main"]
21 java.outputDir = file("${buildDir}/main")
22 compileClasspath += sourceSets.annotations.output
25 java.srcDirs = ["src/examples"]
26 java.outputDir = file("${buildDir}/examples")
27 compileClasspath += sourceSets.main.output
30 java.srcDirs = ["src/classes"]
31 java.outputDir = file("${buildDir}/classes")
32 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
35 java.srcDirs = ["src/peers"]
36 java.outputDir = file("${buildDir}/peers")
37 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
40 java.srcDirs = ["src/tests"]
41 java.outputDir = file("${buildDir}/tests")
42 compileClasspath += sourceSets.annotations.output + sourceSets.classes.output + sourceSets.peers.output
43 runtimeClasspath += compileClasspath
51 task generateVersion {
52 description = "Generates the .version file with the current revision hash"
53 group = "JPF Build Properties"
56 def revision = "git rev-parse HEAD".execute().text
57 new File(".version").withWriter("utf-8") { writer ->
58 writer.writeLine revision
63 task compile(type: Copy) {
65 description = "Compiles all JPF core sources."
67 // These are automatic generated tasks from the Java Gradle Plugin.
68 // Gradle is able to infer the ordering of the source sets
69 // due to the compileClasspath attribute
70 dependsOn compileTestJava, compileExamplesJava, generateVersion
72 // Copies build.properties file to the build directory
73 from "build.properties"
74 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
76 // Copies .version file to the build directory
78 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
81 task jpfClassesJar(type: Jar) {
82 archiveName = "jpf-classes.jar"
83 destinationDir = file("${buildDir}")
85 description = "Creates the ${archiveName} file."
90 from sourceSets.classes.java.outputDir
91 from sourceSets.annotations.java.outputDir
92 from(sourceSets.main.java.outputDir) {
93 include "gov/nasa/jpf/JPFShell.class"
94 include "gov/nasa/jpf/vm/Verify.class"
95 include "gov/nasa/jpf/util/TypeRef.class"
96 include "gov/nasa/jpf/util/test/TestJPF.class"
97 include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
98 include "gov/nasa/jpf/util/test/TestJPFHelper.class"
102 task jpfJar(type: Jar) {
103 archiveName = "jpf.jar"
104 destinationDir = file("${buildDir}")
106 description = "Creates the ${archiveName} file."
111 from sourceSets.main.java.outputDir
112 from sourceSets.peers.java.outputDir
113 from sourceSets.annotations.java.outputDir
114 from(sourceSets.classes.java.outputDir) {
115 include "org/junit/*.class"
120 "Built-By": System.getProperty("user.name"),
121 "Implementation-Vendor": "NASA Ames Research Center",
122 "Implementation-Title": "Java Pathfinder core system",
123 "Implementation-Version": "1234" //FIXME
128 task annotationsJar(type: Jar) {
129 archiveName = "jpf-annotations.jar"
130 destinationDir = file("${buildDir}")
132 description = "Creates the ${archiveName} file."
137 from sourceSets.annotations.java.outputDir
140 task classloaderSpecificTestsJar(type: Jar) {
141 archiveName = "classloader_specific_tests.jar"
142 destinationDir = file("${buildDir}")
144 description = "Creates the ${archiveName} file."
149 from(sourceSets.test.java.outputDir) {
150 include "classloader_specific_tests/*.class"
154 task runJpfJar(type: Jar) {
155 archiveName = "RunJPF.jar"
156 destinationDir = file("${buildDir}")
158 description = "Creates the ${archiveName} file."
163 from(sourceSets.main.java.outputDir) {
164 include "gov/nasa/jpf/tool/Run.class"
165 include "gov/nasa/jpf/tool/RunJPF.class"
166 include "gov/nasa/jpf/Config.class"
167 include "gov/nasa/jpf/ConfigChangeListener.class"
168 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
169 include "gov/nasa/jpf/JPFClassLoader.class"
170 include "gov/nasa/jpf/JPFShell.class"
171 include "gov/nasa/jpf/JPFException.class"
172 include "gov/nasa/jpf/JPFConfigException.class"
173 include "gov/nasa/jpf/JPFTargetException.class"
174 include "gov/nasa/jpf/util/JPFSiteUtils.class"
175 include "gov/nasa/jpf/util/FileUtils.class"
176 include "gov/nasa/jpf/util/StringMatcher.class"
177 include "gov/nasa/jpf/util/Pair.class"
181 "Built-By": System.getProperty("user.name"),
182 "Implementation-Vendor": "NASA Ames Research Center",
183 "Implementation-Title": "Java Pathfinder core launch system",
184 "Implementation-Version": "1234", //FIXME
185 "Main-Class": "gov.nasa.jpf.tool.RunJPF"
190 task runTestJar(type: Jar) {
191 archiveName = "RunTest.jar"
192 destinationDir = file("${buildDir}")
194 description = "Creates the ${archiveName} file."
199 from(sourceSets.main.java.outputDir) {
200 include "gov/nasa/jpf/tool/Run.class"
201 include "gov/nasa/jpf/tool/RunTest.class"
202 include "gov/nasa/jpf/tool/RunTest\$Failed.class"
203 include "gov/nasa/jpf/Config.class"
204 include "gov/nasa/jpf/ConfigChangeListener.class"
205 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
206 include "gov/nasa/jpf/JPFClassLoader.class"
207 include "gov/nasa/jpf/JPFException.class"
208 include "gov/nasa/jpf/JPFConfigException.class"
209 include "gov/nasa/jpf/util/JPFSiteUtils.class"
210 include "gov/nasa/jpf/util/FileUtils.class"
211 include "gov/nasa/jpf/util/StringMatcher.class"
212 include "gov/nasa/jpf/util/DevNullPrintStream.class"
216 "Built-By": System.getProperty("user.name"),
217 "Implementation-Vendor": "NASA Ames Research Center",
218 "Implementation-Title": "Java Pathfinder test launch system",
219 "Implementation-Version": "1234", // FIXME
220 "Main-Class": "gov.nasa.jpf.tool.RunTest"
227 description = "Generates the core JPF jar files."
229 dependsOn classloaderSpecificTestsJar, annotationsJar,
230 jpfClassesJar, jpfJar, runJpfJar,
236 description = "Runs core regression tests."
240 enableAssertions = true
243 maxHeapSize = "1024m"
245 include "**/*Test.class"
246 exclude "**/SplitInputStreamTest.class"
247 exclude "**/JPF_*.class"
250 events "passed", "skipped", "failed"
253 afterSuite { testDescriptor, result ->
254 if (!testDescriptor.parent) {
255 println "Test Execution: ${result.resultType}"
257 def summaryFields = ["${result.testCount} tests",
258 "${result.successfulTestCount} passed",
259 "${result.failedTestCount} failed",
260 "${result.skippedTestCount} skipped"]
262 println "Summary: " + summaryFields.join(", ")
267 defaultTasks "buildJars"