Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Fix up the version references to all other internal crates #1611

Merged
merged 1 commit into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ sys-info = "0.5.6"
tokio = "0.1"
tokio-codec = "0.1"
untrusted = "0.6.2"
solana-noop = { path = "programs/native/noop" }
solana-bpfloader = { path = "programs/native/bpf_loader" }
solana-lualoader = { path = "programs/native/lua_loader" }
solana-noop = { path = "programs/native/noop", version = "0.10.0" }
solana-bpfloader = { path = "programs/native/bpf_loader", version = "0.10.0" }
solana-lualoader = { path = "programs/native/lua_loader", version = "0.10.0" }

[[bench]]
name = "bank"
Expand Down
3 changes: 3 additions & 0 deletions ci/buildkite-snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ steps:
- command: "ci/docker-solana/build.sh"
timeout_in_minutes: 20
name: "docker-solana"
- command: "ci/publish-crate.sh"
timeout_in_minutes: 20
name: "publish crate [public]"
3 changes: 0 additions & 3 deletions ci/buildkite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ steps:
timeout_in_minutes: 20
name: "snap [public]"
- wait
- command: "ci/publish-crate.sh"
timeout_in_minutes: 20
name: "publish crate [public]"
- trigger: "solana-snap"
branches: "!pull/*"
async: true
Expand Down
16 changes: 13 additions & 3 deletions ci/publish-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ if [[ -z "$CRATES_IO_TOKEN" ]]; then
exit 1
fi

# TODO: Ensure the published version matches the contents of BUILDKITE_TAG
ci/docker-run.sh rust \
bash -exc "cargo package; cargo publish --token $CRATES_IO_TOKEN"
maybePublish="echo Publish skipped"
if [[ -n $CI ]]; then
maybePublish="cargo publish --token $CRATES_IO_TOKEN"
fi

# shellcheck disable=2044 # Disable 'For loops over find output are fragile...'
for Cargo_toml in {common,programs/native/{bpf_loader,lua_loader,noop}}/Cargo.toml; do
# TODO: Ensure the published version matches the contents of BUILDKITE_TAG
(
set -x
ci/docker-run.sh rust bash -exc "cd $(dirname "$Cargo_toml"); cargo package; $maybePublish"
)
done

exit 0
4 changes: 2 additions & 2 deletions programs/bpf/noop_rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"

[dependencies]
rbpf = { git = "https://github.com/qmonnet/rbpf", rev="bc41ec47d9b51751585f6ddcde1d1eb1afe2be69" }
solana = { path = "../../.." }
rbpf = "0.1.0"
solana-sdk = { path = "../../../common", version = "0.10.0" }
48 changes: 31 additions & 17 deletions scripts/increment-cargo-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,40 @@ here="$(dirname "$0")"
cd "$here"/..
source ci/semver_bash/semver.sh

readCargoVersion() {
declare Cargo_toml="$1"
readCargoVariable() {
declare variable="$1"
declare Cargo_toml="$2"

while read -r version equals semver _; do
if [[ $version = version && $equals = = ]]; then
echo "${semver//\"/}"
while read -r name equals value _; do
if [[ $name = "$variable" && $equals = = ]]; then
echo "${value//\"/}"
return
fi
done < <(cat "$Cargo_toml")
echo "Unable to locate version in $Cargo_toml" 1>&2
echo "Unable to locate $variable in $Cargo_toml" 1>&2
}

# shellcheck disable=2044 # Disable 'For loops over find output are fragile...'
Cargo_tomls="$(find . -name Cargo.toml)"

# Collect the name of all the internal crates
crates=()
for Cargo_toml in $Cargo_tomls; do
crates+=("$(readCargoVariable name "$Cargo_toml")")
done

# Read the current version
MAJOR=0
MINOR=0
PATCH=0
SPECIAL=""
semverParseInto "$(readCargoVersion ./Cargo.toml)" MAJOR MINOR PATCH SPECIAL
semverParseInto "$(readCargoVariable version ./Cargo.toml)" MAJOR MINOR PATCH SPECIAL
[[ -n $MAJOR ]] || usage

currentVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
SPECIAL=""

# Figure out what to increment
case ${1:-minor} in
patch)
PATCH=$((PATCH + 1))
Expand All @@ -57,21 +69,23 @@ esac

newVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"

# shellcheck disable=2044 # Disable 'For loops over find output are fragile...'
for Cargo_toml in $(find . -name Cargo.toml); do
# Bump crate version
# Update all the Cargo.toml files
for Cargo_toml in $Cargo_tomls; do
# Set new crate version
(
set -x
sed -i "$Cargo_toml" -e "s/^version = \"[^\"]*\"$/version = \"$newVersion\"/"
)

# Fix up the internal references to the solana_sdk crate
(
set -x
sed -i "$Cargo_toml" -e "
s/^solana-sdk.*\(\"[^\"]*common\"\).*\$/solana-sdk = \{ path = \1, version = \"$newVersion\" \}/
"
)
# Fix up the version references to other internal crates
for crate in "${crates[@]}"; do
(
set -x
sed -i "$Cargo_toml" -e "
s/^$crate = .*path = \"\([^\"]*\)\".*\$/$crate = \{ path = \"\1\", version = \"$newVersion\" \}/
"
)
done
done

echo "$currentVersion -> $newVersion"
Expand Down