Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit a7d15be

Browse filesBrowse files
eaball35lesv
andauthored
chore: cloud-rad-java doc generation (#212)
* feat: cloud-rad-java doc generation * chore: fix file name Co-authored-by: Les Vogel <lesv@users.noreply.github.com>
1 parent c240935 commit a7d15be
Copy full SHA for a7d15be

File tree

Expand file treeCollapse file tree

3 files changed

+124
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+124
-0
lines changed

‎.kokoro/release/publish_javadoc11.cfg

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# cloud-rad production
4+
env_vars: {
5+
key: "STAGING_BUCKET_V2"
6+
value: "docs-staging-v2"
7+
}
8+
9+
# Configure the docker image for kokoro-trampoline
10+
env_vars: {
11+
key: "TRAMPOLINE_IMAGE"
12+
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
13+
}
14+
15+
env_vars: {
16+
key: "TRAMPOLINE_BUILD_FILE"
17+
value: "github/api-common-java/.kokoro/release/publish_javadoc11.sh"
18+
}
19+
20+
before_action {
21+
fetch_keystore {
22+
keystore_resource {
23+
keystore_config_id: 73713
24+
keyname: "docuploader_service_account"
25+
}
26+
}
27+
}
28+
29+
# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/<doclet name>
30+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx"

‎.kokoro/release/publish_javadoc11.sh

Copy file name to clipboard
+56Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
# Copyright 2019 Google Inc.
3+
#
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
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
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
17+
18+
if [[ -z "${CREDENTIALS}" ]]; then
19+
CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account
20+
fi
21+
22+
if [[ -z "${STAGING_BUCKET_V2}" ]]; then
23+
echo "Need to set STAGING_BUCKET environment variable"
24+
exit 1
25+
fi
26+
27+
# work from the git root directory
28+
pushd $(dirname "$0")/../../
29+
30+
# install docuploader package
31+
python3 -m pip install gcp-docuploader
32+
33+
NAME=api-common
34+
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)
35+
36+
# build the docs
37+
./gradlew javadocCombinedV3
38+
39+
# copy README to tmp_docs dir and rename index.md
40+
cp README.md tmp_docs/index.md
41+
42+
pushd tmp_docs
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_V2} \
54+
--destination-prefix docfx
55+
56+
popd

‎build.gradle

Copy file name to clipboardExpand all lines: build.gradle
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,26 @@ javadoc.options {
112112
links 'https://docs.oracle.com/javase/7/docs/api/'
113113
}
114114

115+
// JavaDocV3
116+
// -------
117+
118+
task javadocJarV3(type: Jar) {
119+
classifier = 'javadoc'
120+
from javadoc
121+
}
122+
123+
javadoc.options {
124+
encoding = 'UTF-8'
125+
links 'https://docs.oracle.com/javase/7/docs/api/'
126+
127+
if (JavaVersion.current().isJava8Compatible()) {
128+
addStringOption('Xdoclint:all,-missing', '-quiet')
129+
}
130+
if (JavaVersion.current().isJava11Compatible()) {
131+
addStringOption('-release', '7')
132+
}
133+
}
134+
115135
// Test Logging
116136
// ------------
117137

@@ -312,6 +332,24 @@ tasks.verifyGoogleJavaFormat {
312332
}
313333
test.dependsOn verifyGoogleJavaFormat
314334

335+
// JavaDocV3 docFX
336+
//
337+
task javadocCombinedV3(type: Javadoc) {
338+
source project.sourceSets.main.allJava
339+
classpath = files(project.sourceSets.main.compileClasspath)
340+
destinationDir = new File(projectDir, 'tmp_docs')
341+
342+
options.addStringOption('encoding', 'UTF-8')
343+
options.addStringOption("doclet", "com.microsoft.doclet.DocFxDoclet")
344+
options.docletpath = [file(System.getenv('KOKORO_GFILE_DIR') + "/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies-172556.jar")]
345+
}
346+
347+
clean {
348+
delete 'tmp_gh-pages/'
349+
delete 'tmp_docs/'
350+
}
351+
352+
315353
// Release
316354
// =======
317355

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.