Skip to content

Commit

Permalink
[bazel] Replace bazel sync with bazel fetch
Browse files Browse the repository at this point in the history
For whatever reason they've changed `sync` to `fetch` with Bzlmod and
`sync` fully crashes Bazel when hybrid mode is disabled rather than
giving an error.

Signed-off-by: James Wainwright <james.wainwright@lowrisc.org>
  • Loading branch information
jwnrt committed Jan 13, 2025
1 parent 3496806 commit 39be0d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions rules/bitstreams.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _bitstreams_repo_impl(rctx):
if result.return_code != 0:
fail("Bitstream cache not initialized properly.")

# The bitstream repo should be evaluated with `bazel sync --configure` after
# The bitstream repo should be evaluated with `bazel fetch --configure` after
# every Git checkout. Once the cache is initialized, a typical invocation will
# find the latest cached artifacts and map them to Bazel targets.
#
Expand Down Expand Up @@ -123,7 +123,7 @@ bitstreams_repo = repository_rule(
# This rule depends on the Git repository, but there's no ergonomic way to
# encode the dependency in Bazel. Instead, indicate that the rule depends on
# something outside of Bazel's dependency graph and rely on the user calling
# `bazel sync --configure` when checking out new revisions. For historical
# `bazel fetch --configure` when checking out new revisions. For historical
# context, see <https://github.com/lowRISC/opentitan/issues/16832>.
configure = True,
)
Expand Down
5 changes: 2 additions & 3 deletions util/prep-bazel-airgapped-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ if [[ ${AIRGAPPED_DIR_CONTENTS} == "ALL" || \
--output bazel
chmod +x bazel

# Make Bazel sync its own dependencies to the repository cache:
# Make Bazel fetch its own dependencies to the repository cache:
# https://bazel.build/run/build#repository_cache_with_bazel_7_or_later
mkdir -p "${BAZEL_AIRGAPPED_DIR}/empty_workspace"
pushd "${BAZEL_AIRGAPPED_DIR}/empty_workspace"
touch MODULE.bazel
touch WORKSPACE
cp "${REPO_TOP}/.bazelversion" .
bazel sync --repository_cache="${BAZEL_AIRGAPPED_DIR}/${BAZEL_CACHEDIR}"
bazel fetch --repository_cache="${BAZEL_AIRGAPPED_DIR}/${BAZEL_CACHEDIR}"
popd
rm -rf "${BAZEL_AIRGAPPED_DIR}/empty_workspace"
fi
Expand Down

0 comments on commit 39be0d4

Please sign in to comment.