1#!/bin/bash
2set -euo pipefail
3
4# This is a convenience script for maintainers changing a cranelift
5# dependencies versions. To use, bump the version number below, run the
6# script.
7
8topdir=$(dirname "$0")/..
9cd "$topdir"
10
11# All the cranelift-* crates have the same version number
12version="0.64.0"
13
14# Update all of the Cargo.toml files.
15echo "Updating crate versions to $version"
16for toml in cranelift/Cargo.toml cranelift/*/Cargo.toml cranelift/*/*/Cargo.toml; do
17    # Update the version number of this crate to $version.
18    sed -i.bk -e "/^version = /s/\"[^\"]*\"/\"$version\"/" \
19        "$toml"
20done
21
22# Update the required version numbers of path dependencies.
23find -name Cargo.toml \
24    -not -path ./crates/wasi-common/WASI/tools/witx/Cargo.toml \
25    -exec sed -i.bk \
26        -e "/^cranelift/s/version = \"[^\"]*\"/version = \"$version\"/" \
27        {} \;
28
29# Update the Cargo.lock file for the new versions.
30cargo update
31