Skip to content

Commit

Permalink
Fix bootstrapping since bazelbuild#694 (bazelbuild#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion authored and yagehu committed Apr 23, 2021
1 parent 9bc3c8e commit 3090e50
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,19 @@ BOOTSTRAP_DIR="${SCRIPT_DIR}/crate_universe/private/bootstrap"

# Go to root of rules_rust
pushd "${SCRIPT_DIR}" &> /dev/null
has_changes="$(git log origin/main.. -- crate_universe)"
has_changes="$(git diff --name-only origin/main -- crate_universe bootstrap.sh)"
popd &> /dev/null

# Only bootstrap the binary if there are changes
if [[ -n "${has_changes}" ]]; then
if [[ -n "${has_changes}" ]] || git ls-files --others --exclude-standard | grep 'crate_universe'; then
pushd "${BOOTSTRAP_DIR}" &> /dev/null
bazel run //:build && bazel run //:install && bazel clean
popd &> /dev/null

# Generate a bazelrc file for ensuring we always use the resolver binary for the current host
cat << EOF > "${SCRIPT_DIR}/crate_universe.bazelrc"
common --announce_rc
common --override_repository="rules_rust_crate_universe__aarch64-apple-darwin=${BOOTSTRAP_DIR}"
common --override_repository="rules_rust_crate_universe__aarch64-unknown-linux-gnu=${BOOTSTRAP_DIR}"
common --override_repository="rules_rust_crate_universe__x86_64-apple-darwin=${BOOTSTRAP_DIR}"
common --override_repository="rules_rust_crate_universe__x86_64-pc-windows-gnu=${BOOTSTRAP_DIR}"
common --override_repository="rules_rust_crate_universe__x86_64-unknown-linux-gnu=${BOOTSTRAP_DIR}"
common --repo_env="RULES_RUST_CRATE_UNIVERSE_RESOLVER_URL_OVERRIDE=file://${BOOTSTRAP_DIR}/file/resolver"
EOF

cp ${SCRIPT_DIR}/crate_universe.bazelrc ${SCRIPT_DIR}/examples/crate_universe/crate_universe.bazelrc
Expand Down

0 comments on commit 3090e50

Please sign in to comment.