-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Sync quil-rs version with quil-cli
- Loading branch information
Showing
1 changed file
with
14 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
#! /bin/bash | ||
# This script gets the current version of quil-rs from its manifest, and uses it to update the dependency specification | ||
# of quil-rs in quil-py's manifset. | ||
|
||
# | ||
# Get current version of quil-rs | ||
PACKAGE_VERSION=$(cargo metadata --format-version 1 --no-deps | grep -o '"name":"quil-rs","version":"[^"]*' | cut -d '"' -f 8) | ||
|
||
patch_cargo_toml() { | ||
# `awk -i inplace` would work on linux, but not on macos. This command is compatible with both. | ||
awk -v ver="$PACKAGE_VERSION" '/^quil-rs = /{$0="quil-rs = { path = \"../quil-rs\", version = \"" ver "\" }"}1' "$1" | ||
} | ||
|
||
# Write it to `quil-py`s Cargo.toml | ||
# `awk -i inplace` would work on linux, but not on macos. This command is compatible with both. | ||
awk -v ver="$PACKAGE_VERSION" '/^quil-rs = /{$0="quil-rs = { path = \"../quil-rs\", version = \"" ver "\" }"}1' quil-py/Cargo.toml > quil-py/Cargo.toml.tmp | ||
patch_cargo_toml quil-py/Cargo.toml > quil-py/Cargo.toml.tmp | ||
mv quil-py/Cargo.toml.tmp quil-py/Cargo.toml | ||
|
||
# Validate that the new version of Cargo.toml is valid | ||
cargo check --manifest-path=quil-py/Cargo.toml | ||
|
||
# Write it to `quil-cli`s Cargo.toml | ||
patch_cargo_toml quil-cli/Cargo.toml > quil-cli/Cargo.toml.tmp | ||
mv quil-cli/Cargo.toml.tmp quil-cli/Cargo.toml | ||
|
||
# Validate that the new version of Cargo.toml is valid | ||
cargo check --manifest-path=quil-py/Cargo.toml |