blob: 9b887837ece676365dcacd41face0475fc3dae5a [file] [log] [blame]
#!/bin/bash
# Copyright 2023 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#### CATEGORY=Source tree
### updates external Rust dependencies with latest from crates.io
## usage: fx update-rust-3p-outdated
## Updates third_party/rust_crates/Cargo.toml based on the latest versions from
## crates.io and configuration in //third_party/rust_crates/outdated.toml.
##
## See https://fuchsia.dev/fuchsia-src/development/languages/rust/third_party.md
## for more details.
##
## Flags:
##
## --no-build Don't build update_crates or cargo-gnaw, use cached versions.
## --no-vendor Don't run `fx update-rustc-third-party` after updating crate versions.
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
source "$SCRIPT_DIR"/../lib/vars.sh || exit $?
fx-config-read
readonly UPDATE_CRATES_BIN="${FUCHSIA_BUILD_DIR}/host-tools/update_crates"
# The env-variables:
# * `$PREBUILT_CMAKE_DIR`,
# * `$PREBUILT_RUST_DIR`,
# * `$PREBUILT_RUST_CARGO_OUTDATED_DIR`,
#
# are made available by `fx-config-read`, but are not accessible
# in the Python's runtime `os.environ`. To use, we pass as parameter.
"$FUCHSIA_DIR"/scripts/rust/update-rust-3p-outdated.py "$@" \
"--fuchsia-dir" "$FUCHSIA_DIR" \
"--update-crates-bin" "$UPDATE_CRATES_BIN" \
"--prebuilt-cmake-dir" "$PREBUILT_CMAKE_DIR" \
"--prebuilt-rust-dir" "$PREBUILT_RUST_DIR" \
"--prebuilt-rust-cargo-outdated-dir" "$PREBUILT_RUST_CARGO_OUTDATED_DIR"