diff --git a/README.md b/README.md index 1bd06dae8e..3760b5ebc2 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Snapshots of the development version are available in [jsr107]: https://github.com/ben-manes/caffeine/wiki/JCache [maven]: https://maven-badges.herokuapp.com/maven-central/com.github.ben-manes.caffeine/caffeine [releases]: https://github.com/ben-manes/caffeine/releases -[snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/github/ben-manes/caffeine +[snapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/github/ben-manes/caffeine/ [efficiency]: https://github.com/ben-manes/caffeine/wiki/Efficiency [tinylfu]: https://dl.acm.org/authorize?N41277 [adaptive-tinylfu]: https://dl.acm.org/authorize?N675830 diff --git a/build.gradle b/build.gradle index 28efe15af8..ad1efecf05 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ task testReport(type: TestReport, group: 'Build') { } allprojects { + apply plugin: 'com.github.ethankhall.semantic-versioning' apply from: "${rootDir}/gradle/eclipse.gradle" repositories { @@ -38,10 +39,17 @@ allprojects { mavenCentral() maven { url 'https://jitpack.io' } } + + group = 'com.github.ben-manes.caffeine' + version.with { + major = 2 // incompatible API changes + minor = 8 // backwards-compatible additions + patch = 1 // backwards-compatible bug fixes + releaseBuild = rootProject.hasProperty('release') + } } subprojects { - apply plugin: 'com.github.ethankhall.semantic-versioning' apply plugin: 'biz.aQute.bnd.builder' apply plugin: 'java-library' apply plugin: 'eclipse' @@ -52,19 +60,7 @@ subprojects { apply from: "${rootDir}/gradle/dependencies.gradle" apply from: "${rootDir}/gradle/objectLayout.gradle" - if (JavaVersion.current().isJava9Compatible()) { - tasks.uploadArchives.enabled = false - } - sourceCompatibility = JavaVersion.VERSION_1_8 - - group = 'com.github.ben-manes.caffeine' - version.with { - major = 2 // incompatible API changes - minor = 8 // backwards-compatible additions - patch = 1 // backwards-compatible bug fixes - releaseBuild = rootProject.hasProperty('release') - } archivesBaseName = path[1..-1].replaceAll(':', '-').toLowerCase() dependencies { diff --git a/caffeine/build.gradle b/caffeine/build.gradle index 65ddd5c302..2ac77ce2e6 100644 --- a/caffeine/build.gradle +++ b/caffeine/build.gradle @@ -64,6 +64,10 @@ dependencies { javaPoetImplementation libraries.commonsLang3 } +java { + withSourcesJar() +} + compileCodeGenJava { gradle.taskGraph.whenReady { enabled = gradle.taskGraph.hasTask('uploadArchives') @@ -105,6 +109,7 @@ task generateLocalCaches(type: JavaExec) { outputs.cacheIf { true } } compileJava.dependsOn(generateLocalCaches) +sourcesJar.dependsOn(generateLocalCaches) task generateNodes(type: JavaExec) { main = 'com.github.benmanes.caffeine.cache.NodeFactoryGenerator' @@ -116,11 +121,7 @@ task generateNodes(type: JavaExec) { outputs.cacheIf { true } } compileJava.dependsOn(generateNodes) - -afterEvaluate { - sourcesJar.dependsOn('generateLocalCaches') - sourcesJar.dependsOn('generateNodes') -} +sourcesJar.dependsOn(generateNodes) task memoryOverhead(type: JavaExec, group: 'Benchmarks', description: 'Evaluates cache overhead') { classpath sourceSets.jmh.runtimeClasspath diff --git a/gradle/publish.gradle b/gradle/publish.gradle index a3d62305fe..c7207ef2d3 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -64,6 +64,7 @@ publishing { def releasesUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' def snapshotsUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' url = project.version.releaseBuild ? releasesUrl : snapshotsUrl + credentials { username = project.properties['nexusUsername'] ?: null password = project.properties['nexusPassword'] ?: null @@ -87,3 +88,7 @@ javadoc { options.addBooleanOption('html5', true) } } + +if (JavaVersion.current().isJava9Compatible()) { + [publish, publishMavenJavaPublicationToMavenRepository]*.enabled = false +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ee43aa3e6b..b52e790b97 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,4 +1,4 @@ -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-rc-2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-rc-3-bin.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/travis.sh b/travis.sh index 7129892817..ef964a8c2e 100755 --- a/travis.sh +++ b/travis.sh @@ -31,7 +31,7 @@ case "${1:?''}" in runSlow "./gradlew :caffeine:slowCaffeineTest --console plain" runSlow "./gradlew :caffeine:slowGuavaTest --console plain" if [[ (${CI:-false} == "true") && (${TRAVIS_PULL_REQUEST:-false} == "false") ]]; then - run "./gradlew coveralls uploadArchives --console plain" + run "./gradlew coveralls publish --console plain" runSlow "./gradlew sonarqube --console plain" fi ;;