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 jpfClassesJar(type: Jar) {
112 archiveName = "jpf-classes.jar"
113 destinationDir = file("${buildDir}")
115 description = "Creates the ${archiveName} file."
120 from sourceSets.classes.java.outputDir
121 from sourceSets.annotations.java.outputDir
122 from(sourceSets.main.java.outputDir) {
123 include "gov/nasa/jpf/JPFShell.class"
124 include "gov/nasa/jpf/vm/Verify.class"
125 include "gov/nasa/jpf/util/TypeRef.class"
126 include "gov/nasa/jpf/util/test/TestJPF.class"
127 include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
128 include "gov/nasa/jpf/util/test/TestJPFHelper.class"
132 task jpfJar(type: Jar) {
133 archiveName = "jpf.jar"
134 destinationDir = file("${buildDir}")
136 description = "Creates the ${archiveName} file."
141 from sourceSets.main.java.outputDir
142 from sourceSets.peers.java.outputDir
143 from sourceSets.annotations.java.outputDir
144 from(sourceSets.classes.java.outputDir) {
145 include "org/junit/*.class"
150 "Built-By": System.getProperty("user.name"),
151 "Implementation-Vendor": "NASA Ames Research Center",
152 "Implementation-Title": "Java Pathfinder core system",
153 "Implementation-Version": "1234" //FIXME
158 task annotationsJar(type: Jar) {
159 archiveName = "jpf-annotations.jar"
160 destinationDir = file("${buildDir}")
162 description = "Creates the ${archiveName} file."
167 from sourceSets.annotations.java.outputDir
170 task classloaderSpecificTestsJar(type: Jar) {
171 archiveName = "classloader_specific_tests.jar"
172 destinationDir = file("${buildDir}")
174 description = "Creates the ${archiveName} file."
179 from(sourceSets.test.java.outputDir) {
180 include "classloader_specific_tests/*.class"
184 task runJpfJar(type: Jar) {
185 archiveName = "RunJPF.jar"
186 destinationDir = file("${buildDir}")
188 description = "Creates the ${archiveName} file."
193 from(sourceSets.main.java.outputDir) {
194 include "gov/nasa/jpf/tool/Run.class"
195 include "gov/nasa/jpf/tool/RunJPF.class"
196 include "gov/nasa/jpf/Config.class"
197 include "gov/nasa/jpf/ConfigChangeListener.class"
198 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
199 include "gov/nasa/jpf/JPFClassLoader.class"
200 include "gov/nasa/jpf/JPFShell.class"
201 include "gov/nasa/jpf/JPFException.class"
202 include "gov/nasa/jpf/JPFConfigException.class"
203 include "gov/nasa/jpf/JPFTargetException.class"
204 include "gov/nasa/jpf/util/JPFSiteUtils.class"
205 include "gov/nasa/jpf/util/FileUtils.class"
206 include "gov/nasa/jpf/util/StringMatcher.class"
207 include "gov/nasa/jpf/util/Pair.class"
211 "Built-By": System.getProperty("user.name"),
212 "Implementation-Vendor": "NASA Ames Research Center",
213 "Implementation-Title": "Java Pathfinder core launch system",
214 "Implementation-Version": "1234", //FIXME
215 "Main-Class": "gov.nasa.jpf.tool.RunJPF"
220 task runTestJar(type: Jar) {
221 archiveName = "RunTest.jar"
222 destinationDir = file("${buildDir}")
224 description = "Creates the ${archiveName} file."
229 from(sourceSets.main.java.outputDir) {
230 include "gov/nasa/jpf/tool/Run.class"
231 include "gov/nasa/jpf/tool/RunTest.class"
232 include "gov/nasa/jpf/tool/RunTest\$Failed.class"
233 include "gov/nasa/jpf/Config.class"
234 include "gov/nasa/jpf/ConfigChangeListener.class"
235 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
236 include "gov/nasa/jpf/JPFClassLoader.class"
237 include "gov/nasa/jpf/JPFException.class"
238 include "gov/nasa/jpf/JPFConfigException.class"
239 include "gov/nasa/jpf/util/JPFSiteUtils.class"
240 include "gov/nasa/jpf/util/FileUtils.class"
241 include "gov/nasa/jpf/util/StringMatcher.class"
242 include "gov/nasa/jpf/util/DevNullPrintStream.class"
246 "Built-By": System.getProperty("user.name"),
247 "Implementation-Vendor": "NASA Ames Research Center",
248 "Implementation-Title": "Java Pathfinder test launch system",
249 "Implementation-Version": "1234", // FIXME
250 "Main-Class": "gov.nasa.jpf.tool.RunTest"
257 description = "Generates the core JPF jar files."
259 dependsOn classloaderSpecificTestsJar, annotationsJar,
260 jpfClassesJar, jpfJar, runJpfJar,
266 description = "Runs core regression tests."
270 enableAssertions = true
273 maxHeapSize = "1024m"
275 include "**/*Test.class"
276 exclude "**/SplitInputStreamTest.class"
277 exclude "**/JPF_*.class"
280 events "passed", "skipped", "failed"
283 afterSuite { testDescriptor, result ->
284 if (!testDescriptor.parent) {
285 println "Test Execution: ${result.resultType}"
287 def summaryFields = ["${result.testCount} tests",
288 "${result.successfulTestCount} passed",
289 "${result.failedTestCount} failed",
290 "${result.skippedTestCount} skipped"]
292 println "Summary: " + summaryFields.join(", ")
297 defaultTasks "buildJars"