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
64 group = "JPF Build Properties"
65 description = "Creates build info properties."
68 // Must fail if there are uncommitted changes
69 def status = "git status --short".execute().text.trim()
70 if (!status.isEmpty()) {
71 throw new GradleException("There are uncomitted changes:\n " + status)
73 Properties info = new Properties()
75 def revision = "git rev-parse --short HEAD".execute().text.trim()
76 def userName = ["git", "log", "-1", "--format=%an <%ae>"].execute().text.trim()
77 def date = "git log -1 --format=%ci".execute().text.trim()
79 info.setProperty("revision", revision)
80 info.setProperty("date", date)
81 info.setProperty("author", userName)
82 info.setProperty("os.arch", System.getProperty("os.arch"))
83 info.setProperty("os.name", System.getProperty("os.name"))
84 info.setProperty("user.country", System.getProperty("user.country"))
85 info.setProperty("java.version", System.getProperty("java.version"))
87 def writer = new File("build.properties").newWriter("utf-8")
88 info.store(writer, "JPF core build info")
93 task compile(type: Copy) {
95 description = "Compiles all JPF core sources."
97 // These are automatic generated tasks from the Java Gradle Plugin.
98 // Gradle is able to infer the ordering of the source sets
99 // due to the compileClasspath attribute
100 dependsOn compileTestJava, compileExamplesJava, generateVersion
102 // Copies build.properties file to the build directory
103 from "build.properties"
104 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
106 // Copies .version file to the build directory
108 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
111 task srcDist(type: Zip) {
113 description = "Builds the source distribution"
115 baseName = project.name
116 version = "git rev-parse --short HEAD".execute().text.trim()
120 destinationDir = buildDir
121 includeEmptyDirs = false
124 include "build.gradle"
125 include "settings.gradle"
127 include "gradlew.bat"
128 include "gradle/**/*"
129 include "nbproject/**/*"
130 include "eclipse/**/*"
133 include "jpf.properties"
134 include "build.properties"
135 include "LICENSE-2.0.txt"
139 task dist(type: Zip) {
141 description = "Builds binary distribution"
143 baseName = project.name
144 version = "git rev-parse --short HEAD".execute().text.trim()
147 destinationDir = buildDir
148 includeEmptyDirs = false
151 include "jpf.properties"
152 include "build.properties"
155 include "${buildDir.name}/**/*.jar"
158 task jpfClassesJar(type: Jar) {
159 archiveName = "jpf-classes.jar"
160 destinationDir = file("${buildDir}")
162 description = "Creates the ${archiveName} file."
167 from sourceSets.classes.java.outputDir
168 from sourceSets.annotations.java.outputDir
169 from(sourceSets.main.java.outputDir) {
170 include "gov/nasa/jpf/JPFShell.class"
171 include "gov/nasa/jpf/vm/Verify.class"
172 include "gov/nasa/jpf/util/TypeRef.class"
173 include "gov/nasa/jpf/util/test/TestJPF.class"
174 include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
175 include "gov/nasa/jpf/util/test/TestJPFHelper.class"
179 task jpfJar(type: Jar) {
180 archiveName = "jpf.jar"
181 destinationDir = file("${buildDir}")
183 description = "Creates the ${archiveName} file."
188 from sourceSets.main.java.outputDir
189 from sourceSets.peers.java.outputDir
190 from sourceSets.annotations.java.outputDir
191 from(sourceSets.classes.java.outputDir) {
192 include "org/junit/*.class"
197 "Built-By": System.getProperty("user.name"),
198 "Implementation-Vendor": "NASA Ames Research Center",
199 "Implementation-Title": "Java Pathfinder core system",
200 "Implementation-Version": "1234" //FIXME
205 task annotationsJar(type: Jar) {
206 archiveName = "jpf-annotations.jar"
207 destinationDir = file("${buildDir}")
209 description = "Creates the ${archiveName} file."
214 from sourceSets.annotations.java.outputDir
217 task classloaderSpecificTestsJar(type: Jar) {
218 archiveName = "classloader_specific_tests.jar"
219 destinationDir = file("${buildDir}")
221 description = "Creates the ${archiveName} file."
226 from(sourceSets.test.java.outputDir) {
227 include "classloader_specific_tests/*.class"
231 task runJpfJar(type: Jar) {
232 archiveName = "RunJPF.jar"
233 destinationDir = file("${buildDir}")
235 description = "Creates the ${archiveName} file."
240 from(sourceSets.main.java.outputDir) {
241 include "gov/nasa/jpf/tool/Run.class"
242 include "gov/nasa/jpf/tool/RunJPF.class"
243 include "gov/nasa/jpf/Config.class"
244 include "gov/nasa/jpf/ConfigChangeListener.class"
245 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
246 include "gov/nasa/jpf/JPFClassLoader.class"
247 include "gov/nasa/jpf/JPFShell.class"
248 include "gov/nasa/jpf/JPFException.class"
249 include "gov/nasa/jpf/JPFConfigException.class"
250 include "gov/nasa/jpf/JPFTargetException.class"
251 include "gov/nasa/jpf/util/JPFSiteUtils.class"
252 include "gov/nasa/jpf/util/FileUtils.class"
253 include "gov/nasa/jpf/util/StringMatcher.class"
254 include "gov/nasa/jpf/util/Pair.class"
258 "Built-By": System.getProperty("user.name"),
259 "Implementation-Vendor": "NASA Ames Research Center",
260 "Implementation-Title": "Java Pathfinder core launch system",
261 "Implementation-Version": "1234", //FIXME
262 "Main-Class": "gov.nasa.jpf.tool.RunJPF"
267 task runTestJar(type: Jar) {
268 archiveName = "RunTest.jar"
269 destinationDir = file("${buildDir}")
271 description = "Creates the ${archiveName} file."
276 from(sourceSets.main.java.outputDir) {
277 include "gov/nasa/jpf/tool/Run.class"
278 include "gov/nasa/jpf/tool/RunTest.class"
279 include "gov/nasa/jpf/tool/RunTest\$Failed.class"
280 include "gov/nasa/jpf/Config.class"
281 include "gov/nasa/jpf/ConfigChangeListener.class"
282 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
283 include "gov/nasa/jpf/JPFClassLoader.class"
284 include "gov/nasa/jpf/JPFException.class"
285 include "gov/nasa/jpf/JPFConfigException.class"
286 include "gov/nasa/jpf/util/JPFSiteUtils.class"
287 include "gov/nasa/jpf/util/FileUtils.class"
288 include "gov/nasa/jpf/util/StringMatcher.class"
289 include "gov/nasa/jpf/util/DevNullPrintStream.class"
293 "Built-By": System.getProperty("user.name"),
294 "Implementation-Vendor": "NASA Ames Research Center",
295 "Implementation-Title": "Java Pathfinder test launch system",
296 "Implementation-Version": "1234", // FIXME
297 "Main-Class": "gov.nasa.jpf.tool.RunTest"
304 description = "Generates the core JPF jar files."
308 dependsOn classloaderSpecificTestsJar, annotationsJar,
309 jpfClassesJar, jpfJar, runJpfJar,
315 description = "Runs core regression tests."
319 enableAssertions = true
322 maxHeapSize = "1024m"
324 include "**/*Test.class"
325 exclude "**/SplitInputStreamTest.class"
326 exclude "**/JPF_*.class"
329 events "passed", "skipped", "failed"
332 afterSuite { testDescriptor, result ->
333 if (!testDescriptor.parent) {
334 println "Test Execution: ${result.resultType}"
336 def summaryFields = ["${result.testCount} tests",
337 "${result.successfulTestCount} passed",
338 "${result.failedTestCount} failed",
339 "${result.skippedTestCount} skipped"]
341 println "Summary: " + summaryFields.join(", ")
346 defaultTasks "buildJars"