Skip to content

Commit a1ced97

Browse files
committed
GH-537: [Release][Docs] Generate API reference
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 7580bf5 commit a1ced97

File tree

5 files changed

+93
-19
lines changed

5 files changed

+93
-19
lines changed

.github/workflows/rc.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,49 @@ jobs:
7676
name: release-source
7777
path: |
7878
apache-arrow-java-*
79+
docs:
80+
name: Docs
81+
runs-on: ubuntu-latest
82+
timeout-minutes: 30
83+
needs:
84+
- source
85+
env:
86+
DOCKER_VOLUME_PREFIX: .docker/
87+
permissions:
88+
contents: read
89+
packages: write
90+
steps:
91+
- name: Download source archive
92+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
93+
with:
94+
name: release-source
95+
- name: Extract source archive
96+
run: |
97+
tar -xf apache-arrow-java-*.tar.gz --strip-components=1
98+
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
99+
with:
100+
registry: ghcr.io
101+
username: ${{ github.actor }}
102+
password: ${{ secrets.GITHUB_TOKEN }}
103+
- name: Cache
104+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
105+
with:
106+
path: .docker
107+
key: docs-${{ hashFiles('compose.yaml', '**/pom.xml', '**/*.java') }}
108+
restore-keys: docs-
109+
- name: Build
110+
run: |
111+
docker compose run \
112+
--volume "${PWD}/build/:/build/" \
113+
docs
114+
- name: Compress into single artifact to keep directory structure
115+
run: |
116+
tar -cvzf docs.tar.gz -C build/java docs
117+
- name: Upload artifacts
118+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
119+
with:
120+
name: release-docs-${{ matrix.platform.arch }}
121+
path: docs.tar.gz
79122
jni-linux:
80123
name: JNI ${{ matrix.platform.runs_on }} ${{ matrix.platform.arch }}
81124
runs-on: ${{ matrix.platform.runs_on }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
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:

ci/scripts/build.sh

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,19 @@
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
2424
fi
2525

2626
source_dir=${1}
27-
build_dir=${2}
27+
build_dir=${2}/java
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,38 @@ 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: https://github.com/apache/arrow/issues/22021
65+
if [ "${ARROW_JAVA_SHADE_FLATBUFFERS:-OFF}" == "ON" ]; then
6566
mvn="${mvn} -Pshade-flatbuffers"
6667
fi
6768

68-
if [ "${ARROW_JAVA_CDATA}" = "ON" ]; then
69+
if [ "${ARROW_JAVA_CDATA:-OFF}" = "ON" ]; then
6970
mvn="${mvn} -Darrow.c.jni.dist.dir=${java_jni_dist_dir} -Parrow-c-data"
7071
fi
7172

72-
if [ "${ARROW_JAVA_JNI}" = "ON" ]; then
73+
if [ "${ARROW_JAVA_JNI:-OFF}" = "ON" ]; then
7374
mvn="${mvn} -Darrow.cpp.build.dir=${java_jni_dist_dir} -Parrow-jni"
7475
fi
7576

7677
# Use `2 * ncores` threads
7778
${mvn} -T 2C clean install
7879

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
80+
if [ "${ARROW_JAVA_BUILD_DOCS:-OFF}" == "ON" ]; then
81+
# HTTP pooling is turned off to avoid download issues:
82+
# https://github.com/apache/arrow/issues/27496
83+
#
84+
# Maven site plugins not compatible with multithreading:
85+
# https://github.com/apache/arrow/issues/43378
86+
${mvn} \
87+
-Dcheckstyle.skip=true \
88+
-Dhttp.keepAlive=false \
89+
-Dmaven.wagon.http.pool=false \
90+
site
91+
rm -rf docs/reference
92+
mkdir -p docs
93+
cp -a target/site/apidocs/ docs/reference
8594
fi
8695

8796
popd

ci/scripts/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if [[ "${ARROW_JAVA_TEST:-ON}" != "ON" ]]; then
2424
fi
2525

2626
source_dir=${1}
27-
build_dir=${2}
27+
build_dir=${2}/java
2828
java_jni_dist_dir=${3}
2929

3030
mvn="mvn -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"

compose.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,30 @@ 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"
52+
53+
docs:
54+
# Build docs.
55+
#
56+
# Usage:
57+
# docker compose build docs
58+
# docker compose run docs
59+
# Parameters:
60+
# MAVEN: 3.9.9
61+
# JDK: 11, 17, 21
62+
image: ${ARCH}/maven:${MAVEN}-eclipse-temurin-${JDK}
63+
volumes:
64+
- .:/arrow-java:delegated
65+
- ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
66+
environment:
67+
ARROW_JAVA_BUILD_DOCS: "ON"
68+
ARROW_JAVA_SKIP_GIT_PLUGIN: "ON"
69+
command:
70+
- /arrow-java/ci/scripts/build.sh
71+
- /arrow-java
72+
- /build
73+
- /jni
5274

5375
conda-jni-cdata:
5476
# Builds and tests just the C Data Interface JNI library and JARs.
@@ -103,7 +125,7 @@ services:
103125
volumes:
104126
- .:/arrow-java:delegated
105127
- ${ARROW_REPO_ROOT}:/arrow:delegated
106-
- ${DOCKER_VOLUME_PREFIX}ccache:/ccache:delegated
128+
- ${DOCKER_VOLUME_PREFIX}ccache-cache:/ccache:delegated
107129
- ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
108130
environment:
109131
ARROW_JAVA_CDATA: "ON"

0 commit comments

Comments
 (0)