Fix up the version references to all other internal crates
This commit is contained in:
		@@ -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"
 | 
			
		||||
 
 | 
			
		||||
@@ -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]"
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,18 @@ if [[ -z "$CRATES_IO_TOKEN" ]]; then
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
ci/docker-run.sh rust \
 | 
			
		||||
  bash -exc "cargo package; cargo publish --token $CRATES_IO_TOKEN"
 | 
			
		||||
  (
 | 
			
		||||
    set -x
 | 
			
		||||
    ci/docker-run.sh rust bash -exc "cd $(dirname "$Cargo_toml"); cargo package; $maybePublish"
 | 
			
		||||
  )
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 
 | 
			
		||||
@@ -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" }
 | 
			
		||||
 
 | 
			
		||||
@@ -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))
 | 
			
		||||
@@ -57,22 +69,24 @@ 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
 | 
			
		||||
  # Fix up the version references to other internal crates
 | 
			
		||||
  for crate in "${crates[@]}"; do
 | 
			
		||||
    (
 | 
			
		||||
      set -x
 | 
			
		||||
      sed -i "$Cargo_toml" -e "
 | 
			
		||||
      s/^solana-sdk.*\(\"[^\"]*common\"\).*\$/solana-sdk = \{ path = \1, version = \"$newVersion\" \}/
 | 
			
		||||
        s/^$crate = .*path = \"\([^\"]*\)\".*\$/$crate = \{ path = \"\1\", version = \"$newVersion\" \}/
 | 
			
		||||
      "
 | 
			
		||||
    )
 | 
			
		||||
  done
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
echo "$currentVersion -> $newVersion"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user