Skip to content

Commit 1960085

Browse files
authored
GH-537: [Release][Docs] Generate API reference (#538)
The followings are out-of-scope: * Generate Sphinx based documents * Publish this to https://arrow.apache.org/java/reference/ in release process * Publish this to https://arrow.apache.org/dev/reference/ nightly
1 parent c377e3b commit 1960085

File tree

6 files changed

+83
-34
lines changed

6 files changed

+83
-34
lines changed

.github/workflows/rc.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,24 @@ jobs:
394394
path: ~/.m2
395395
key: binaries-build-${{ hashFiles('**/*.java', '**/pom.xml') }}
396396
restore-keys: binaries-build-
397-
- name: Build bundled JAR
398-
env:
399-
MAVEN_ARGS: >-
400-
--no-transfer-progress
397+
- name: Build bundled JAR and docs
401398
run: |
402399
ci/scripts/jni_full_build.sh . jni binaries
403-
- name: Upload artifacts
400+
- name: Prepare docs
401+
run: |
402+
mkdir -p docs
403+
cp -a target/site/apidocs docs/reference
404+
tar -cvzf docs.tar.gz docs
405+
- name: Upload binaries
404406
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
405407
with:
406408
name: release-binaries
407409
path: binaries/*
410+
- name: Upload docs
411+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
412+
with:
413+
name: release-docs
414+
path: docs.tar.gz
408415
verify:
409416
name: Verify
410417
needs:

.github/workflows/test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
6767
with:
6868
path: .docker
69-
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('**/compose.yaml', '**/pom.xml') }}
69+
key: maven-${{ matrix.jdk }}-${{ matrix.maven }}-${{ hashFiles('compose.yaml', '**/pom.xml', '**/*.java') }}
7070
restore-keys: maven-${{ matrix.jdk }}-${{ matrix.maven }}-
7171
- name: Execute Docker Build
7272
env:
@@ -108,12 +108,12 @@ jobs:
108108
shell: bash
109109
env:
110110
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
111-
run: ci/scripts/build.sh $(pwd) $(pwd)/build
111+
run: ci/scripts/build.sh . build jni
112112
- name: Test
113113
shell: bash
114114
env:
115115
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
116-
run: ci/scripts/test.sh $(pwd) $(pwd)/build
116+
run: ci/scripts/test.sh . build jni
117117

118118
windows:
119119
name: AMD64 Windows Server 2022 Java JDK ${{ matrix.jdk }}
@@ -139,12 +139,12 @@ jobs:
139139
shell: bash
140140
env:
141141
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
142-
run: ci/scripts/build.sh $(pwd) $(pwd)/build
142+
run: ci/scripts/build.sh . build jni
143143
- name: Test
144144
shell: bash
145145
env:
146146
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
147-
run: ci/scripts/test.sh $(pwd) $(pwd)/build
147+
run: ci/scripts/test.sh . build jni
148148

149149
integration:
150150
name: AMD64 integration
@@ -184,7 +184,7 @@ jobs:
184184
with:
185185
path: .docker
186186
key: integration-conda-${{ hashFiles('cpp/**') }}
187-
restore-keys: conda-
187+
restore-keys: integration-conda-
188188
- name: Setup Python
189189
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
190190
with:

ci/scripts/build.sh

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919

20-
set -eo pipefail
20+
set -euo pipefail
2121

2222
if [[ "${ARROW_JAVA_BUILD:-ON}" != "ON" ]]; then
2323
exit
@@ -27,11 +27,9 @@ source_dir=${1}
2727
build_dir=${2}
2828
java_jni_dist_dir=${3}
2929

30-
: "${BUILD_DOCS_JAVA:=OFF}"
31-
3230
mvn="mvn -B -DskipTests -Drat.skip=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
3331

34-
if [ "$ARROW_JAVA_SKIP_GIT_PLUGIN" ]; then
32+
if [ "${ARROW_JAVA_SKIP_GIT_PLUGIN:-OFF}" = "ON" ]; then
3533
mvn="${mvn} -Dmaven.gitcommitid.skip=true"
3634
fi
3735

@@ -61,27 +59,40 @@ done
6159

6260
pushd "${build_dir}"
6361

64-
if [ "${ARROW_JAVA_SHADE_FLATBUFFERS}" == "ON" ]; then
62+
# TODO: ARROW_JAVA_SHADE_FLATBUFFERS isn't used for our artifacts. Do
63+
# we need this?
64+
# See also:
65+
# * https://github.com/apache/arrow/issues/22021
66+
# * https://github.com/apache/arrow-java/issues/67
67+
if [ "${ARROW_JAVA_SHADE_FLATBUFFERS:-OFF}" == "ON" ]; then
6568
mvn="${mvn} -Pshade-flatbuffers"
6669
fi
6770

68-
if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
71+
if [ "${ARROW_JAVA_CDATA:-OFF}" = "ON" ]; then
6972
mvn="${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data"
7073
fi
7174

72-
if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
75+
if [ "${ARROW_JAVA_JNI:-OFF}" = "ON" ]; then
7376
mvn="${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni"
7477
fi
7578

7679
# Use `2 * ncores` threads
7780
${mvn} -T 2C clean install
7881

79-
if [ "${BUILD_DOCS_JAVA}" == "ON" ]; then
80-
# HTTP pooling is turned of to avoid download issues https://issues.apache.org/jira/browse/ARROW-11633
81-
# GH-43378: Maven site plugins not compatible with multithreading
82-
mkdir -p "${build_dir}"/docs/java/reference
83-
${mvn} -Dcheckstyle.skip=true -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false clean install site
84-
rsync -a target/site/apidocs/ "${build_dir}"/docs/java/reference
82+
if [ "${ARROW_JAVA_BUILD_DOCS:-OFF}" == "ON" ]; then
83+
# HTTP pooling is turned off to avoid download issues:
84+
# https://github.com/apache/arrow/issues/27496
85+
#
86+
# Maven site plugins not compatible with multithreading:
87+
# https://github.com/apache/arrow/issues/43378
88+
${mvn} \
89+
-Dcheckstyle.skip=true \
90+
-Dhttp.keepAlive=false \
91+
-Dmaven.wagon.http.pool=false \
92+
site
93+
rm -rf docs/reference
94+
mkdir -p docs
95+
cp -a target/site/apidocs/ docs/reference
8596
fi
8697

8798
popd

ci/scripts/jni_full_build.sh

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,21 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919

20-
set -eu
20+
set -euo pipefail
2121

22+
# shellcheck source=ci/scripts/util_log.sh
23+
. "$(dirname "${0}")/util_log.sh"
24+
25+
github_actions_group_begin "Prepare arguments"
2226
source_dir="$(cd "${1}" && pwd)"
2327
jni_build_dir="$(cd "${2}" && pwd)"
2428
dist_dir="${3}"
2529
rm -rf "${dist_dir}"
2630
mkdir -p "${dist_dir}"
2731
dist_dir="$(cd "${dist_dir}" && pwd)"
32+
github_actions_group_end
2833

34+
github_actions_group_begin "Clear old artifacts"
2935
# Ensure that there is no old artifacts inside the maven repository
3036
maven_repo=~/.m2/repository/org/apache/arrow
3137
if [ -d "$maven_repo" ]; then
@@ -34,7 +40,9 @@ if [ -d "$maven_repo" ]; then
3440
-exec echo {} ";" \
3541
-exec rm -rf {} ";"
3642
fi
43+
github_actions_group_end
3744

45+
github_actions_group_begin "Generate dummy GPG key"
3846
# Generate dummy GPG key for -Papache-release.
3947
# -Papache-release generates signs (*.asc) of artifacts.
4048
# We don't use these signs in our release process.
@@ -46,19 +54,37 @@ fi
4654
echo "%no-protection"
4755
) |
4856
gpg --full-generate-key --batch
57+
github_actions_group_end
4958

5059
pushd "${source_dir}"
60+
github_actions_group_begin "Build .jar"
5161
# build the entire project
52-
mvn clean \
53-
install \
62+
mvn \
63+
--no-transfer-progress \
64+
-Darrow.c.jni.dist.dir="${jni_build_dir}" \
65+
-Darrow.cpp.build.dir="${jni_build_dir}" \
5466
-Papache-release \
5567
-Parrow-c-data \
5668
-Parrow-jni \
57-
-Darrow.cpp.build.dir="${jni_build_dir}" \
69+
clean \
70+
install
71+
github_actions_group_end
72+
github_actions_group_begin "Build docs"
73+
# build docs
74+
mvn \
75+
--no-transfer-progress \
5876
-Darrow.c.jni.dist.dir="${jni_build_dir}" \
59-
--no-transfer-progress
77+
-Darrow.cpp.build.dir="${jni_build_dir}" \
78+
-Dcheckstyle.skip=true \
79+
-Dhttp.keepAlive=false \
80+
-Dmaven.wagon.http.pool=false \
81+
-Parrow-c-data \
82+
-Parrow-jni \
83+
site
84+
github_actions_group_end
6085
popd
6186

87+
github_actions_group_begin "Prepare artifacts"
6288
# copy all jar, zip and pom files to the distribution folder
6389
find ~/.m2/repository/org/apache/arrow \
6490
"(" \
@@ -75,3 +101,4 @@ for artifact in "${dist_dir}"/*; do
75101
sha256sum "${artifact}" >"${artifact}.sha256"
76102
sha512sum "${artifact}" >"${artifact}.sha512"
77103
done
104+
github_actions_group_end

ci/scripts/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ if [[ "${ARROW_JAVA_TEST:-ON}" != "ON" ]]; then
2323
exit
2424
fi
2525

26-
source_dir=${1}
26+
source_dir="$(cd "${1}" && pwd)"
2727
build_dir=${2}
2828
java_jni_dist_dir=${3}
2929

30+
if [ -d "${java_jni_dist_dir}" ]; then
31+
java_jni_dist_dir="$(cd "${java_jni_dist_dir}" && pwd)"
32+
fi
33+
3034
mvn="mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
3135
# Use `2 * ncores` threads
3236
mvn="${mvn} -T 2C"

compose.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ services:
4747
- ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
4848
command:
4949
/bin/bash -c "
50-
/arrow-java/ci/scripts/build.sh /arrow-java /build &&
51-
/arrow-java/ci/scripts/test.sh /arrow-java /build"
50+
/arrow-java/ci/scripts/build.sh /arrow-java /build /jni &&
51+
/arrow-java/ci/scripts/test.sh /arrow-java /build /jni"
5252

5353
conda-jni-cdata:
5454
# Builds and tests just the C Data Interface JNI library and JARs.
@@ -103,11 +103,11 @@ services:
103103
volumes:
104104
- .:/arrow-java:delegated
105105
- ${ARROW_REPO_ROOT}:/arrow:delegated
106-
- ${DOCKER_VOLUME_PREFIX}ccache:/ccache:delegated
106+
- ${DOCKER_VOLUME_PREFIX}ccache-cache:/ccache:delegated
107107
- ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
108108
environment:
109109
ARROW_JAVA_CDATA: "ON"
110110
CCACHE_DIR: "/ccache"
111111
command:
112112
["git config --global --add safe.directory /arrow-java && \
113-
/arrow-java/ci/scripts/jni_manylinux_build.sh /arrow-java /arrow /build /arrow-java/jni"]
113+
/arrow-java/ci/scripts/jni_manylinux_build.sh /arrow-java /arrow /build/java /arrow-java/jni"]

0 commit comments

Comments
 (0)