Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions java/ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ so plain `rm -rf` works.
--cuda-version 12.9
```

This compiles the JNI layer against the static libcudf from Step 1 and emits a
single classifier JAR (e.g. `cudf-26.08.0-SNAPSHOT-cuda12.jar`) plus its POM
into a classifier-named subdirectory under `--output-dir`:
This compiles the JNI layer against the static libcudf from Step 1 and emits
the classifier JAR (e.g. `cudf-26.08.0-SNAPSHOT-cuda12.jar`), a
classifier-independent sources jar and javadoc jar, and the POM into a
classifier-named subdirectory under `--output-dir`:

```
/tmp/jars/cuda12/
cudf-26.08.0-SNAPSHOT-cuda12.jar
cudf-26.08.0-SNAPSHOT-sources.jar
cudf-26.08.0-SNAPSHOT-javadoc.jar
cudf-26.08.0-SNAPSHOT.pom
```

Expand All @@ -68,14 +71,17 @@ inside the container.
```

This walks every subdirectory of `--jars-dir` (each subdir name IS the
classifier), gathers the per-classifier JAR and shared POM, derives the
artifact version from the JAR filenames (requiring a single unique version
across subdirs), and lays them out as:
classifier), gathers the per-classifier JAR, one shared sources jar, one
shared javadoc jar, and the shared POM, derives the artifact version from
the JAR filenames (requiring a single unique version across subdirs), and
lays them out as:

```
/tmp/maven-repo/ai/rapids/cudf/26.08.0-SNAPSHOT/
cudf-26.08.0-SNAPSHOT-cuda12.jar
cudf-26.08.0-SNAPSHOT-cuda13.jar
cudf-26.08.0-SNAPSHOT-sources.jar
cudf-26.08.0-SNAPSHOT-javadoc.jar
cudf-26.08.0-SNAPSHOT.pom
```

Expand Down
47 changes: 42 additions & 5 deletions java/ci/assemble_maven_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
# Maven-repository-layout directory.
#
# Input: --jars-dir contains one subdirectory per classifier, each holding
# exactly one cudf-<version>-<classifier>.jar and a cudf-<version>.pom. Subdir
# names ARE the classifier names, and the artifact version is derived from
# the JAR filenames (all subdirs must agree).
# - exactly one cudf-<version>-<classifier>.jar
# - one cudf-<version>-sources.jar
# - one cudf-<version>-javadoc.jar
# - one cudf-<version>.pom
# Subdir names ARE the classifier names, and the artifact version is derived
# from the JAR filenames (all subdirs must agree).
#
# Output layout:
# <output-dir>/ai/rapids/cudf/<version>/cudf-<version>-<classifier>.jar
# <output-dir>/ai/rapids/cudf/<version>/cudf-<version>-sources.jar

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intended Maven repository must contain an unclassified primary artifact like cudf-26.08.0.jar for the release deploying.

Please remember to generate the unclassified primary artifact

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Since the unclassified primary artifact is semantically the same as one of the generated artifacts (i.e. cudf-26.08.0-cuda12.jar), the plan is to create this artifact in the publication workflow.

# <output-dir>/ai/rapids/cudf/<version>/cudf-<version>-javadoc.jar
# <output-dir>/ai/rapids/cudf/<version>/cudf-<version>.pom

set -e
Expand All @@ -36,8 +41,12 @@ Gathers per-classifier cuDF Java JARs into a single Maven-repository-layout tree

REQUIRED:
-j, --jars-dir Parent directory containing one subdirectory per
classifier (each holding cudf-<version>-<classifier>.jar
and cudf-<version>.pom). Subdir name is the classifier.
classifier. Each subdir must hold:
cudf-<version>-<classifier>.jar
cudf-<version>-sources.jar
cudf-<version>-javadoc.jar
cudf-<version>.pom
Subdir name is the classifier.
-o, --output-dir Directory to receive the combined Maven-repository layout.

OPTIONS:
Expand All @@ -48,6 +57,8 @@ EXAMPLE:
# given /tmp/jars/{cuda12,cuda13}/ inputs, produces:
# /tmp/maven-repo/ai/rapids/cudf/<version>/cudf-<version>-cuda12.jar
# /tmp/maven-repo/ai/rapids/cudf/<version>/cudf-<version>-cuda13.jar
# /tmp/maven-repo/ai/rapids/cudf/<version>/cudf-<version>-sources.jar
# /tmp/maven-repo/ai/rapids/cudf/<version>/cudf-<version>-javadoc.jar
# /tmp/maven-repo/ai/rapids/cudf/<version>/cudf-<version>.pom

EOF
Expand Down Expand Up @@ -155,6 +166,32 @@ if [[ -z "${FIRST_VERSION}" ]]; then
exit 1
fi

# Sources and javadoc jars are classifier-independent (pure Java, no arch or
# cuda variation). Every classifier subdir produces byte-equivalent copies;
# pick the lexicographically first subdir's copy as canonical. Fail fast if
# any subdir is missing either file - that indicates -Prelease or
# -Pjavadoc-jdk17 did not activate for that classifier's build.
DEST_DIR="${OUTPUT_DIR}/${GROUP_PATH}/${ARTIFACT_ID}/${FIRST_VERSION}"
FIRST_CLASSIFIER_SUBDIR=""
for subdir in "${JARS_DIR}"/*/; do
if [[ -z ${FIRST_CLASSIFIER_SUBDIR} ]]; then
FIRST_CLASSIFIER_SUBDIR=${subdir}
fi
for required in "cudf-${FIRST_VERSION}-sources.jar" \
"cudf-${FIRST_VERSION}-javadoc.jar"; do
if [[ ! -f ${subdir}${required} ]]; then
echo "Error: ${required} missing from ${subdir} (expected in every classifier subdir)" >&2
exit 1
fi
done
done

for shared in "cudf-${FIRST_VERSION}-sources.jar" \
"cudf-${FIRST_VERSION}-javadoc.jar"; do
cp -f "${FIRST_CLASSIFIER_SUBDIR}${shared}" "${DEST_DIR}/"
echo " + ${shared}"
done

# POM is identical across subdirs; copy the first one found.
POM_SRC=""
for subdir in "${JARS_DIR}"/*/; do
Expand Down
68 changes: 56 additions & 12 deletions java/ci/build_cudf_java_jar_in_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
#
# This script runs inside the rapidsai/ci-conda container launched by
# java/ci/build_cudf_java_jar.sh. It generates the build_java conda toolchain
# environment, compiles the JNI layer against a prebuilt static libcudf
# (mounted at /libcudf), and packages the cuDF Java JAR. The resulting
# classifier JAR and its POM are copied to /output. /output and
# environment, installs a JDK 17 side-prefix for the javadoc-jdk17 profile,
# compiles the JNI layer against a prebuilt static libcudf (mounted at
# /libcudf), and packages the cuDF Java JAR. The resulting classifier JAR,
# sources JAR, javadoc JAR, and POM are copied to /output. /output and
# /repo/java/target are chowned to HOST_UID:HOST_GID on exit so the host user
# owns the outputs.
#
Expand Down Expand Up @@ -63,6 +64,15 @@ conda activate build_java

rapids-print-env

# The `javadoc-jdk17` profile in java/pom.xml points
# <javadocExecutable> at ${env.JDK17_HOME}/bin/javadoc. The build_java env
# above provides only JDK 8 (mvn's own JVM), so install JDK 17 into a
# dedicated prefix that JDK17_HOME can point to. The primary mvn JVM stays
# on JDK 8; only the javadoc binary is invoked from this prefix.
rapids-logger "Installing JDK 17 into /opt/jdk17 for javadoc-jdk17 profile"
rapids-mamba-retry create --yes --prefix /opt/jdk17 openjdk=17.*
export JDK17_HOME=/opt/jdk17

if [[ -z ${CUDACXX} ]]; then
export CUDACXX="${CONDA_PREFIX}/bin/nvcc"
fi
Expand All @@ -72,12 +82,22 @@ fi

BUILD_ARG=(
-B
# Prefix every log line with HH:mm:ss.SSS so the elapsed time of individual
# plugin executions is recorded.
"-Dorg.slf4j.simpleLogger.showDateTime=true"
"-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS"
"-Dmaven.repo.local=/tmp/.m2"
"-Dparallel.level=${PARALLEL_LEVEL}"
"-DskipTests=true"
"-DCUDF_USE_PER_THREAD_DEFAULT_STREAM=ON"
"-DCUDF_JNI_LIBCUDF_STATIC=ON"
"-DUSE_GDS=OFF"
# -Prelease produces the sources.jar file via maven-source-plugin;
# -Pjavadoc-jdk17 produces the javadoc.jar file via maven-javadoc-plugin
# running against ${env.JDK17_HOME}/bin/javadoc. Both are required by
# Maven Central for every published release.
"-Prelease"
"-Pjavadoc-jdk17"
)

if [[ -n ${CMAKE_CUDA_ARCHITECTURES} ]]; then
Expand All @@ -95,27 +115,51 @@ rapids-logger "Packaging cuDF Java JAR version ${CUDF_VERSION} (libcudf: ${CUDF_
# the scratch dir before each container launch to guarantee target/ starts empty.
CUDF_INSTALL_DIR="${CUDF_INSTALL_DIR}" mvn package "${BUILD_ARG[@]}"

mkdir -p "${OUTPUT_DIR}"

# Order matters: *-test-sources.jar must precede *-sources.jar because
# bash's case picks the first matching pattern, and *-sources.jar would
# also match *-test-sources.jar.
MAIN_JAR=""
for candidate in target/cudf-"${CUDF_VERSION}"-*.jar; do
case "${candidate}" in
*-tests.jar|*-sources.jar|*-javadoc.jar)
*-tests.jar|*-test-sources.jar)
continue
;;
*-sources.jar|*-javadoc.jar)
cp -f "${candidate}" "${OUTPUT_DIR}/"
;;
*)
if [[ -f ${candidate} ]]; then
if [[ -n ${MAIN_JAR} ]]; then
echo "Error: multiple main classifier JARs matched under target/" >&2
ls -l target/ >&2 || true
exit 1
fi
MAIN_JAR=${candidate}
fi
;;
esac
if [[ -f ${candidate} ]]; then
MAIN_JAR=${candidate}
break
fi
done

if [[ -z ${MAIN_JAR} ]]; then
echo "Error: no cuDF classifier JAR produced under target/"
ls -l target/ || true
echo "Error: no cuDF classifier JAR produced under target/" >&2
ls -l target/ >&2 || true
exit 1
fi

mkdir -p "${OUTPUT_DIR}"
# Assert the release-profile artifacts landed. A missing file here means
# -Prelease or -Pjavadoc-jdk17 did not activate, or JDK17_HOME did not
# resolve to a usable javadoc binary.
for required in "${OUTPUT_DIR}/cudf-${CUDF_VERSION}-sources.jar" \
"${OUTPUT_DIR}/cudf-${CUDF_VERSION}-javadoc.jar"; do
if [[ ! -f ${required} ]]; then
echo "Error: expected ${required} not found (mvn -Prelease -Pjavadoc-jdk17 did not produce it)" >&2
exit 1
fi
done

cp -f "${MAIN_JAR}" "${OUTPUT_DIR}/"
cp -f pom.xml "${OUTPUT_DIR}/cudf-${CUDF_VERSION}.pom"

rapids-logger "Emitted $(basename "${MAIN_JAR}") + cudf-${CUDF_VERSION}.pom to ${OUTPUT_DIR}"
rapids-logger "Emitted $(basename "${MAIN_JAR}"), cudf-${CUDF_VERSION}-sources.jar, cudf-${CUDF_VERSION}-javadoc.jar, and cudf-${CUDF_VERSION}.pom to ${OUTPUT_DIR}"
Loading