Skip to content

Commit 12d0984

Browse files
authored
Sonatype release build logic (#2)
* add scoverage, use gradle 4.8.1, update nebula versions * publishing and signing build logic * fake javadoc * set groupId in buildscript * minor cleanup
1 parent 722a9e5 commit 12d0984

File tree

6 files changed

+76
-6
lines changed

6 files changed

+76
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ cache:
1717

1818
script:
1919
- docker-compose up -d
20-
- ./gradlew clean test
20+
- ./gradlew clean test checkScoverage
2121
- docker-compose down

build.gradle

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ allprojects {
1111
apply plugin: 'nebula.release'
1212
apply plugin: "nebula.maven-resolved-dependencies"
1313
apply plugin: "org.scoverage"
14+
apply plugin: 'maven-publish'
15+
apply plugin: 'signing'
1416
}
1517

1618
buildscript {
@@ -113,7 +115,13 @@ task sourcesJar(type: Jar) {
113115
from sourceSets.main.allSource
114116
}
115117

116-
// TODO make sure the dependencies are set up for this task
118+
// fake javadoc jar to pass sonatype rules
119+
// See https://central.sonatype.org/pages/requirements.html
120+
task javadocJar(type: Jar) {
121+
classifier = 'javadoc'
122+
from new File('javadoc-fake')
123+
}
124+
117125
task scaladocJar(type: Jar) {
118126
classifier = 'scaladoc'
119127
from scaladoc.destinationDir
@@ -202,3 +210,63 @@ checkScoverage {
202210
coverageType = 'Statement'
203211
minimumRate = 0.92
204212
}
213+
214+
/**
215+
* @return true iff we are building a maven snapshot or a devSnapshot.
216+
*/
217+
static boolean isSnapshot(String inferredVersion) {
218+
inferredVersion.endsWith("-SNAPSHOT") || inferredVersion.contains("-dev.") || inferredVersion.contains(".dev.")
219+
}
220+
221+
publishing {
222+
publications {
223+
mavenJava(MavenPublication) {
224+
groupId = 'com.workday.warp'
225+
artifactId = 'warp-core'
226+
from components.java
227+
artifact sourcesJar
228+
artifact javadocJar
229+
artifact scaladocJar
230+
pom {
231+
name = 'warp-core'
232+
description = 'A library for scientific performance testing.'
233+
url = 'https://workday.github.io/warp-core/'
234+
licenses {
235+
license {
236+
name = 'MIT License'
237+
url = 'https://opensource.org/licenses/mit-license.php'
238+
}
239+
}
240+
developers {
241+
developer {
242+
id = 'tomnis'
243+
name = 'tomas mccandless'
244+
245+
}
246+
}
247+
scm {
248+
connection = 'scm:git:git://github.com/Workday/warp-core.git'
249+
developerConnection = 'scm:git:ssh://github.com:Workday/warp-core.git'
250+
url = 'https://github.com/Workday/warp-core/tree/master'
251+
}
252+
}
253+
}
254+
}
255+
256+
repositories {
257+
maven {
258+
credentials {
259+
// will be null if these aren't set as project properties
260+
username findProperty("sonatypeUsername")
261+
password findProperty("sonatypePassword")
262+
}
263+
String snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
264+
String releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
265+
url = isSnapshot(version.toString()) ? snapshotsRepoUrl : releasesRepoUrl
266+
}
267+
}
268+
}
269+
270+
signing {
271+
sign publishing.publications.mavenJava
272+
}

gradle/wrapper/gradle-wrapper.jar

-383 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Dec 12 12:59:33 PST 2017
1+
#Wed Aug 08 13:44:00 PDT 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip

javadoc-fake/README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Included here is fake javadoc to pass sonatype upload checks.
2+
See https://central.sonatype.org/pages/requirements.html

versionInfo.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ project.ext.versions = [
3434
, mysqlConnector: '5.1.46'
3535
, nebulaDependencyLock: '5.0.0'
3636
, nebulaGit: '3.0.1'
37-
, nebulaRelease: '6.1.0'
38-
, nebulaPublish: '5.1.5'
37+
, nebulaRelease: '6.3.5'
38+
, nebulaPublish: '8.2.0'
3939
, pegdown: '1.4.2'
4040
, reflections: '0.9.10'
4141
, scalalang: '2.11.5'

0 commit comments

Comments
 (0)