2 id "com.gradle.build-scan" version "1.14"
7 sourceCompatibility = 1.8
8 targetCompatibility = 1.8
10 ext.manifestCommonAttrbutes = manifest {
12 "Built-By": System.getProperty("user.name"),
13 "Implementation-Vendor": "NASA Ames Research Center",
14 "Implementation-Version": "1234" // FIXME
19 termsOfServiceUrl = 'https://gradle.com/terms-of-service'
20 termsOfServiceAgree = 'yes'
35 testImplementation "junit:junit:4.12"
40 java.srcDirs = ["src/annotations"]
41 java.outputDir = file("${buildDir}/annotations")
44 java.srcDirs = ["src/main"]
45 java.outputDir = file("${buildDir}/main")
46 compileClasspath += sourceSets.annotations.output
49 java.srcDirs = ["src/examples"]
50 java.outputDir = file("${buildDir}/examples")
51 compileClasspath += sourceSets.main.output
54 java.srcDirs = ["src/classes"]
55 java.outputDir = file("${buildDir}/classes")
56 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
59 java.srcDirs = ["src/peers"]
60 java.outputDir = file("${buildDir}/peers")
61 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
64 java.srcDirs = ["src/tests"]
65 java.outputDir = file("${buildDir}/tests")
66 compileClasspath += sourceSets.annotations.output + sourceSets.classes.output + sourceSets.peers.output
67 runtimeClasspath += compileClasspath
71 task generateVersion {
72 group = "JPF Build Resources"
73 description = "Generates the .version file with the current revision hash"
75 def revision = "git rev-parse HEAD".execute().text
76 new File(".version").withWriter("utf-8") { writer ->
77 writer.writeLine revision
82 task generateBuildInfo {
83 group = "JPF Build Resources"
84 description = "Generates the build.properties file."
87 // Must fail if there are uncommitted changes
88 def status = "git status --short".execute().text.trim()
89 if (!status.isEmpty()) {
90 throw new GradleException("There are uncomitted changes:\n " + status)
92 Properties info = new Properties()
94 def revision = "git rev-parse --short HEAD".execute().text.trim()
95 def userName = ["git", "log", "-1", "--format=%an <%ae>"].execute().text.trim()
96 def date = "git log -1 --format=%ci".execute().text.trim()
98 info.setProperty("revision", revision)
99 info.setProperty("date", date)
100 info.setProperty("author", userName)
101 info.setProperty("os.arch", System.getProperty("os.arch"))
102 info.setProperty("os.name", System.getProperty("os.name"))
103 info.setProperty("user.country", System.getProperty("user.country"))
104 info.setProperty("java.version", System.getProperty("java.version"))
106 def writer = new File("build.properties").newWriter("utf-8")
107 info.store(writer, "JPF core build info")
112 task copyResources(type: Copy) {
113 group = "JPF Build Resources"
114 description = "Copies .version and build.properties files to the build directory."
116 dependsOn generateBuildInfo
117 dependsOn generateVersion
119 from "build.properties"
120 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
123 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
128 description = "Compiles all JPF core sources."
130 // These are automatic generated tasks from the Java Gradle Plugin.
131 // Gradle is able to infer the order of the source sets
132 // due to the compileClasspath attribute
133 dependsOn compileTestJava
134 dependsOn compileExamplesJava
137 task srcDist(type: Zip) {
138 group = "JPF Distribution"
139 description = "Builds the source distribution."
141 baseName = project.name
142 version = "git rev-parse --short HEAD".execute().text.trim()
146 destinationDir = buildDir
147 includeEmptyDirs = false
150 include "build.gradle"
151 include "settings.gradle"
153 include "gradlew.bat"
154 include "gradle/**/*"
157 include "jpf.properties"
158 include "build.properties"
159 include "LICENSE-2.0.txt"
163 task dist(type: Zip) {
164 group = "JPF Distribution"
165 description = "Builds binary distribution."
167 baseName = project.name
168 version = "git rev-parse --short HEAD".execute().text.trim()
171 destinationDir = buildDir
172 includeEmptyDirs = false
175 include "jpf.properties"
176 include "build.properties"
179 include "${buildDir.name}/**/*.jar"
182 task createJpfClassesJar(type: Jar) {
183 archiveName = "jpf-classes.jar"
184 destinationDir = file("${buildDir}")
187 description = "Creates the ${archiveName} file."
190 dependsOn copyResources
192 from sourceSets.classes.java.outputDir
193 from sourceSets.annotations.java.outputDir
194 from(sourceSets.main.java.outputDir) {
195 include "gov/nasa/jpf/JPFShell.class"
196 include "gov/nasa/jpf/vm/Verify.class"
197 include "gov/nasa/jpf/util/TypeRef.class"
198 include "gov/nasa/jpf/util/test/TestJPF.class"
199 include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
200 include "gov/nasa/jpf/util/test/TestJPFHelper.class"
204 task createJpfJar(type: Jar) {
205 archiveName = "jpf.jar"
206 destinationDir = file("${buildDir}")
209 description = "Creates the ${archiveName} file."
212 dependsOn copyResources
214 from sourceSets.main.java.outputDir
215 from sourceSets.peers.java.outputDir
216 from sourceSets.annotations.java.outputDir
217 from(sourceSets.classes.java.outputDir) {
218 include "org/junit/*.class"
222 attributes "Implementation-Title": "Java Pathfinder core system"
223 from manifestCommonAttrbutes
227 task createAnnotationsJar(type: Jar) {
228 archiveName = "jpf-annotations.jar"
229 destinationDir = file("${buildDir}")
232 description = "Creates the ${archiveName} file."
235 dependsOn copyResources
237 from sourceSets.annotations.java.outputDir
240 task createClassloaderSpecificTestsJar(type: Jar) {
241 archiveName = "classloader_specific_tests.jar"
242 destinationDir = file("${buildDir}")
245 description = "Creates the ${archiveName} file."
248 dependsOn copyResources
250 from(sourceSets.test.java.outputDir) {
251 include "classloader_specific_tests/*.class"
255 task createRunJpfJar(type: Jar) {
256 archiveName = "RunJPF.jar"
257 destinationDir = file("${buildDir}")
259 description = "Creates the ${archiveName} file."
263 dependsOn copyResources
265 from(sourceSets.main.java.outputDir) {
266 include "gov/nasa/jpf/tool/Run.class"
267 include "gov/nasa/jpf/tool/RunJPF.class"
268 include "gov/nasa/jpf/Config.class"
269 include "gov/nasa/jpf/ConfigChangeListener.class"
270 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
271 include "gov/nasa/jpf/JPFClassLoader.class"
272 include "gov/nasa/jpf/JPFShell.class"
273 include "gov/nasa/jpf/JPFException.class"
274 include "gov/nasa/jpf/JPFConfigException.class"
275 include "gov/nasa/jpf/JPFTargetException.class"
276 include "gov/nasa/jpf/util/JPFSiteUtils.class"
277 include "gov/nasa/jpf/util/FileUtils.class"
278 include "gov/nasa/jpf/util/StringMatcher.class"
279 include "gov/nasa/jpf/util/Pair.class"
283 "Implementation-Title": "Java Pathfinder core launch system",
284 "Main-Class": "gov.nasa.jpf.tool.RunJPF"
286 from manifestCommonAttrbutes
290 task createRunTestJar(type: Jar) {
291 archiveName = "RunTest.jar"
292 destinationDir = file("${buildDir}")
294 description = "Creates the ${archiveName} file."
298 dependsOn copyResources
300 from(sourceSets.main.java.outputDir) {
301 include "gov/nasa/jpf/tool/Run.class"
302 include "gov/nasa/jpf/tool/RunTest.class"
303 include "gov/nasa/jpf/tool/RunTest\$Failed.class"
304 include "gov/nasa/jpf/Config.class"
305 include "gov/nasa/jpf/ConfigChangeListener.class"
306 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
307 include "gov/nasa/jpf/JPFClassLoader.class"
308 include "gov/nasa/jpf/JPFException.class"
309 include "gov/nasa/jpf/JPFConfigException.class"
310 include "gov/nasa/jpf/util/JPFSiteUtils.class"
311 include "gov/nasa/jpf/util/FileUtils.class"
312 include "gov/nasa/jpf/util/StringMatcher.class"
313 include "gov/nasa/jpf/util/DevNullPrintStream.class"
317 "Implementation-Title": "Java Pathfinder test launch system",
318 "Main-Class": "gov.nasa.jpf.tool.RunTest"
320 from manifestCommonAttrbutes
326 description = "Generates all core JPF jar files."
328 dependsOn createClassloaderSpecificTestsJar
329 dependsOn createAnnotationsJar
330 dependsOn createJpfClassesJar
331 dependsOn createJpfJar
332 dependsOn createRunJpfJar
333 dependsOn createRunTestJar
337 description = "Runs core regression tests."
341 enableAssertions = true
344 maxHeapSize = "1024m"
346 include "**/*Test.class"
347 exclude "**/SplitInputStreamTest.class"
348 exclude "**/JPF_*.class"
351 events "passed", "skipped", "failed"
354 afterSuite { testDescriptor, result ->
355 if (!testDescriptor.parent) {
356 println "Test Execution: ${result.resultType}"
358 def summaryFields = ["${result.testCount} tests",
359 "${result.successfulTestCount} passed",
360 "${result.failedTestCount} failed",
361 "${result.skippedTestCount} skipped"]
363 println "Summary: " + summaryFields.join(", ")
368 defaultTasks "buildJars"