2 group = "JPF Build Resources"
3 description = "Generates the .version file with the current revision hash"
5 def revision = "git rev-parse HEAD".execute().text
6 new File(".version").withWriter("utf-8") { writer ->
7 writer.writeLine revision
12 task generateBuildInfo {
13 group = "JPF Build Resources"
14 description = "Generates the build.properties file."
17 Properties info = new Properties()
19 def status = "git status --short".execute().text.trim()
20 def revision = "git rev-parse --short HEAD".execute().text.trim()
21 def userName = ["git", "log", "-1", "--format=%an <%ae>"].execute().text.trim()
22 def date = "git log -1 --format=%ci".execute().text.trim()
24 info.setProperty("revision", revision)
25 info.setProperty("date", date)
26 info.setProperty("author", userName)
27 info.setProperty("os.arch", System.getProperty("os.arch"))
28 info.setProperty("os.name", System.getProperty("os.name"))
29 info.setProperty("user.country", System.getProperty("user.country"))
30 info.setProperty("java.version", System.getProperty("java.version"))
32 def writer = new File("build.properties").newWriter("utf-8")
33 info.store(writer, "JPF core build info")
38 task copyResources(type: Copy) {
39 group = "JPF Build Resources"
40 description = "Copies .version and build.properties files to the build directory."
42 dependsOn generateBuildInfo
43 dependsOn generateVersion
45 from "build.properties"
46 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"
49 into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf"