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
23 changes: 20 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -e -u -o pipefail
Expand All @@ -15,21 +15,38 @@ function hasArg {
(( NUMARGS != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
}


if hasArg --build-cuvs-java; then
CUVS_WORKDIR="cuvs-workdir"
CUVS_GIT_REPO="https://github.com/rapidsai/cuvs.git"
BRANCH=$(cat "RAPIDS_BRANCH")
if [[ -d "$CUVS_WORKDIR" && -n "$(ls -A "$CUVS_WORKDIR")" ]]; then
echo "Directory '$CUVS_WORKDIR' exists and is not empty."
pushd $CUVS_WORKDIR
git pull
else
BRANCH=$(cat "RAPIDS_BRANCH")
echo "Directory '$CUVS_WORKDIR' does not exist or is empty. Cloning the cuvs's '$BRANCH' branch."
# Correct branch selection is crucial to avoid version mismatch issues when testing.
git clone --branch "$BRANCH" $CUVS_GIT_REPO $CUVS_WORKDIR
pushd $CUVS_WORKDIR
fi
./build.sh java

# libcuvs comes from the conda packages, so normally only the java bindings have
# to be built. For a pull request, the conda packages do not contain the PR's
# changes, so CI downloads the pre-built libcuvs artifact from the PR's own CI run.
CUVS_BUILD_TARGETS=("java")
if hasArg --use-pr-libcuvs && [[ "$BRANCH" == pull-request/* ]]; then
PR_NUM="${BRANCH#pull-request/}"
echo "Downloading libcuvs conda artifact from cuvs PR #${PR_NUM}..."
LIBCUVS_CONDA_DIR=$(rapids-get-pr-artifact NVIDIA/cuvs "$PR_NUM" cpp conda)
LIBCUVS_DIR=$(rapids-extract-conda-files "$LIBCUVS_CONDA_DIR")
# The downloaded library has to take precedence over the one provided by the
# conda packages, both here and while running the java tests.
LD_LIBRARY_PATH="$LIBCUVS_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH is: $LD_LIBRARY_PATH"
fi
./build.sh "${CUVS_BUILD_TARGETS[@]}"
popd
fi

Expand Down
7 changes: 6 additions & 1 deletion ci/build_java.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail
Expand All @@ -16,6 +16,11 @@ fi
# Always build cuvs-java when running the pipeline
EXTRA_BUILD_ARGS+=("--build-cuvs-java")

# When RAPIDS_BRANCH points at a cuvs pull request, the libcuvs from the conda
# packages does not contain the PR's changes, so download the pre-built artifact
# from the PR's CI run instead. Only done in CI, local builds use the conda packages.
EXTRA_BUILD_ARGS+=("--use-pr-libcuvs")

# shellcheck disable=SC1091
. /opt/conda/etc/profile.d/conda.sh

Expand Down
Loading