X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=build.gradle;h=26ff9ba74b6d0990113f8bc4660cd9943672547b;hp=2254be02c5ba9bccde982a3cc6f919f3b14df387;hb=87594ff533502d7145f07c0974ea4fc5399d1cac;hpb=dda52e5df13d26c6b29900ba7f1f72c353afd7e5 diff --git a/build.gradle b/build.gradle index 2254be0..26ff9ba 100644 --- a/build.gradle +++ b/build.gradle @@ -7,69 +7,59 @@ repositories { mavenCentral() } +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" + } + } + dependencies { + classpath "gradle.plugin.com.palantir.gradle.gitversion:gradle-git-version:0.11.0" + } +} + dependencies { testImplementation "junit:junit:4.12" } -sourceSets { - annotations { - java.srcDirs = ["src/annotations"] - java.outputDir = file("${buildDir}/annotations") - } - main { - java.srcDirs = ["src/main"] - java.outputDir = file("${buildDir}/main") - compileClasspath += sourceSets.annotations.output - } - examples { - java.srcDirs = ["src/examples"] - java.outputDir = file("${buildDir}/examples") - compileClasspath += sourceSets.main.output - } - classes { - java.srcDirs = ["src/classes"] - java.outputDir = file("${buildDir}/classes") - compileClasspath += sourceSets.main.output + sourceSets.annotations.output - } - peers { - java.srcDirs = ["src/peers"] - java.outputDir = file("${buildDir}/peers") - compileClasspath += sourceSets.main.output + sourceSets.annotations.output - } - test { - java.srcDirs = ["src/tests"] - java.outputDir = file("${buildDir}/tests") - compileClasspath += sourceSets.annotations.output + sourceSets.classes.output + sourceSets.peers.output - runtimeClasspath += compileClasspath - } +apply plugin: "com.palantir.git-version" +version gitVersion() +def gitDetails = versionDetails() + +ext.manifestCommonAttrbutes = manifest { + attributes( + "Built-By": System.getProperty("user.name"), + "Implementation-Vendor": "NASA Ames Research Center", + "Specification-Version": gitDetails.lastTag, + "Implementation-Version": gitDetails.gitHashFull + ) } -clean { - group = "JPF Build" -} +apply from: "gradle/ide-support.gradle" +apply from: "gradle/distribution.gradle" +apply from: "gradle/source-sets.gradle" +apply from: "gradle/build-resources.gradle" -task compile(type: Copy) { +task compile { group = "JPF Build" description = "Compiles all JPF core sources." // These are automatic generated tasks from the Java Gradle Plugin. - // Gradle is able to infer the ordering of the source sets + // Gradle is able to infer the order of the source sets // due to the compileClasspath attribute - dependsOn compileTestJava, compileExamplesJava - - // Copies build.properties file to the build directory - from "build.properties" - into sourceSets.main.java.outputDir.path + "/gov/nasa/jpf" + dependsOn compileTestJava + dependsOn compileExamplesJava } -task jpfClassesJar(type: Jar) { +task createJpfClassesJar(type: Jar) { archiveName = "jpf-classes.jar" destinationDir = file("${buildDir}") - description = "Creates the ${archiveName} file." group = "JPF Jars" + description = "Creates the ${archiveName} file." dependsOn compile + dependsOn copyResources from sourceSets.classes.java.outputDir from sourceSets.annotations.java.outputDir @@ -83,14 +73,15 @@ task jpfClassesJar(type: Jar) { } } -task jpfJar(type: Jar) { +task createJpfJar(type: Jar) { archiveName = "jpf.jar" destinationDir = file("${buildDir}") - description = "Creates the ${archiveName} file." group = "JPF Jars" + description = "Creates the ${archiveName} file." dependsOn compile + dependsOn copyResources from sourceSets.main.java.outputDir from sourceSets.peers.java.outputDir @@ -100,42 +91,40 @@ task jpfJar(type: Jar) { } manifest { - attributes( - "Built-By": System.getProperty("user.name"), - "Implementation-Vendor": "NASA Ames Research Center", - "Implementation-Title": "Java Pathfinder core system", - "Implementation-Version": "1234" //FIXME - ) + attributes "Implementation-Title": "Java Pathfinder core system" + from manifestCommonAttrbutes } } -task annotationsJar(type: Jar) { +task createAnnotationsJar(type: Jar) { archiveName = "jpf-annotations.jar" destinationDir = file("${buildDir}") - description = "Creates the ${archiveName} file." group = "JPF Jars" + description = "Creates the ${archiveName} file." dependsOn compile + dependsOn copyResources from sourceSets.annotations.java.outputDir } -task classloaderSpecificTestsJar(type: Jar) { +task createClassloaderSpecificTestsJar(type: Jar) { archiveName = "classloader_specific_tests.jar" destinationDir = file("${buildDir}") - description = "Creates the ${archiveName} file." group = "JPF Jars" + description = "Creates the ${archiveName} file." dependsOn compile + dependsOn copyResources from(sourceSets.test.java.outputDir) { include "classloader_specific_tests/*.class" } } -task runJpfJar(type: Jar) { +task createRunJpfJar(type: Jar) { archiveName = "RunJPF.jar" destinationDir = file("${buildDir}") @@ -143,6 +132,7 @@ task runJpfJar(type: Jar) { group = "JPF Jars" dependsOn compile + dependsOn copyResources from(sourceSets.main.java.outputDir) { include "gov/nasa/jpf/tool/Run.class" @@ -162,16 +152,14 @@ task runJpfJar(type: Jar) { } manifest { attributes( - "Built-By": System.getProperty("user.name"), - "Implementation-Vendor": "NASA Ames Research Center", "Implementation-Title": "Java Pathfinder core launch system", - "Implementation-Version": "1234", //FIXME "Main-Class": "gov.nasa.jpf.tool.RunJPF" ) + from manifestCommonAttrbutes } } -task runTestJar(type: Jar) { +task createRunTestJar(type: Jar) { archiveName = "RunTest.jar" destinationDir = file("${buildDir}") @@ -179,6 +167,7 @@ task runTestJar(type: Jar) { group = "JPF Jars" dependsOn compile + dependsOn copyResources from(sourceSets.main.java.outputDir) { include "gov/nasa/jpf/tool/Run.class" @@ -197,33 +186,32 @@ task runTestJar(type: Jar) { } manifest { attributes( - "Built-By": System.getProperty("user.name"), - "Implementation-Vendor": "NASA Ames Research Center", "Implementation-Title": "Java Pathfinder test launch system", - "Implementation-Version": "1234", // FIXME "Main-Class": "gov.nasa.jpf.tool.RunTest" ) + from manifestCommonAttrbutes } } task buildJars { group = "JPF Build" - description = "Generates the core JPF jar files." - - dependsOn classloaderSpecificTestsJar, annotationsJar, - jpfClassesJar, jpfJar, runJpfJar, - runTestJar + description = "Generates all core JPF jar files." + + dependsOn createClassloaderSpecificTestsJar + dependsOn createAnnotationsJar + dependsOn createJpfClassesJar + dependsOn createJpfJar + dependsOn createRunJpfJar + dependsOn createRunTestJar } test { - group = "JPF Build" description = "Runs core regression tests." dependsOn buildJars - enableAssertions = true forkEvery = 1 - + enableAssertions = true maxHeapSize = "1024m" include "**/*Test.class"