Update Gradle to 6.0, support Java 13 (#180)

Upgrade Gradle to 6.0.
* This is needed as Gradle 5.x did not support Java 13
* Jacoco needed a version upgrade to support Java 13
* Upgrade Errorprone to fix some breaks
* Another Errorprone check is broken in 13
* The 'Finally' Errorprone check is only broken in Java 12
* JMH needed a version upgrade and a new build flag
* Switch to bin distribution for smaller builds

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/184/head
Danno Ferrin 5 years ago committed by GitHub
parent 0a27885b2f
commit 59096789ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      build.gradle
  2. 2
      gradle/wrapper/gradle-wrapper.properties

@ -23,8 +23,8 @@ plugins {
id 'com.github.ben-manes.versions' version '0.26.0' id 'com.github.ben-manes.versions' version '0.26.0'
id 'com.github.hierynomus.license' version '0.15.0' id 'com.github.hierynomus.license' version '0.15.0'
id 'io.spring.dependency-management' version '1.0.8.RELEASE' id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'me.champeau.gradle.jmh' version '0.4.8' apply false id 'me.champeau.gradle.jmh' version '0.5.0' apply false
id 'net.ltgt.errorprone' version '0.8.1' id 'net.ltgt.errorprone' version '1.1.1'
} }
if (!JavaVersion.current().java11Compatible) { if (!JavaVersion.current().java11Compatible) {
@ -98,7 +98,7 @@ allprojects {
version = rootProject.version version = rootProject.version
jacoco { jacoco {
toolVersion = '0.8.2' toolVersion = '0.8.5'
if (project.tasks.findByName('referenceTests')) { if (project.tasks.findByName('referenceTests')) {
applyTo referenceTests applyTo referenceTests
} }
@ -197,9 +197,13 @@ allprojects {
check('FieldCanBeFinal', CheckSeverity.OFF) check('FieldCanBeFinal', CheckSeverity.OFF)
// This check is broken in Java 12. See https://github.com/google/error-prone/issues/1257 // This check is broken in Java 12. See https://github.com/google/error-prone/issues/1257
if (JavaVersion.current().java12Compatible) { if (JavaVersion.current() == JavaVersion.VERSION_12) {
check('Finally', CheckSeverity.OFF) check('Finally', CheckSeverity.OFF)
} }
// This check is broken after Java 12. See https://github.com/google/error-prone/issues/1352
if (JavaVersion.current() > JavaVersion.VERSION_12) {
check('TypeParameterUnusedInFormals', CheckSeverity.OFF)
}
check('InsecureCryptoUsage', CheckSeverity.WARN) check('InsecureCryptoUsage', CheckSeverity.WARN)
check('WildcardImport', CheckSeverity.WARN) check('WildcardImport', CheckSeverity.WARN)
@ -283,7 +287,7 @@ task checkMavenCoordinateCollisions {
} }
} }
tasks.register('checkPluginAPIChanges', DefaultTask) { } tasks.register('checkPluginAPIChanges', DefaultTask) {}
checkPluginAPIChanges.dependsOn(':plugin-api:checkAPIChanges') checkPluginAPIChanges.dependsOn(':plugin-api:checkAPIChanges')
check.dependsOn('checkPluginAPIChanges', 'checkMavenCoordinateCollisions') check.dependsOn('checkPluginAPIChanges', 'checkMavenCoordinateCollisions')
@ -317,11 +321,11 @@ subprojects {
def sourceSetIsPopulated = { sourceSetName -> def sourceSetIsPopulated = { sourceSetName ->
def result = project.sourceSets.names.contains(sourceSetName) && !project.sourceSets.getAt(sourceSetName).allSource.empty def result = project.sourceSets.names.contains(sourceSetName) && !project.sourceSets.getAt(sourceSetName).allSource.empty
logger.info("Project = "+ project.name + " Has Source Set (" + sourceSetName + ") = " + result + "(" + project.sourceSets.names + ")") logger.info("Project = " + project.name + " Has Source Set (" + sourceSetName + ") = " + result + "(" + project.sourceSets.names + ")")
return result return result
} }
if(sourceSetIsPopulated("main") || sourceSetIsPopulated("testSupport")) { if (sourceSetIsPopulated("main") || sourceSetIsPopulated("testSupport")) {
apply plugin: 'com.jfrog.bintray' apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
@ -330,13 +334,13 @@ subprojects {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
groupId "org.hyperledger.besu.internal" groupId "org.hyperledger.besu.internal"
version "${project.version}" version "${project.version}"
if(sourceSetIsPopulated("main")) { if (sourceSetIsPopulated("main")) {
from components.java from components.java
artifact sourcesJar artifact sourcesJar
artifact javadocJar artifact javadocJar
} }
if(sourceSetIsPopulated("testSupport")) { if (sourceSetIsPopulated("testSupport")) {
artifact testSupportJar artifact testSupportJar
} }
versionMapping { versionMapping {
@ -424,6 +428,7 @@ subprojects {
include = _strListCmdArg('include', ['']) include = _strListCmdArg('include', [''])
humanOutputFile = project.file("${project.buildDir}/reports/jmh/results.txt") humanOutputFile = project.file("${project.buildDir}/reports/jmh/results.txt")
resultFormat = 'JSON' resultFormat = 'JSON'
duplicateClassesStrategy = 'warn'
} }
dependencies { jmh 'org.apache.logging.log4j:log4j-api' } dependencies { jmh 'org.apache.logging.log4j:log4j-api' }
@ -558,7 +563,7 @@ task dockerUpload(type: Exec) {
additionalTags.add('develop') additionalTags.add('develop')
} }
if (! version ==~ /.*-SNAPSHOT/) { if (!version ==~ /.*-SNAPSHOT/) {
additionalTags.add('latest') additionalTags.add('latest')
additionalTags.add(version.split(/\./)[0..1].join('.')) additionalTags.add(version.split(/\./)[0..1].join('.'))
} }

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip

Loading…
Cancel
Save