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 = "0.1"
 | 
				
			||||||
tokio-codec = "0.1"
 | 
					tokio-codec = "0.1"
 | 
				
			||||||
untrusted = "0.6.2"
 | 
					untrusted = "0.6.2"
 | 
				
			||||||
solana-noop = { path = "programs/native/noop" }
 | 
					solana-noop = { path = "programs/native/noop", version = "0.10.0" }
 | 
				
			||||||
solana-bpfloader = { path = "programs/native/bpf_loader" }
 | 
					solana-bpfloader = { path = "programs/native/bpf_loader", version = "0.10.0" }
 | 
				
			||||||
solana-lualoader = { path = "programs/native/lua_loader" }
 | 
					solana-lualoader = { path = "programs/native/lua_loader", version = "0.10.0" }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[bench]]
 | 
					[[bench]]
 | 
				
			||||||
name = "bank"
 | 
					name = "bank"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,3 +5,6 @@ steps:
 | 
				
			|||||||
  - command: "ci/docker-solana/build.sh"
 | 
					  - command: "ci/docker-solana/build.sh"
 | 
				
			||||||
    timeout_in_minutes: 20
 | 
					    timeout_in_minutes: 20
 | 
				
			||||||
    name: "docker-solana"
 | 
					    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
 | 
					    timeout_in_minutes: 20
 | 
				
			||||||
    name: "snap [public]"
 | 
					    name: "snap [public]"
 | 
				
			||||||
  - wait
 | 
					  - wait
 | 
				
			||||||
  - command: "ci/publish-crate.sh"
 | 
					 | 
				
			||||||
    timeout_in_minutes: 20
 | 
					 | 
				
			||||||
    name: "publish crate [public]"
 | 
					 | 
				
			||||||
  - trigger: "solana-snap"
 | 
					  - trigger: "solana-snap"
 | 
				
			||||||
    branches: "!pull/*"
 | 
					    branches: "!pull/*"
 | 
				
			||||||
    async: true
 | 
					    async: true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,18 @@ if [[ -z "$CRATES_IO_TOKEN" ]]; then
 | 
				
			|||||||
  exit 1
 | 
					  exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TODO: Ensure the published version matches the contents of BUILDKITE_TAG
 | 
					maybePublish="echo Publish skipped"
 | 
				
			||||||
ci/docker-run.sh rust \
 | 
					if [[ -n $CI ]]; then
 | 
				
			||||||
  bash -exc "cargo package; cargo publish --token $CRATES_IO_TOKEN"
 | 
					  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
 | 
					exit 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,5 +7,5 @@ repository = "https://github.com/solana-labs/solana"
 | 
				
			|||||||
license = "Apache-2.0"
 | 
					license = "Apache-2.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
rbpf = { git = "https://github.com/qmonnet/rbpf", rev="bc41ec47d9b51751585f6ddcde1d1eb1afe2be69" }
 | 
					rbpf = "0.1.0"
 | 
				
			||||||
solana = { path = "../../.." }
 | 
					solana-sdk = { path = "../../../common", version = "0.10.0" }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,28 +14,40 @@ here="$(dirname "$0")"
 | 
				
			|||||||
cd "$here"/..
 | 
					cd "$here"/..
 | 
				
			||||||
source ci/semver_bash/semver.sh
 | 
					source ci/semver_bash/semver.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
readCargoVersion() {
 | 
					readCargoVariable() {
 | 
				
			||||||
  declare Cargo_toml="$1"
 | 
					  declare variable="$1"
 | 
				
			||||||
 | 
					  declare Cargo_toml="$2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while read -r version equals semver _; do
 | 
					  while read -r name equals value _; do
 | 
				
			||||||
    if [[ $version = version && $equals = = ]]; then
 | 
					    if [[ $name = "$variable" && $equals = = ]]; then
 | 
				
			||||||
      echo "${semver//\"/}"
 | 
					      echo "${value//\"/}"
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  done < <(cat "$Cargo_toml")
 | 
					  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
 | 
					MAJOR=0
 | 
				
			||||||
MINOR=0
 | 
					MINOR=0
 | 
				
			||||||
PATCH=0
 | 
					PATCH=0
 | 
				
			||||||
SPECIAL=""
 | 
					SPECIAL=""
 | 
				
			||||||
semverParseInto "$(readCargoVersion ./Cargo.toml)" MAJOR MINOR PATCH SPECIAL
 | 
					semverParseInto "$(readCargoVariable version ./Cargo.toml)" MAJOR MINOR PATCH SPECIAL
 | 
				
			||||||
[[ -n $MAJOR ]] || usage
 | 
					[[ -n $MAJOR ]] || usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
currentVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
 | 
					currentVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
 | 
				
			||||||
SPECIAL=""
 | 
					SPECIAL=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Figure out what to increment
 | 
				
			||||||
case ${1:-minor} in
 | 
					case ${1:-minor} in
 | 
				
			||||||
patch)
 | 
					patch)
 | 
				
			||||||
  PATCH=$((PATCH + 1))
 | 
					  PATCH=$((PATCH + 1))
 | 
				
			||||||
@@ -57,21 +69,23 @@ esac
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
newVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
 | 
					newVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# shellcheck disable=2044 # Disable 'For loops over find output are fragile...'
 | 
					# Update all the Cargo.toml files
 | 
				
			||||||
for Cargo_toml in $(find . -name Cargo.toml); do
 | 
					for Cargo_toml in $Cargo_tomls; do
 | 
				
			||||||
  # Bump crate version
 | 
					  # Set new crate version
 | 
				
			||||||
  (
 | 
					  (
 | 
				
			||||||
    set -x
 | 
					    set -x
 | 
				
			||||||
    sed -i "$Cargo_toml" -e "s/^version = \"[^\"]*\"$/version = \"$newVersion\"/"
 | 
					    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 "
 | 
					      set -x
 | 
				
			||||||
      s/^solana-sdk.*\(\"[^\"]*common\"\).*\$/solana-sdk = \{ path = \1, version = \"$newVersion\" \}/
 | 
					      sed -i "$Cargo_toml" -e "
 | 
				
			||||||
    "
 | 
					        s/^$crate = .*path = \"\([^\"]*\)\".*\$/$crate = \{ path = \"\1\", version = \"$newVersion\" \}/
 | 
				
			||||||
  )
 | 
					      "
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					  done
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "$currentVersion -> $newVersion"
 | 
					echo "$currentVersion -> $newVersion"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user