Skip to content

Commit 7c28e94

Browse files
authored
Javadoc publish kokoro job uses docpublisher (#243)
* Javadoc publish kokoro job uses docpublisher * Fix config path * Fix site:stage config * Move config to reporting * Fix indent
1 parent e336dd2 commit 7c28e94

File tree

5 files changed

+139
-63
lines changed

5 files changed

+139
-63
lines changed
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
# Format: //devtools/kokoro/config/proto/build.proto
2-
32
env_vars: {
4-
key: "TRAMPOLINE_BUILD_FILE"
5-
value: "github/google-auth-library-java/.kokoro/release/publish_javadoc.sh"
3+
key: "STAGING_BUCKET"
4+
value: "docs-staging"
65
}
76

87
env_vars: {
9-
key: "LINK_LATEST"
10-
value: "true"
8+
key: "TRAMPOLINE_BUILD_FILE"
9+
value: "github/google-auth-library-java/.kokoro/release/publish_javadoc.sh"
1110
}
1211

13-
env_vars: {
14-
key: "BUCKET"
15-
value: "gcloud-javadoc-testing"
12+
before_action {
13+
fetch_keystore {
14+
keystore_resource {
15+
keystore_config_id: 73713
16+
keyname: "docuploader_service_account"
17+
}
18+
}
1619
}

.kokoro/release/publish_javadoc.sh

Lines changed: 39 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,55 @@
11
#!/bin/bash
2-
# Copyright 2018, Google Inc. All rights reserved.
2+
# Copyright 2019 Google Inc.
33
#
4-
# Redistribution and use in source and binary forms, with or without
5-
# modification, are permitted provided that the following conditions are
6-
# met:
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
77
#
8-
# * Redistributions of source code must retain the above copyright
9-
# notice, this list of conditions and the following disclaimer.
10-
# * Redistributions in binary form must reproduce the above
11-
# copyright notice, this list of conditions and the following disclaimer
12-
# in the documentation and/or other materials provided with the
13-
# distribution.
8+
# http://www.apache.org/licenses/LICENSE-2.0
149
#
15-
# * Neither the name of Google Inc. nor the names of its
16-
# contributors may be used to endorse or promote products derived from
17-
# this software without specific prior written permission.
18-
#
19-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22-
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23-
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
3017

31-
set -e
18+
if [[ -z "${CREDENTIALS}" ]]; then
19+
CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account
20+
fi
3221

33-
if [[ -z "${BUCKET}" ]]; then
34-
echo "Must set BUCKET environment variable"
35-
exit 1
22+
if [[ -z "${STAGING_BUCKET}" ]]; then
23+
echo "Need to set STAGING_BUCKET environment variable"
24+
exit 1
3625
fi
3726

27+
# work from the git root directory
3828
pushd $(dirname "$0")/../../
3929

40-
# Pull the library version from project properties
41-
VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
30+
# install docuploader package
31+
python3 -m pip install gcp-docuploader
4232

43-
case "${VERSION}" in
44-
*-SNAPSHOT)
45-
echo "Cannot publish javadoc for -SNAPSHOT versions"
46-
exit 1
47-
;;
48-
"")
49-
echo "Could not obtain version number from maven-help-plugin."
50-
exit 1
51-
;;
52-
esac
33+
# compile all packages
34+
mvn clean install -B -DskipTests=true
5335

54-
# Generate the javadoc from scratch
55-
mvn clean install javadoc:aggregate -DskipTests=true -B
36+
NAME=google-auth-library
37+
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)
5638

57-
# Sync the current version to gCS
58-
gsutil -m rsync -d target/site gs://${BUCKET}/java/google-auth-library-java/${VERSION}
39+
# build the docs
40+
mvn site -B
5941

60-
if [[ "${LINK_LATEST}" == "true" ]]; then
61-
# Sync the current content to latest
62-
gsutil -m rsync gs://${BUCKET}/java/google-auth-library-java/${VERSION} gs://${BUCKET}/java/google-auth-library-java/latest
63-
fi
42+
pushd target/site/apidocs
43+
44+
# create metadata
45+
python3 -m docuploader create-metadata \
46+
--name ${NAME} \
47+
--version ${VERSION} \
48+
--language java
49+
50+
# upload docs
51+
python3 -m docuploader upload . \
52+
--credentials ${CREDENTIALS} \
53+
--staging-bucket ${STAGING_BUCKET}
6454

6555
popd

appengine/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,4 @@
7676
<scope>test</scope>
7777
</dependency>
7878
</dependencies>
79-
8079
</project>

pom.xml

Lines changed: 88 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
authorization to enable calling Google APIs.</description>
1818
<url>https://github.com/googleapis/google-auth-library-java</url>
1919

20+
<distributionManagement>
21+
<site>
22+
<id>googleapis.dev</id>
23+
<name>Google self-hosted documentation site</name>
24+
<url>https://googleapis.dev/java/google-auth-library/${project.version}</url>
25+
</site>
26+
</distributionManagement>
27+
2028
<licenses>
2129
<license>
2230
<name>BSD New license</name>
@@ -139,7 +147,7 @@
139147
<plugin>
140148
<groupId>org.apache.maven.plugins</groupId>
141149
<artifactId>maven-javadoc-plugin</artifactId>
142-
<version>2.9.1</version>
150+
<version>3.1.0</version>
143151
<executions>
144152
<execution>
145153
<id>attach-javadocs</id>
@@ -190,10 +198,6 @@
190198
<groupId>org.apache.maven.plugins</groupId>
191199
<artifactId>maven-source-plugin</artifactId>
192200
</plugin>
193-
<plugin>
194-
<groupId>org.apache.maven.plugins</groupId>
195-
<artifactId>maven-javadoc-plugin</artifactId>
196-
</plugin>
197201
<plugin>
198202
<groupId>org.apache.maven.plugins</groupId>
199203
<artifactId>maven-checkstyle-plugin</artifactId>
@@ -217,6 +221,14 @@
217221
</execution>
218222
</executions>
219223
</plugin>
224+
<plugin>
225+
<groupId>org.apache.maven.plugins</groupId>
226+
<artifactId>maven-site-plugin</artifactId>
227+
<version>3.7.1</version>
228+
<configuration>
229+
<skipDeploy>true</skipDeploy>
230+
</configuration>
231+
</plugin>
220232
<plugin>
221233
<groupId>org.jacoco</groupId>
222234
<artifactId>jacoco-maven-plugin</artifactId>
@@ -239,6 +251,51 @@
239251
</plugins>
240252
</build>
241253

254+
<reporting>
255+
<plugins>
256+
<plugin>
257+
<groupId>org.apache.maven.plugins</groupId>
258+
<artifactId>maven-javadoc-plugin</artifactId>
259+
<version>3.1.0</version>
260+
<reportSets>
261+
<reportSet>
262+
<id>html</id>
263+
<reports>
264+
<report>aggregate</report>
265+
<report>javadoc</report>
266+
</reports>
267+
</reportSet>
268+
</reportSets>
269+
<configuration>
270+
<doclint>none</doclint>
271+
<source>7</source>
272+
<outputDirectory>${project.build.directory}/javadoc</outputDirectory>
273+
<doctitle>Google Auth Library for Java ${project.version}</doctitle>
274+
<overview>${basedir}/overview.html</overview>
275+
<groups>
276+
<group>
277+
<title>google-auth-library-credentials</title>
278+
<packages>com.google.auth*</packages>
279+
</group>
280+
<group>
281+
<title>google-auth-library-oauth2-http</title>
282+
<packages>com.google.auth.http*:com.google.auth.oauth2*</packages>
283+
</group>
284+
<group>
285+
<title>google-auth-library-appengine</title>
286+
<packages>com.google.auth.appengine*</packages>
287+
</group>
288+
</groups>
289+
<links>
290+
<link>http://download.oracle.com/javase/7/docs/api/</link>
291+
<link>http://cloud.google.com/appengine/docs/java/javadoc</link>
292+
</links>
293+
<windowtitle>google-auth-library ${project.version}</windowtitle>
294+
</configuration>
295+
</plugin>
296+
</plugins>
297+
</reporting>
298+
242299
<profiles>
243300
<profile>
244301
<id>release-sign-artifacts</id>
@@ -250,6 +307,32 @@
250307
</activation>
251308
<build>
252309
<plugins>
310+
<plugin>
311+
<groupId>org.apache.maven.plugins</groupId>
312+
<artifactId>maven-source-plugin</artifactId>
313+
<version>3.0.1</version>
314+
<executions>
315+
<execution>
316+
<id>attach-sources</id>
317+
<goals>
318+
<goal>jar-no-fork</goal>
319+
</goals>
320+
</execution>
321+
</executions>
322+
</plugin>
323+
<plugin>
324+
<groupId>org.apache.maven.plugins</groupId>
325+
<artifactId>maven-javadoc-plugin</artifactId>
326+
<version>3.1.0</version>
327+
<executions>
328+
<execution>
329+
<id>attach-javadocs</id>
330+
<goals>
331+
<goal>jar</goal>
332+
</goals>
333+
</execution>
334+
</executions>
335+
</plugin>
253336
<plugin>
254337
<groupId>org.apache.maven.plugins</groupId>
255338
<artifactId>maven-gpg-plugin</artifactId>

versions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Format:
22
# module:released-version:current-version
33

4+
google-auth-library:0.15.0:0.15.1-SNAPSHOT
45
google-auth-library-parent:0.15.0:0.15.1-SNAPSHOT
56
google-auth-library-appengine:0.15.0:0.15.1-SNAPSHOT
67
google-auth-library-credentials:0.15.0:0.15.1-SNAPSHOT

0 commit comments

Comments
 (0)