Added acceptance of scans.gradle.com terms of service
[jpf-core.git] / build.gradle
index f1c0bf7f737a5491c346a6b69e221d003cd3b6a3..555abff2ca320a99b272cda8ad11ca98a027cd59 100644 (file)
@@ -1,8 +1,24 @@
-apply plugin: "java"
+plugins {
+    id "com.gradle.build-scan"
+    id "java"
+}
 
 sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
+ext.manifestCommonAttrbutes = manifest {
+    attributes(
+        "Built-By": System.getProperty("user.name"),
+        "Implementation-Vendor": "NASA Ames Research Center",
+        "Implementation-Version": "1234" // FIXME
+    )
+}
+
+buildScan {
+    termsOfServiceUrl = 'https://gradle.com/terms-of-service'
+    termsOfServiceAgree = 'yes'
+}
+
 repositories {
     mavenCentral()
 }
@@ -44,14 +60,9 @@ sourceSets {
     }
 }
 
-clean {
-    group = "JPF Build"
-}
-
 task generateVersion {
+    group = "JPF Build Resources"
     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 ->
@@ -60,9 +71,9 @@ task generateVersion {
     }
 }
 
-task buildInfo {
-    group = "JPF Build Properties"
-    description = "Creates build info properties."
+task generateBuildInfo {
+    group = "JPF Build Resources"
+    description = "Generates the build.properties file."
     doLast {
 
         // Must fail if there are uncommitted changes
@@ -90,27 +101,34 @@ task buildInfo {
     }
 }
 
-task compile(type: Copy) {
-    group = "JPF Build"
-    description = "Compiles all JPF core sources."
+task copyResources(type: Copy) {
+    group = "JPF Build Resources"
+    description = "Copies .version and build.properties files to the build directory."
 
-    // 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, generateVersion
+    dependsOn generateBuildInfo
+    dependsOn 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 srcDist(type: Zip) {
+task compile {
     group = "JPF Build"
-    description = "Builds the source distribution"
+    description = "Compiles all JPF core sources."
+
+    // These are automatic generated tasks from the Java Gradle Plugin.
+    // Gradle is able to infer the order of the source sets
+    // due to the compileClasspath attribute
+    dependsOn compileTestJava
+    dependsOn compileExamplesJava
+}
+
+task srcDist(type: Zip) {
+    group = "JPF Distribution"
+    description = "Builds the source distribution."
 
     baseName = project.name
     version = "git rev-parse --short HEAD".execute().text.trim()
@@ -126,8 +144,6 @@ task srcDist(type: Zip) {
     include "gradlew"
     include "gradlew.bat"
     include "gradle/**/*"
-    include "nbproject/**/*"
-    include "eclipse/**/*"
     include "src/**/*"
     include "bin/**/*"
     include "jpf.properties"
@@ -137,8 +153,8 @@ task srcDist(type: Zip) {
 }
 
 task dist(type: Zip) {
-    group = "JPF Build"
-    description = "Builds binary distribution"
+    group = "JPF Distribution"
+    description = "Builds binary distribution."
 
     baseName = project.name
     version = "git rev-parse --short HEAD".execute().text.trim()
@@ -155,14 +171,15 @@ task dist(type: Zip) {
     include "${buildDir.name}/**/*.jar"
 }
 
-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
@@ -176,14 +193,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
@@ -193,42 +211,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}")
 
@@ -236,6 +252,7 @@ task runJpfJar(type: Jar) {
     group = "JPF Jars"
 
     dependsOn compile
+    dependsOn copyResources
 
     from(sourceSets.main.java.outputDir) {
         include "gov/nasa/jpf/tool/Run.class"
@@ -255,16 +272,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}")
 
@@ -272,6 +287,7 @@ task runTestJar(type: Jar) {
     group = "JPF Jars"
 
     dependsOn compile
+    dependsOn copyResources
 
     from(sourceSets.main.java.outputDir) {
         include "gov/nasa/jpf/tool/Run.class"
@@ -290,28 +306,26 @@ 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 buildInfo
-
-    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