|
2 | 2 |
|
3 | 3 | set -eu
|
4 | 4 |
|
5 |
| -echo "Running msrv check for opentelemetry package" |
6 |
| -cargo check --manifest-path=opentelemetry/Cargo.toml --all-features |
7 |
| - |
8 |
| -echo "Running msrv check for opentelemetry-sdk package" |
9 |
| -cargo check --manifest-path=opentelemetry-sdk/Cargo.toml --all-features |
10 |
| - |
11 |
| -echo "Running msrv check for opentelemetry-stdout package" |
12 |
| -cargo check --manifest-path=opentelemetry-stdout/Cargo.toml --all-features |
13 |
| - |
14 |
| -# TODO: Ignoring as this is failing with the following error: |
15 |
| -# error: package `prost-derive v0.12.6` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.65.0 |
16 |
| -#echo "Running msrv check for opentelemetry-otlp package" |
17 |
| -# cargo check --manifest-path=opentelemetry-otlp/Cargo.toml --all-features |
18 |
| - |
19 |
| -echo "Running msrv check for opentelemetry-http package" |
20 |
| -cargo check --manifest-path=opentelemetry-http/Cargo.toml --all-features |
21 |
| - |
22 |
| -echo "Running msrv check for opentelemetry-jaeger-propagator package" |
23 |
| -cargo check --manifest-path=opentelemetry-jaeger-propagator/Cargo.toml --all-features |
24 |
| - |
25 |
| -echo "Running msrv check for opentelemetry-zipkin package" |
26 |
| -cargo check --manifest-path=opentelemetry-zipkin/Cargo.toml --all-features |
27 |
| - |
28 |
| -echo "Running msrv check for opentelemetry-appender-log package" |
29 |
| -cargo check --manifest-path=opentelemetry-appender-log/Cargo.toml --all-features |
30 |
| - |
31 |
| -echo "Running msrv check for opentelemetry-appender-tracing package" |
32 |
| -cargo check --manifest-path=opentelemetry-appender-tracing/Cargo.toml --all-features |
33 |
| - |
| 5 | +# Check if a version is specified as parameter |
| 6 | +if [ $# -eq 0 ]; then |
| 7 | + echo "No Rust version specified. Usage: $0 <rust-version>" |
| 8 | + exit 1 |
| 9 | +fi |
| 10 | + |
| 11 | +RUST_VERSION=$1 |
| 12 | + |
| 13 | +# Determine the directory containing the script |
| 14 | +SCRIPT_DIR=$(dirname "$(readlink -f "$0")") |
| 15 | + |
| 16 | +# Path to the configuration file |
| 17 | +CONFIG_FILE="$SCRIPT_DIR/msrv_config.json" |
| 18 | + |
| 19 | +# Change to the root directory of the repository |
| 20 | +cd "$SCRIPT_DIR/.." |
| 21 | + |
| 22 | +echo "Current working directory: $(pwd)" |
| 23 | + |
| 24 | +# function to check if specified toolchain is installed |
| 25 | +check_rust_toolchain_installed() { |
| 26 | + local version=$1 |
| 27 | + if ! rustup toolchain list | grep -q "$version"; then |
| 28 | + echo "Rust toolchain $version is not installed. Please install it using 'rustup toolchain install $version'." |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +} |
| 32 | + |
| 33 | +# check if specified toolchain is installed |
| 34 | +check_rust_toolchain_installed "$RUST_VERSION" |
| 35 | + |
| 36 | +# Extract the exact installed rust version string |
| 37 | +installed_version=$(rustup toolchain list | grep "$RUST_VERSION" | awk '{print $1}') |
| 38 | + |
| 39 | +# Read the configuration file and get the packages for the specified version |
| 40 | +if [ -f "$CONFIG_FILE" ]; then |
| 41 | + packages=$(jq -r --arg version "$RUST_VERSION" '.[$version] | .[]' "$CONFIG_FILE" | tr '\n' ' ') |
| 42 | + if [ -z "$packages" ]; then |
| 43 | + echo "No packages found for Rust version $RUST_VERSION in the configuration file." |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +else |
| 47 | + echo "Configuration file $CONFIG_FILE not found." |
| 48 | + exit 1 |
| 49 | +fi |
| 50 | + |
| 51 | +# Check MSRV for the packages |
| 52 | +for package in $packages; do |
| 53 | + package=$(echo "$package" | tr -d '\r\n') # Remove any newline and carriage return characters |
| 54 | + echo "Command: rustup run \"$installed_version\" cargo check --manifest-path=\"$package\" --all-features" |
| 55 | + rustup run "$installed_version" cargo check --manifest-path=$package --all-features |
| 56 | +done |
0 commit comments