Skip to content

Commit 03cd1e4

Browse files
committed
update release configuration
1 parent 4020b1f commit 03cd1e4

File tree

3 files changed

+64
-37
lines changed

3 files changed

+64
-37
lines changed

.ldrelease/publish-docs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ue
4+
5+
# Publish to Github Pages
6+
echo "Publishing to Github Pages"
7+
./gradlew gitPublishPush

.ldrelease/publish.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ue
4+
5+
# Publish to Sonatype
6+
echo "Publishing to Sonatype"
7+
./gradlew publishToSonatype closeAndReleaseRepository || { echo "Gradle publish/release failed" >&2; exit 1; }

build.gradle

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
apply plugin: 'java'
2-
apply plugin: 'maven-publish'
3-
apply plugin: 'signing'
4-
apply plugin: 'idea'
5-
apply plugin: 'com.github.johnrengelman.shadow'
6-
apply plugin: 'io.codearte.nexus-staging'
7-
apply plugin: 'org.ajoberstar.github-pages'
1+
2+
buildscript {
3+
repositories {
4+
mavenCentral()
5+
mavenLocal()
6+
}
7+
}
8+
9+
plugins {
10+
id "java"
11+
id "java-library"
12+
id "checkstyle"
13+
id "signing"
14+
id "com.github.johnrengelman.shadow" version "4.0.4"
15+
id "maven-publish"
16+
id "de.marcphilipp.nexus-publish" version "0.3.0"
17+
id "io.codearte.nexus-staging" version "0.21.2"
18+
id "org.ajoberstar.git-publish" version "2.1.3"
19+
id "idea"
20+
}
821

922
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
1023

@@ -68,19 +81,6 @@ dependencies {
6881
shadow libraries.external
6982
}
7083

71-
buildscript {
72-
repositories {
73-
jcenter()
74-
mavenCentral()
75-
mavenLocal()
76-
}
77-
dependencies {
78-
classpath 'org.ajoberstar:gradle-git:1.5.0-rc.1'
79-
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
80-
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.8.0"
81-
}
82-
}
83-
8484
task sourcesJar(type: Jar, dependsOn: classes) {
8585
classifier = 'sources'
8686
from sourceSets.main.allSource
@@ -130,6 +130,7 @@ idea {
130130

131131
nexusStaging {
132132
packageGroup = "com.launchdarkly"
133+
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
133134
}
134135

135136
def pomConfig = {
@@ -170,21 +171,35 @@ publishing {
170171

171172
pom.withXml {
172173
def root = asNode()
173-
root.appendNode('description', 'DynamoDB-backed feature store for the LaunchDarkly Java SDK')
174-
asNode().children().last() + pomConfig
174+
root.appendNode('description', 'DynamoDB-backed data store for the LaunchDarkly Java SDK')
175+
176+
// The following workaround is for a known issue where the Shadow plugin assumes that all
177+
// non-shaded dependencies should have "runtime" scope rather than "compile".
178+
// https://github.com/johnrengelman/shadow/issues/321
179+
// Currently there doesn't seem to be any way way around this other than simply hacking the
180+
// pom at this point after it has been generated by Shadow. All of the dependencies that
181+
// are in the pom at this point should have compile scope.
182+
def dependenciesNode = root.getAt('dependencies').get(0)
183+
dependenciesNode.each { dependencyNode ->
184+
def scopeNode = dependencyNode.getAt('scope').get(0)
185+
scopeNode.setValue('compile')
186+
}
187+
188+
root.children().last() + pomConfig
175189
}
176190
}
177191
}
178192
repositories {
179193
mavenLocal()
180-
maven {
181-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
182-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
183-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
184-
credentials {
185-
username ossrhUsername
186-
password ossrhPassword
187-
}
194+
}
195+
}
196+
197+
nexusPublishing {
198+
clientTimeout = java.time.Duration.ofMinutes(3) // we've seen extremely long delays in creating repositories
199+
repositories {
200+
sonatype {
201+
username = ossrhUsername
202+
password = ossrhPassword
188203
}
189204
}
190205
}
@@ -193,13 +208,11 @@ signing {
193208
sign publishing.publications.shadow
194209
}
195210

196-
githubPages {
197-
repoUri = 'https://github.com/launchdarkly/java-server-sdk-dynamodb.git'
198-
pages {
211+
gitPublish {
212+
repoUri = '[email protected]:launchdarkly/java-server-sdk-dynamodb.git'
213+
branch = 'gh-pages'
214+
contents {
199215
from javadoc
200216
}
201-
credentials {
202-
username = githubUser
203-
password = githubPassword
204-
}
217+
commitMessage = 'publishing javadocs'
205218
}

0 commit comments

Comments
 (0)