2 id "com.gradle.build-scan" version "1.14"
8 sourceCompatibility = 1.8
9 targetCompatibility = 1.8
11 ext.manifestCommonAttrbutes = manifest {
13 "Built-By": System.getProperty("user.name"),
14 "Implementation-Vendor": "NASA Ames Research Center",
15 "Implementation-Version": "8.0"
20 termsOfServiceUrl = 'https://gradle.com/terms-of-service'
21 termsOfServiceAgree = 'yes'
36 testImplementation "junit:junit:4.12"
41 java.srcDirs = ["src/annotations"]
42 java.outputDir = file("${buildDir}/annotations")
45 java.srcDirs = ["src/main"]
46 java.outputDir = file("${buildDir}/main")
47 compileClasspath += sourceSets.annotations.output
50 java.srcDirs = ["src/examples"]
51 java.outputDir = file("${buildDir}/examples")
52 compileClasspath += sourceSets.main.output
55 java.srcDirs = ["src/classes"]
56 java.outputDir = file("${buildDir}/classes")
57 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
60 java.srcDirs = ["src/peers"]
61 java.outputDir = file("${buildDir}/peers")
62 compileClasspath += sourceSets.main.output + sourceSets.annotations.output
65 java.srcDirs = ["src/tests"]
66 java.outputDir = file("${buildDir}/tests")
67 compileClasspath += sourceSets.annotations.output + sourceSets.classes.output + sourceSets.peers.output
68 runtimeClasspath += compileClasspath
72 task generateVersion {
73 group = "JPF Build Resources"
74 description = "Generates the .version file with the current revision hash"
76 def revision = "git rev-parse HEAD".execute().text
77 new File(".version").withWriter("utf-8") { writer ->
78 writer.writeLine revision
83 task generateBuildInfo {
84 group = "JPF Build Resources"
85 description = "Generates the build.properties file."
88 // Must fail if there are uncommitted changes
89 def status = "git status --short".execute().text.trim()
90 if (!status.isEmpty()) {
91 throw new GradleException("There are uncomitted changes:\n " + status)
93 Properties info = new Properties()
95 def revision = "git rev-parse --short HEAD".execute().text.trim()
96 def userName = ["git", "log", "-1", "--format=%an <%ae>"].execute().text.trim()
97 def date = "git log -1 --format=%ci".execute().text.trim()
99 info.setProperty("revision", revision)
100 info.setProperty("date", date)
101 info.setProperty("author", userName)
102 info.setProperty("os.arch", System.getProperty("os.arch"))
103 info.setProperty("os.name", System.getProperty("os.name"))
104 info.setProperty("user.country", System.getProperty("user.country"))
105 info.setProperty("java.version", System.getProperty("java.version"))
107 def writer = new File("build.properties").newWriter("utf-8")
108 info.store(writer, "JPF core build info")
113 task copyResources(type: Copy) {
114 group = "JPF Build Resources"
115 description = "Copies .version and build.properties files to the build directory."
117 dependsOn generateBuildInfo
118 dependsOn generateVersion
120 from "build.properties"
121 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
124 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
129 description = "Compiles all JPF core sources."
131 // These are automatic generated tasks from the Java Gradle Plugin.
132 // Gradle is able to infer the order of the source sets
133 // due to the compileClasspath attribute
134 dependsOn compileTestJava
135 dependsOn compileExamplesJava
138 task srcDist(type: Zip) {
139 group = "JPF Distribution"
140 description = "Builds the source distribution."
142 baseName = project.name
143 version = "git rev-parse --short HEAD".execute().text.trim()
147 destinationDir = buildDir
148 includeEmptyDirs = false
151 include "build.gradle"
152 include "settings.gradle"
154 include "gradlew.bat"
155 include "gradle/**/*"
158 include "jpf.properties"
159 include "build.properties"
160 include "LICENSE-2.0.txt"
164 task dist(type: Zip) {
165 group = "JPF Distribution"
166 description = "Builds binary distribution."
168 baseName = project.name
169 version = "git rev-parse --short HEAD".execute().text.trim()
172 destinationDir = buildDir
173 includeEmptyDirs = false
176 include "jpf.properties"
177 include "build.properties"
180 include "${buildDir.name}/**/*.jar"
183 task createJpfClassesJar(type: Jar) {
184 archiveName = "jpf-classes.jar"
185 destinationDir = file("${buildDir}")
188 description = "Creates the ${archiveName} file."
191 dependsOn copyResources
193 from sourceSets.classes.java.outputDir
194 from sourceSets.annotations.java.outputDir
195 from(sourceSets.main.java.outputDir) {
196 include "gov/nasa/jpf/JPFShell.class"
197 include "gov/nasa/jpf/vm/Verify.class"
198 include "gov/nasa/jpf/util/TypeRef.class"
199 include "gov/nasa/jpf/util/test/TestJPF.class"
200 include "gov/nasa/jpf/util/test/TestMultiProcessJPF.class"
201 include "gov/nasa/jpf/util/test/TestJPFHelper.class"
205 task createJpfJar(type: Jar) {
206 archiveName = "jpf.jar"
207 destinationDir = file("${buildDir}")
210 description = "Creates the ${archiveName} file."
213 dependsOn copyResources
215 from sourceSets.main.java.outputDir
216 from sourceSets.peers.java.outputDir
217 from sourceSets.annotations.java.outputDir
218 from(sourceSets.classes.java.outputDir) {
219 include "org/junit/*.class"
223 attributes "Implementation-Title": "Java Pathfinder core system"
224 from manifestCommonAttrbutes
228 task createAnnotationsJar(type: Jar) {
229 archiveName = "jpf-annotations.jar"
230 destinationDir = file("${buildDir}")
233 description = "Creates the ${archiveName} file."
236 dependsOn copyResources
238 from sourceSets.annotations.java.outputDir
241 task createClassloaderSpecificTestsJar(type: Jar) {
242 archiveName = "classloader_specific_tests.jar"
243 destinationDir = file("${buildDir}")
246 description = "Creates the ${archiveName} file."
249 dependsOn copyResources
251 from(sourceSets.test.java.outputDir) {
252 include "classloader_specific_tests/*.class"
256 task createRunJpfJar(type: Jar) {
257 archiveName = "RunJPF.jar"
258 destinationDir = file("${buildDir}")
260 description = "Creates the ${archiveName} file."
264 dependsOn copyResources
266 from(sourceSets.main.java.outputDir) {
267 include "gov/nasa/jpf/tool/Run.class"
268 include "gov/nasa/jpf/tool/RunJPF.class"
269 include "gov/nasa/jpf/Config.class"
270 include "gov/nasa/jpf/ConfigChangeListener.class"
271 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
272 include "gov/nasa/jpf/JPFClassLoader.class"
273 include "gov/nasa/jpf/JPFShell.class"
274 include "gov/nasa/jpf/JPFException.class"
275 include "gov/nasa/jpf/JPFConfigException.class"
276 include "gov/nasa/jpf/JPFTargetException.class"
277 include "gov/nasa/jpf/util/JPFSiteUtils.class"
278 include "gov/nasa/jpf/util/FileUtils.class"
279 include "gov/nasa/jpf/util/StringMatcher.class"
280 include "gov/nasa/jpf/util/Pair.class"
284 "Implementation-Title": "Java Pathfinder core launch system",
285 "Main-Class": "gov.nasa.jpf.tool.RunJPF"
287 from manifestCommonAttrbutes
291 task createRunTestJar(type: Jar) {
292 archiveName = "RunTest.jar"
293 destinationDir = file("${buildDir}")
295 description = "Creates the ${archiveName} file."
299 dependsOn copyResources
301 from(sourceSets.main.java.outputDir) {
302 include "gov/nasa/jpf/tool/Run.class"
303 include "gov/nasa/jpf/tool/RunTest.class"
304 include "gov/nasa/jpf/tool/RunTest\$Failed.class"
305 include "gov/nasa/jpf/Config.class"
306 include "gov/nasa/jpf/ConfigChangeListener.class"
307 include "gov/nasa/jpf/Config\$MissingRequiredKeyException.class"
308 include "gov/nasa/jpf/JPFClassLoader.class"
309 include "gov/nasa/jpf/JPFException.class"
310 include "gov/nasa/jpf/JPFConfigException.class"
311 include "gov/nasa/jpf/util/JPFSiteUtils.class"
312 include "gov/nasa/jpf/util/FileUtils.class"
313 include "gov/nasa/jpf/util/StringMatcher.class"
314 include "gov/nasa/jpf/util/DevNullPrintStream.class"
318 "Implementation-Title": "Java Pathfinder test launch system",
319 "Main-Class": "gov.nasa.jpf.tool.RunTest"
321 from manifestCommonAttrbutes
327 description = "Generates all core JPF jar files."
329 dependsOn createClassloaderSpecificTestsJar
330 dependsOn createAnnotationsJar
331 dependsOn createJpfClassesJar
332 dependsOn createJpfJar
333 dependsOn createRunJpfJar
334 dependsOn createRunTestJar
338 description = "Runs core regression tests."
342 enableAssertions = true
345 maxHeapSize = "1024m"
347 include "**/*Test.class"
348 exclude "**/SplitInputStreamTest.class"
349 exclude "**/JPF_*.class"
352 events "passed", "skipped", "failed"
355 afterSuite { testDescriptor, result ->
356 if (!testDescriptor.parent) {
357 println "Test Execution: ${result.resultType}"
359 def summaryFields = ["${result.testCount} tests",
360 "${result.successfulTestCount} passed",
361 "${result.failedTestCount} failed",
362 "${result.skippedTestCount} skipped"]
364 println "Summary: " + summaryFields.join(", ")
370 group = "JPF IDE Support"
373 natures = ["org.eclipse.buildship.core.gradleprojectnature"]
376 defaultOutputDir = buildDir
378 whenMerged { classpath ->
379 classpath.entries.findAll{ entry -> entry.kind == "src" }*.every { srcNode ->
380 srcNode.output = srcNode.output.replace("bin", "${buildDir.name}")
387 defaultTasks "buildJars"