X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=build.gradle;h=3ab3ce00ca898956bbe40adddbc65e1ca751c1d9;hp=2254be02c5ba9bccde982a3cc6f919f3b14df387;hb=8c822ac7b303bd2915640ff4f5a133763ca8fbf2;hpb=dda52e5df13d26c6b29900ba7f1f72c353afd7e5 diff --git a/build.gradle b/build.gradle index 2254be0..3ab3ce0 100644 --- a/build.gradle +++ b/build.gradle @@ -48,6 +48,18 @@ clean { group = "JPF Build" } +task generateVersion { + description = "Generates the .version file with the current revision hash" + group = "JPF Build Properties" + + doLast { + def revision = "git rev-parse HEAD".execute().text + new File(".version").withWriter("utf-8") { writer -> + writer.writeLine revision + } + } +} + task compile(type: Copy) { group = "JPF Build" description = "Compiles all JPF core sources." @@ -55,11 +67,15 @@ task compile(type: Copy) { // These are automatic generated tasks from the Java Gradle Plugin. // Gradle is able to infer the ordering of the source sets // due to the compileClasspath attribute - dependsOn compileTestJava, compileExamplesJava + dependsOn compileTestJava, compileExamplesJava, generateVersion // Copies build.properties file to the build directory from "build.properties" into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf" + + // Copies .version file to the build directory + from ".version" + into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf" } task jpfClassesJar(type: Jar) {