Copying build.properties to output dir (fixes #64)
[jpf-core.git] / build.gradle
1 apply plugin: "java"
2
3 sourceCompatibility = 1.8
4 targetCompatibility = 1.8
5
6 repositories {
7     mavenCentral()
8 }
9
10 dependencies {
11     testImplementation "junit:junit:4.12"
12 }
13
14 sourceSets {
15     annotations {
16         java.srcDirs = ["src/annotations"]
17         java.outputDir = file("${buildDir}/annotations")
18     }
19     main {
20         java.srcDirs = ["src/main"]
21         java.outputDir = file("${buildDir}/main")
22         compileClasspath += sourceSets.annotations.output
23     }
24     examples {
25         java.srcDirs = ["src/examples"]
26         java.outputDir = file("${buildDir}/examples")
27         compileClasspath += sourceSets.main.output
28     }
29     classes {
30         java.srcDirs = ["src/classes"]
31         java.outputDir = file("${buildDir}/classes")
32         compileClasspath += sourceSets.main.output + sourceSets.annotations.output
33     }
34     peers {
35         java.srcDirs = ["src/peers"]
36         java.outputDir = file("${buildDir}/peers")
37         compileClasspath += sourceSets.main.output + sourceSets.annotations.output
38     }
39     test {
40         java.srcDirs = ["src/tests"]
41         java.outputDir = file("${buildDir}/tests")
42         compileClasspath += sourceSets.annotations.output + sourceSets.classes.output + sourceSets.peers.output
43     }
44 }
45
46 test {
47     enableAssertions = true
48     forkEvery = 1
49
50     maxHeapSize = "1024m"
51
52     include "**/*Test.class"
53     exclude "**/SplitInputStreamTest.class"
54     exclude "**/JPF_*.class"
55
56     // XXX Tests temporarily ignored because they are not fully supported in the Gradle build yet
57     new File("failing-tests.txt").eachLine { failedTestClass ->
58         def ignoredPath = "**/" + failedTestClass.replace(".", "/") + ".class"
59         exclude ignoredPath
60     }
61
62     testLogging {
63         events "passed", "skipped", "failed"
64     }
65
66     afterSuite { testDescriptor, result ->
67         if (!testDescriptor.parent) {
68             println "Test Execution: ${result.resultType}"
69
70             def summaryFields = ["${result.testCount} tests",
71                                  "${result.successfulTestCount} passed",
72                                  "${result.failedTestCount} failed",
73                                  "${result.skippedTestCount} skipped"]
74
75             println "Summary: " + summaryFields.join(", ")
76         }
77     }
78 }
79
80 task compile(type: Copy) {
81     group = "JPF Build"
82     description = "Compile all JPF core sources"
83
84     // These are automatic generated tasks from the Java Gradle Plugin.
85     // Gradle is able to infer the ordering of the source source sets
86     // due to the compileClasspath attribute
87     dependsOn compileTestJava, compileExamplesJava
88
89     // Copies build.properties file to the build directory
90     from "build.properties"
91     into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
92 }
93
94 defaultTasks "compile"