Lines Matching +full:read +full:- +full:pkg +full:- +full:up
5 # Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
6 # <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
7 # license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
11 # This script is a thin wrapper around Cargo that provides human-friendly
15 # cargo.sh --version <toolchain-name> # looks up the version for the named toolchain
16 # cargo.sh +<toolchain-name> [...] # runs cargo commands with the named toolchain
19 # The meta-toolchain "all" instructs this script to run the provided command
25 # TRYBUILD=overwrite ./cargo.sh +all test --workspace
27 set -eo pipefail
29 function print-usage-and-exit {
31 echo " $0 --version <toolchain-name>" >&2
32 echo " $0 +<toolchain-name> [...]" >&2
37 [[ $# -gt 0 ]] || print-usage-and-exit
39 function pkg-meta {
41 # sometimes causes the `cargo-metadata` crate to be rebuilt from source using
47 …CARGO_TARGET_DIR=target/cargo-sh cargo metadata --format-version 1 | jq -r ".packages[] | select(.…
50 function lookup-version {
54 pkg-meta rust_version
57 pkg-meta 'metadata.ci."pinned-stable"'
60 pkg-meta 'metadata.ci."pinned-nightly"'
69 function get-rustflags {
70 [ "$1" == nightly ] && echo "--cfg __INTERNAL_USE_ONLY_NIGHLTY_FEATURES_IN_TESTS"
77 read -p "$PROMPT " yn
87 # cargo.sh --version <toolchain-name>
88 --version)
89 [[ $# -eq 2 ]] || print-usage-and-exit
90 lookup-version "$2"
101 # cargo.sh +<toolchain-name> [...]
103 TOOLCHAIN="$(lookup-version ${1:1})"
106 rustup "+$TOOLCHAIN" component list | grep '^rust-src (installed)$' >/dev/null || {
107 echo "[cargo.sh] missing either toolchain '$TOOLCHAIN' or component 'rust-src'" >&2
110 [ -z ${GITHUB_RUN_ID+x} ] || exit 1
111 …prompt "[cargo.sh] would you like to install toolchain '$TOOLCHAIN' and component 'rust-src' via '…
112 "rustup toolchain install $TOOLCHAIN -c rust-src"
115 RUSTFLAGS="$(get-rustflags ${1:1}) $RUSTFLAGS" cargo "+$TOOLCHAIN" ${@:2}
118 print-usage-and-exit