Skip to content

Commit

Permalink
Sonatype release build logic (#2)
Browse files Browse the repository at this point in the history
* add scoverage, use gradle 4.8.1, update nebula versions

* publishing and signing build logic

* fake javadoc

* set groupId in buildscript

* minor cleanup
  • Loading branch information
tomnis authored Aug 21, 2018
1 parent 722a9e5 commit 12d0984
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ cache:

script:
- docker-compose up -d
- ./gradlew clean test
- ./gradlew clean test checkScoverage
- docker-compose down
70 changes: 69 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ allprojects {
apply plugin: 'nebula.release'
apply plugin: "nebula.maven-resolved-dependencies"
apply plugin: "org.scoverage"
apply plugin: 'maven-publish'
apply plugin: 'signing'
}

buildscript {
Expand Down Expand Up @@ -113,7 +115,13 @@ task sourcesJar(type: Jar) {
from sourceSets.main.allSource
}

// TODO make sure the dependencies are set up for this task
// fake javadoc jar to pass sonatype rules
// See https://central.sonatype.org/pages/requirements.html
task javadocJar(type: Jar) {
classifier = 'javadoc'
from new File('javadoc-fake')
}

task scaladocJar(type: Jar) {
classifier = 'scaladoc'
from scaladoc.destinationDir
Expand Down Expand Up @@ -202,3 +210,63 @@ checkScoverage {
coverageType = 'Statement'
minimumRate = 0.92
}

/**
* @return true iff we are building a maven snapshot or a devSnapshot.
*/
static boolean isSnapshot(String inferredVersion) {
inferredVersion.endsWith("-SNAPSHOT") || inferredVersion.contains("-dev.") || inferredVersion.contains(".dev.")
}

publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'com.workday.warp'
artifactId = 'warp-core'
from components.java
artifact sourcesJar
artifact javadocJar
artifact scaladocJar
pom {
name = 'warp-core'
description = 'A library for scientific performance testing.'
url = 'https://workday.github.io/warp-core/'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id = 'tomnis'
name = 'tomas mccandless'
email = 'tomas.mccandless@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/Workday/warp-core.git'
developerConnection = 'scm:git:ssh://github.com:Workday/warp-core.git'
url = 'https://github.com/Workday/warp-core/tree/master'
}
}
}
}

repositories {
maven {
credentials {
// will be null if these aren't set as project properties
username findProperty("sonatypeUsername")
password findProperty("sonatypePassword")
}
String snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
String releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
url = isSnapshot(version.toString()) ? snapshotsRepoUrl : releasesRepoUrl
}
}
}

signing {
sign publishing.publications.mavenJava
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Dec 12 12:59:33 PST 2017
#Wed Aug 08 13:44:00 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip
2 changes: 2 additions & 0 deletions javadoc-fake/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Included here is fake javadoc to pass sonatype upload checks.
See https://central.sonatype.org/pages/requirements.html
4 changes: 2 additions & 2 deletions versionInfo.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ project.ext.versions = [
, mysqlConnector: '5.1.46'
, nebulaDependencyLock: '5.0.0'
, nebulaGit: '3.0.1'
, nebulaRelease: '6.1.0'
, nebulaPublish: '5.1.5'
, nebulaRelease: '6.3.5'
, nebulaPublish: '8.2.0'
, pegdown: '1.4.2'
, reflections: '0.9.10'
, scalalang: '2.11.5'
Expand Down

0 comments on commit 12d0984

Please sign in to comment.