Skip to content

Commit

Permalink
Upgrade to Gradle 6 and Spotbugs 4-beta
Browse files Browse the repository at this point in the history
This does not resolve the deprecation of maven publishing, which is
simplified by using the gradle-nexus-plugin. That plugin's features
are not provided by the built-in maven-publish plugin and migration
to that is required.
  • Loading branch information
ben-manes committed Nov 9, 2019
1 parent a6d4ba4 commit eda7b10
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 96 deletions.
17 changes: 8 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import net.ltgt.gradle.errorprone.CheckSeverity
apply plugin: 'com.github.mjdetullio.gradle.coverity'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.gradle.build-scan'
apply plugin: 'jacoco'

buildscript {
Expand Down Expand Up @@ -44,8 +43,8 @@ allprojects {
subprojects {
apply plugin: 'com.github.ethankhall.semantic-versioning'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'idea'

apply from: "${rootDir}/gradle/publish.gradle"
Expand All @@ -69,13 +68,13 @@ subprojects {
archivesBaseName = path[1..-1].replaceAll(':', '-').toLowerCase()

dependencies {
testCompile libraries.guava
testCompile testLibraries.mockito
testCompile testLibraries.hamcrest
testCompile testLibraries.awaitility
testCompile testLibraries.osgiCompile
testImplementation libraries.guava
testImplementation testLibraries.mockito
testImplementation testLibraries.hamcrest
testImplementation testLibraries.awaitility
testImplementation testLibraries.osgiCompile

testRuntime testLibraries.osgiRuntime
testRuntimeOnly testLibraries.osgiRuntime
}

configurations {
Expand Down Expand Up @@ -114,7 +113,7 @@ subprojects {

task testJar(type: Jar, group: 'Build') {
description = 'Assembles a jar archive containing the test classes.'
baseName = "${archivesBaseName}-test"
archiveBaseName = "${archivesBaseName}-test"
from sourceSets.test.output
}

Expand Down
28 changes: 14 additions & 14 deletions caffeine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ plugins.withType(EclipsePlugin) {
}

dependencies {
compile libraries.checkerAnnotations
compile libraries.errorproneAnnotations

testCompile libraries.ycsb
testCompile libraries.guava
testCompile libraries.fastutil
testCompile testLibraries.junit
testCompile testLibraries.testng
testCompile testLibraries.jctools
testCompile libraries.commonsLang3
testCompile testLibraries.guavaTestLib
api libraries.checkerAnnotations
api libraries.errorproneAnnotations

testImplementation libraries.ycsb
testImplementation libraries.guava
testImplementation libraries.fastutil
testImplementation testLibraries.junit
testImplementation testLibraries.testng
testImplementation testLibraries.jctools
testImplementation libraries.commonsLang3
testImplementation testLibraries.guavaTestLib

javaAgent libraries.jamm

Expand All @@ -59,9 +59,9 @@ dependencies {
jmh libraries.elasticSearch
jmh libraries.concurrentlinkedhashmap

javaPoetCompile libraries.guava
javaPoetCompile libraries.javapoet
javaPoetCompile libraries.commonsLang3
javaPoetImplementation libraries.guava
javaPoetImplementation libraries.javapoet
javaPoetImplementation libraries.commonsLang3
}

compileCodeGenJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ void append(@NonNull Node<E> first, @NonNull Node<E> last) {
return;
}
Node<E> next = first.getNextRelaxed();
if (next.value == null) {
if (next == null) {
return;
} else if (next.value == null) {
first.next = null; // reduce nepotism
}
first = next;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,11 @@ void expireEntries() {
expireAfterWriteEntries(now);
expireVariableEntries(now);

if (pacer() != null) {
Pacer pacer = pacer();
if (pacer != null) {
long delay = getExpirationDelay(now);
if (delay != Long.MAX_VALUE) {
pacer().schedule(executor, drainBuffersTask, now, delay);
pacer.schedule(executor, drainBuffersTask, now, delay);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ interface LocalLoadingCache<K, V> extends LocalManualCache<K, V>, LoadingCache<K

@Override
default Map<K, V> getAll(Iterable<? extends K> keys) {
return (bulkMappingFunction() == null)
Function<Iterable<? extends K>, Map<K, V>> mappingFunction = bulkMappingFunction();
return (mappingFunction == null)
? loadSequentially(keys)
: getAll(keys, bulkMappingFunction());
: getAll(keys, mappingFunction);
}

/** Sequentially loads each missing entry. */
Expand Down
10 changes: 10 additions & 0 deletions checksum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<trust-requirement pgp='GROUP' checksum='NONE' />
<ignored-keys>
<ignored-key id='ac5ec74981f9cda6' />
<ignored-key id='44ce7bf2825ea2cd' />
</ignored-keys>
<trusted-keys>
<trusted-key id='36feecf06c2da10b' group='biz.aQute.bnd' />
Expand Down Expand Up @@ -159,6 +160,9 @@
<dependency group='com.beust' module='jcommander' version='1.78'>
<sha512>5EE2EF4C12888A48D7C830189D06EE8A653C7664A53C9B6FA935D4E7866B0454111F8092D7ECE086EC80C61EDAB2856187A1E247873E5C8E4724EFB02C37504B</sha512>
</dependency>
<dependency group='com.ibm.icu' module='icu4j' version='63.1'>
<sha512>E0E647F10A79E91B88A0F2EA12460E7F004E97EFFC6788ED03574283CE566C828023CE68613A5CC2E68013D9D23783F0BA1A27093DBE6C2844FB1DDA801FC7AA</sha512>
</dependency>
<dependency group='com.github.FastFilter' module='fastfilter_java' version='bf0b02297f'>
<sha512>1E637F7546DDA1EDD3EB74B181B918137776611EB703ED90A91B3845DD7D2615D40A0A586DCAA4E494EB097D2E2E05511D0DCFEAD47416AE7622EBA05EFBF7C</sha512>
</dependency>
Expand All @@ -180,6 +184,9 @@
<dependency group='com.github.jengelman.gradle.plugins' module='shadow' version='5.1.0'>
<sha512>7D41E58487E4EAE601BAA6F42EDACD2F903AC04DBD12AC2A9784FABF0A8DCE8A416C18C452D14B1D1608938F19518E87536986387AAAE9737FE736E82BDE94E2</sha512>
</dependency>
<dependency group='com.github.spotbugs' module='spotbugs-gradle-plugin' version='2.0.1'>
<sha512>2C09B102601DF179B615EF37F5E56B9AA1100BB2A17D742B8CB452C1A193C44ED3EBE029FEAFB9822D55A680D99B682184C733D56F835874DD01B02209AFA13D</sha512>
</dependency>
<dependency group='com.gradle' module='build-scan-plugin' version='2.4.1'>
<sha512>347F865BD5B9310D6972BDA95AB089D2BA911C4EA897A1E4E316465077A0153609E31DFFD3C2D61DEEA7E54C07D7D36D5807F9B24F3111A97553DFD260A205F1</sha512>
</dependency>
Expand Down Expand Up @@ -279,6 +286,9 @@
<dependency group='org.ow2.asm' module='asm-util' version='7.0'>
<sha512>6B9630AD4C5F6ABC2724F9D85A7C0E81E524F8B0BF25273DD5578EDC20EFC7AB400095CD48E904D2536071181A8E9F39635FF3FEE0986BD078016D2DFF8241B1</sha512>
</dependency>
<dependency group='org.ow2.asm' module='asm-util' version='7.1'>
<sha512>F8F693C0EFDEDB244EC09D0FD1E32E2C3DD392C464468ABBAD1D730C80FB2FDAC889719C57911D5EECCAA9E20EA4FBB47452FA24B6AFE31B07E7BBDF70F25466</sha512>
</dependency>
<dependency group='org.ow2.asm' module='asm' version='7.0'>
<sha512>B31699F50485DDC4E84466064CF5789A3E61BAFBEC53C4B9CB19FFEF07B36722D3EFDCA8722884FD6D6DEDACA65DB4DD6F71CD886BBA599E8A77971955167A60</sha512>
</dependency>
Expand Down
15 changes: 15 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
<Class name="com.github.benmanes.caffeine.cache.WriteThroughEntry"/>
<Bug code="Eq"/>
</Match>
<Match>
<Class name="com.github.benmanes.caffeine.cache.GuardedScheduler"/>
<Method name="schedule"/>
<Bug code="RCN"/>
</Match>
<Match>
<Or>
<Class name="~.*Mpsc.*"/>
Expand Down Expand Up @@ -78,11 +83,21 @@
<Method name="copyOf"/>
<Bug code="NP"/>
</Match>
<Match>
<Class name="com.github.benmanes.caffeine.jcache.CacheProxy"/>
<Method name="postProcess"/>
<Bug code="NP"/>
</Match>
<Match>
<Class name="com.github.benmanes.caffeine.jcache.CacheProxy"/>
<Method name="postProcess"/>
<Bug code="SF"/>
</Match>
<Match>
<Class name="com.github.benmanes.caffeine.jcache.configuration.TypesafeConfigurator$Configurator"/>
<Method name="addLazyExpiration"/>
<Bug code="NP"/>
</Match>

<!-- Simulator -->
<Match>
Expand Down
10 changes: 4 additions & 6 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
ext {
versions = [
akka: '2.6.0-RC2',
akka: '2.6.0',
cache2k: '1.3.1.Alpha',
checkerFramework: '3.0.0',
collision: '0.3.3',
Expand Down Expand Up @@ -76,7 +76,6 @@ ext {
pluginVersions = [
apt: '0.21',
bnd: '4.3.0',
buildscan: '2.4.2',
checkstyle: '8.26',
coveralls: '2.8.4',
coverity: '1.0.10',
Expand All @@ -90,8 +89,8 @@ ext {
semanticVersioning: '1.1.0',
shadow: '5.1.0',
sonarqube: '2.8',
spotbugs: '3.1.12',
spotbugsPlugin: '2.0.0',
spotbugs: '4.0.0-beta4',
spotbugsPlugin: '2.0.1',
stats: '0.2.2',
versions: '0.27.0',
]
Expand Down Expand Up @@ -175,7 +174,6 @@ ext {
gradlePlugins = [
apt: "net.ltgt.gradle:gradle-apt-plugin:${pluginVersions.apt}",
bnd: "biz.aQute.bnd:biz.aQute.bnd.gradle:${pluginVersions.bnd}",
buildscan: "com.gradle:build-scan-plugin:${pluginVersions.buildscan}",
checkstyle: dependencies.create("com.puppycrawl.tools:checkstyle:${pluginVersions.checkstyle}") {
transitive = false
},
Expand All @@ -193,7 +191,7 @@ ext {
shadow: "com.github.jengelman.gradle.plugins:shadow:${pluginVersions.shadow}",
sonarqube: "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:${pluginVersions.sonarqube}",
spotbugs: [
"gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:${pluginVersions.spotbugsPlugin}",
"com.github.spotbugs:spotbugs-gradle-plugin:${pluginVersions.spotbugsPlugin}",
libraries.guava // https://github.com/spotbugs/spotbugs-gradle-plugin/issues/119
],
stats: "org.kordamp.gradle:stats-gradle-plugin:${pluginVersions.stats}",
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
14 changes: 7 additions & 7 deletions guava/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* The tests are forked from Guava commit e370dde.
*/
dependencies {
compile project(':caffeine')
compile libraries.guava
api project(':caffeine')
api libraries.guava

testCompile testLibraries.junit
testCompile testLibraries.truth
testCompile testLibraries.jctools
testCompile testLibraries.easymock
testCompile testLibraries.guavaTestLib
testImplementation testLibraries.junit
testImplementation testLibraries.truth
testImplementation testLibraries.jctools
testImplementation testLibraries.easymock
testImplementation testLibraries.guavaTestLib
}

jar.manifest {
Expand Down
26 changes: 13 additions & 13 deletions jcache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ configurations {
}

dependencies {
compile project(':caffeine')
compile libraries.jcache
compile libraries.config
compile libraries.jsr330
api project(':caffeine')
api libraries.jcache
api libraries.config
api libraries.jsr330

testCompile libraries.guava
testCompile testLibraries.junit
testCompile testLibraries.testng
testCompile testLibraries.mockito
testCompile testLibraries.hamcrest
testCompile testLibraries.jcacheTck
testCompile testLibraries.jcacheTckTests
testCompile testLibraries.jcacheGuice
testCompile testLibraries.guavaTestLib
testImplementation libraries.guava
testImplementation testLibraries.junit
testImplementation testLibraries.testng
testImplementation testLibraries.mockito
testImplementation testLibraries.hamcrest
testImplementation testLibraries.jcacheTck
testImplementation testLibraries.jcacheTckTests
testImplementation testLibraries.jcacheGuice
testImplementation testLibraries.guavaTestLib

tck dependencies.create(testLibraries.jcacheTckTests) {
transitive = false
Expand Down
29 changes: 13 additions & 16 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
rootProject.name = 'caffeine'

include 'caffeine'
include 'guava'
include 'jcache'
include 'simulator'

buildCache {
local.enabled = false

local(DirectoryBuildCache) {
directory = new File(rootDir, 'build-cache')
removeUnusedEntriesAfterDays = 30
}
}

// See https://github.com/vlsi/vlsi-release-plugins
buildscript {
dependencies {
Expand All @@ -27,8 +11,21 @@ buildscript {
}
}

plugins {
id "com.gradle.enterprise" version "3.0"
}

rootProject.name = 'caffeine'

include 'caffeine'
include 'guava'
include 'jcache'
include 'simulator'

// Note: we need to verify the checksum for checksum-dependency-plugin itself
def expectedSha512 = [
"18BC69198D8A217BD231A1A35F0A15543236F8F955DC94F49C6C0E438C3EB2B0A522ED4D5218EFE75619013C492EE97071FCE241EB1CA70E563754176DDAA6DD":
"gradle-enterprise-gradle-plugin-3.0.jar",
"43BC9061DFDECA0C421EDF4A76E380413920E788EF01751C81BDC004BD28761FBD4A3F23EA9146ECEDF10C0F85B7BE9A857E9D489A95476525565152E0314B5B":
"bcpg-jdk15on-1.62.jar",
"2BA6A5DEC9C8DAC2EB427A65815EB3A9ADAF4D42D476B136F37CD57E6D013BF4E9140394ABEEA81E42FBDB8FC59228C7B85C549ED294123BF898A7D048B3BD95":
Expand Down
Loading

0 comments on commit eda7b10

Please sign in to comment.