Skip to content

Commit

Permalink
Fixes to new maven-publish release process
Browse files Browse the repository at this point in the history
Successfully performed a release dry run, which was dropped at the
staging repository. This also removes a few afterEvaluate hacks.
  • Loading branch information
ben-manes committed Jan 15, 2020
1 parent 8cb2b08 commit b2d67d1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 9 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@ task testReport(type: TestReport, group: 'Build') {
}

allprojects {
apply plugin: 'com.github.ethankhall.semantic-versioning'
apply from: "${rootDir}/gradle/eclipse.gradle"

repositories {
jcenter()
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'
Expand All @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions caffeine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ dependencies {
javaPoetImplementation libraries.commonsLang3
}

java {
withSourcesJar()
}

compileCodeGenJava {
gradle.taskGraph.whenReady {
enabled = gradle.taskGraph.hasTask('uploadArchives')
Expand Down Expand Up @@ -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'
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -87,3 +88,7 @@ javadoc {
options.addBooleanOption('html5', true)
}
}

if (JavaVersion.current().isJava9Compatible()) {
[publish, publishMavenJavaPublicationToMavenRepository]*.enabled = false
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down

0 comments on commit b2d67d1

Please sign in to comment.