Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 563c98c

Browse files
authored
build: fix Sonatype release (#1522)
1 parent 2d76bff commit 563c98c

File tree

11 files changed

+96
-156
lines changed

11 files changed

+96
-156
lines changed

.kokoro/build.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
set -eo pipefail
1717

1818
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
19-
## cd to the parent directory, i.e. the root of the git repo
19+
# cd to the parent directory, i.e. the root of the git repo
2020
cd ${scriptDir}/..
2121

2222
# Print out Java
2323
java -version
2424
echo $JOB_TYPE
2525

26-
./gradlew assemble
27-
./gradlew build install
26+
./gradlew -Pskip.signing build publishToMavenLocal

.kokoro/release/common.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ build_file: "gax-java/.kokoro/trampoline.sh"
88

99
# Configure the docker image for kokoro-trampoline.
1010
env_vars: {
11-
key: "TRAMPOLINE_IMAGE"
12-
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
11+
key: "TRAMPOLINE_IMAGE"
12+
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
1313
}
1414

1515
before_action {

.kokoro/release/drop.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Format: //devtools/kokoro/config/proto/build.proto
2-
env_vars: {
3-
key: "TRAMPOLINE_BUILD_FILE"
4-
value: "github/gax-java/.kokoro/release/drop.sh"
2+
env_vars: {
3+
key: "TRAMPOLINE_BUILD_FILE"
4+
value: "github/gax-java/.kokoro/release/drop.sh"
55
}

.kokoro/release/promote.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Format: //devtools/kokoro/config/proto/build.proto
2-
env_vars: {
3-
key: "TRAMPOLINE_BUILD_FILE"
4-
value: "github/gax-java/.kokoro/release/promote.sh"
2+
env_vars: {
3+
key: "TRAMPOLINE_BUILD_FILE"
4+
value: "github/gax-java/.kokoro/release/promote.sh"
55
}

.kokoro/release/publish_javadoc11.cfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
# cloud-rad production
44
env_vars: {
5-
key: "STAGING_BUCKET_V2"
6-
value: "docs-staging-v2"
5+
key: "STAGING_BUCKET_V2"
6+
value: "docs-staging-v2"
77
}
88

99
# Configure the docker image for kokoro-trampoline
1010
env_vars: {
11-
key: "TRAMPOLINE_IMAGE"
12-
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
11+
key: "TRAMPOLINE_IMAGE"
12+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
1313
}
1414

1515
env_vars: {
16-
key: "TRAMPOLINE_BUILD_FILE"
17-
value: "github/gax-java/.kokoro/release/publish_javadoc11.sh"
16+
key: "TRAMPOLINE_BUILD_FILE"
17+
value: "github/gax-java/.kokoro/release/publish_javadoc11.sh"
1818
}
1919

2020
before_action {

.kokoro/release/stage.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Format: //devtools/kokoro/config/proto/build.proto
2-
env_vars: {
3-
key: "TRAMPOLINE_BUILD_FILE"
4-
value: "github/gax-java/.kokoro/release/stage.sh"
2+
env_vars: {
3+
key: "TRAMPOLINE_BUILD_FILE"
4+
value: "github/gax-java/.kokoro/release/stage.sh"
55
}
66

77
env_vars: {

.kokoro/release/stage.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ setup_environment_secrets
3030
mkdir -p ${HOME}/.gradle
3131
create_gradle_properties_file "${HOME}/.gradle/gradle.properties"
3232

33-
# This is a multi module project. Cannot publish directly to maven without
34-
# resolving this issue https://github.com/gradle-nexus/publish-plugin/issues/19
35-
# Might migrate to maven pom in the future.
36-
./gradlew publishToSonatype releaseSonatypeStagingRepository
33+
if [[ -z "${AUTORELEASE_PR}" ]]
34+
then
35+
./gradlew publishToSonatype
36+
else
37+
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
38+
fi

benchmark/build.gradle

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
project.version = "0.75.4-SNAPSHOT" // {x-version-update:benchmark:current}
2-
3-
buildscript {
4-
repositories {
5-
maven {
6-
url "https://plugins.gradle.org/m2/"
7-
}
8-
}
9-
dependencies {
10-
classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.3"
11-
}
1+
plugins {
2+
id 'me.champeau.gradle.jmh' version '0.5.3'
123
}
134

14-
apply plugin: "me.champeau.gradle.jmh"
15-
apply plugin: 'java'
16-
17-
repositories {
18-
mavenCentral()
19-
}
5+
project.version = "0.75.4-SNAPSHOT" // {x-version-update:benchmark:current}
206

217
dependencies {
22-
implementation project(':gax')
23-
implementation project(':gax-grpc')
24-
implementation "io.grpc:grpc-netty:${libraries['version.io_grpc']}"
25-
implementation 'com.google.api.grpc:grpc-google-cloud-bigtable-v2:2.1.4'
26-
implementation 'com.google.api.grpc:grpc-google-cloud-pubsub-v1:1.96.6'
8+
implementation project(':gax')
9+
implementation project(':gax-grpc')
10+
implementation "io.grpc:grpc-netty:${libraries['version.io_grpc']}"
11+
implementation 'com.google.api.grpc:grpc-google-cloud-bigtable-v2:2.1.4'
12+
implementation 'com.google.api.grpc:grpc-google-cloud-pubsub-v1:1.96.6'
2713
}
2814

2915
// Allow command line to target specific test
30-
if (project.properties.containsKey('include')) {
31-
jmh.include = [project.properties.get('include')]
16+
if (project.hasProperty('include')) {
17+
jmh.include = [project.include]
3218
}

build.gradle

Lines changed: 47 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
import groovy.io.FileType
22

3-
buildscript {
4-
repositories {
5-
mavenLocal()
6-
maven {
7-
url 'https://plugins.gradle.org/m2/'
8-
}
9-
mavenCentral()
10-
jcenter()
11-
}
12-
dependencies {
13-
classpath "net.ltgt.gradle:gradle-apt-plugin:0.21",
14-
"com.github.jengelman.gradle.plugins:shadow:6.1.0",
15-
"io.github.gradle-nexus:publish-plugin:1.1.0",
16-
"gradle.plugin.com.dorongold.plugins:task-tree:1.5"
17-
18-
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
19-
}
3+
plugins {
4+
id 'java'
5+
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
6+
7+
id 'com.dorongold.task-tree' version '2.1.0' apply false
8+
id 'com.github.johnrengelman.shadow' version '6.1.0' apply false
9+
id 'com.github.sherter.google-java-format' version '0.8' apply false
10+
id 'net.ltgt.apt' version '0.21' apply false
2011
}
2112

22-
apply plugin: 'java'
23-
apply plugin: 'com.github.sherter.google-java-format'
24-
apply plugin: 'io.github.gradle-nexus.publish-plugin'
25-
2613
// TODO: Populate this from dependencies.properties version property (for proper Gradle-Bazel sync)
2714
project.version = "2.5.4-SNAPSHOT" // {x-version-update:gax:current}
2815

@@ -34,20 +21,10 @@ ext {
3421
libraryVendor = 'Google'
3522
}
3623

37-
googleJavaFormat {
38-
exclude '.apt_generated/**'
39-
exclude 'bin/**'
40-
exclude 'build/**'
41-
exclude 'bazel*/**'
42-
}
43-
44-
// google-java-format-gradle-plugin:0.8 does not work with Java 1.7.
45-
verifyGoogleJavaFormat.onlyIf { JavaVersion.current().isJava8Compatible() }
46-
4724
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword') &&
4825
!nonReleaseProjects.contains(project.name)) {
4926
nexusPublishing {
50-
packageGroup = "com.google.api"
27+
packageGroup = 'com.google.api'
5128
repositories {
5229
sonatype { //or custom repository name
5330
nexusUrl.set(uri('https://google.oss.sonatype.org/service/local/'))
@@ -59,16 +36,34 @@ if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
5936
}
6037
}
6138

62-
allprojects {
63-
repositories {
64-
mavenCentral() // for google-java-format's dependency
65-
}
39+
subprojects {
40+
apply plugin: 'java'
41+
apply plugin: 'eclipse'
42+
apply plugin: 'idea'
43+
apply plugin: 'jacoco'
44+
apply plugin: 'maven-publish'
45+
apply plugin: 'signing'
46+
47+
apply plugin: 'com.dorongold.task-tree'
48+
apply plugin: 'com.github.johnrengelman.shadow'
49+
apply plugin: 'com.github.sherter.google-java-format'
50+
apply plugin: 'net.ltgt.apt'
51+
52+
group = 'com.google.api'
53+
54+
sourceCompatibility = 1.8
55+
targetCompatibility = 1.8
6656

6757
// Formatting tasks
6858
// ================
69-
apply plugin: 'com.github.sherter.google-java-format'
59+
googleJavaFormat {
60+
exclude '.apt_generated/**'
61+
exclude 'bin/**'
62+
exclude 'build/**'
63+
exclude 'bazel*/**'
64+
}
65+
7066
test.dependsOn verifyGoogleJavaFormat
71-
verifyGoogleJavaFormat.onlyIf { JavaVersion.current().isJava8Compatible() }
7267

7368
task verifyLicense {
7469
doLast {
@@ -95,24 +90,6 @@ allprojects {
9590
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
9691
}
9792
}
98-
}
99-
100-
subprojects {
101-
apply plugin: 'java'
102-
apply plugin: 'eclipse'
103-
apply plugin: 'maven'
104-
apply plugin: 'idea'
105-
apply plugin: 'jacoco'
106-
apply plugin: 'signing'
107-
apply plugin: "net.ltgt.apt"
108-
apply plugin: 'com.github.johnrengelman.shadow'
109-
apply plugin: 'maven-publish'
110-
apply plugin: 'com.dorongold.task-tree'
111-
112-
group = "com.google.api"
113-
114-
sourceCompatibility = 1.8
115-
targetCompatibility = 1.8
11693

11794
// Dependencies
11895
// ------------
@@ -177,14 +154,6 @@ subprojects {
177154
exclude('**/*Test.java')
178155
}
179156

180-
// JavaDocV1 html
181-
// -------
182-
183-
task javadocJar(type: Jar) {
184-
archiveClassifier = 'javadoc'
185-
from javadoc
186-
}
187-
188157
javadoc.options {
189158
encoding = 'UTF-8'
190159
links 'https://docs.oracle.com/javase/7/docs/api/'
@@ -197,24 +166,18 @@ subprojects {
197166
}
198167
}
199168

200-
// JavaDocV3 - docFX
169+
// JavaDocV1 html
201170
// -------
202-
203-
task javadocJarV3(type: Jar) {
171+
task javadocJar(type: Jar) {
204172
archiveClassifier = 'javadoc'
205173
from javadoc
206174
}
207175

208-
javadoc.options {
209-
encoding = 'UTF-8'
210-
links 'https://docs.oracle.com/javase/7/docs/api/'
211-
212-
if (JavaVersion.current().isJava8Compatible()) {
213-
addStringOption('Xdoclint:all,-missing', '-quiet')
214-
}
215-
if (JavaVersion.current().isJava11Compatible()) {
216-
addStringOption('-release', '7')
217-
}
176+
// JavaDocV3 - docFX
177+
// -------
178+
task javadocJarV3(type: Jar) {
179+
archiveClassifier = 'javadoc'
180+
from javadoc
218181
}
219182

220183
// Test jar
@@ -370,8 +333,8 @@ subprojects {
370333
maven {
371334
url 'https://google.oss.sonatype.org/service/local/staging/deploy/maven2/'
372335
credentials {
373-
username = project.hasProperty('ossrhUsername') ? project.getProperty('ossrhUsername') : null
374-
password = project.hasProperty('ossrhPassword') ? project.getProperty('ossrhPassword') : null
336+
username = project.findProperty('ossrhUsername')
337+
password = project.findProperty('ossrhPassword')
375338
}
376339
}
377340
}
@@ -405,6 +368,11 @@ subprojects {
405368
}
406369
}
407370

371+
javadoc.options {
372+
encoding = 'UTF-8'
373+
links 'https://docs.oracle.com/javase/7/docs/api/'
374+
}
375+
408376
// JavaDocV1 html
409377
// -------
410378
task javadocCombined(type: Javadoc) {
@@ -413,16 +381,6 @@ task javadocCombined(type: Javadoc) {
413381
destinationDir = new File(projectDir, 'tmp_docs')
414382
}
415383

416-
javadoc.options {
417-
encoding = 'UTF-8'
418-
links 'https://docs.oracle.com/javase/7/docs/api/'
419-
}
420-
421-
clean {
422-
delete 'tmp_gh-pages/'
423-
delete 'tmp_docs/'
424-
}
425-
426384
// JavaDocV3 docFX
427385
// -------
428386
task javadocCombinedV3(type: Javadoc) {

gax-bom/build.gradle

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
2-
buildscript {
3-
repositories {
4-
mavenLocal()
5-
maven {
6-
url 'https://plugins.gradle.org/m2/'
7-
}
8-
mavenCentral()
9-
jcenter()
10-
}
11-
}
12-
13-
archivesBaseName = "gax-bom"
1+
archivesBaseName = 'gax-bom'
142

153
project.version = "2.5.4-SNAPSHOT" // {x-version-update:gax-bom:current}
164

175
ext {
18-
mavenJavaDir = "$project.buildDir/publications/mavenJava"
6+
mavenJavaDir = "$buildDir/publications/mavenJava"
197
mavenJavaBomOutputFile = file(mavenJavaDir + "/pom-default.xml")
8+
mavenJavaBomAscOutputFile = file(mavenJavaDir + "/pom-default.xml.asc")
209
}
2110

2211
// Copy our pom.xml to the location where a generated POM would go
@@ -88,8 +77,8 @@ afterEvaluate {
8877
maven {
8978
url 'https://google.oss.sonatype.org/service/local/staging/deploy/maven2/'
9079
credentials {
91-
username = project.hasProperty('ossrhUsername') ? project.getProperty('ossrhUsername') : null
92-
password = project.hasProperty('ossrhPassword') ? project.getProperty('ossrhPassword') : null
80+
username = project.findProperty('ossrhUsername')
81+
password = project.findProperty('ossrhPassword')
9382
}
9483
}
9584
}
@@ -101,6 +90,12 @@ afterEvaluate {
10190
useGpgCmd()
10291
}
10392
sign publishing.publications.mavenJava
93+
94+
publishing.publications.mavenJava(MavenPublication) {
95+
artifact(mavenJavaBomAscOutputFile) {
96+
extension 'pom.asc'
97+
}
98+
}
10499
}
105100
}
106101
}

0 commit comments

Comments
 (0)