-
Notifications
You must be signed in to change notification settings - Fork 16
/
patch.crates-io.sh
executable file
·62 lines (54 loc) · 1.98 KB
/
patch.crates-io.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
#
# Patches workspace crates for developing against a local solana monorepo
#
solana_dir=$1
if [[ -z $solana_dir ]]; then
echo "Usage: $0 <path-to-solana-monorepo>"
exit 1
fi
workspace_crates=(
Cargo.toml
)
if [[ ! -r "$solana_dir"/scripts/read-cargo-variable.sh ]]; then
echo "$solana_dir is not a path to the solana monorepo"
exit 1
fi
set -e
solana_dir=$(cd "$solana_dir" && pwd)
cd "$(dirname "$0")"
# shellcheck source=/dev/null
source "$solana_dir"/scripts/read-cargo-variable.sh
solana_ver=$(readCargoVariable version "$solana_dir"/sdk/Cargo.toml)
echo "Patching in $solana_ver from $solana_dir"
echo
for crate in "${workspace_crates[@]}"; do
if grep -q '\[patch.crates-io\]' "$crate"; then
echo "$crate is already patched"
else
cat >> "$crate" <<PATCH
[patch.crates-io]
solana-account-decoder = {path = "$solana_dir/account-decoder" }
solana-banks-client = { path = "$solana_dir/banks-client"}
solana-banks-server = { path = "$solana_dir/banks-server"}
solana-bpf-loader-program = { path = "$solana_dir/programs/bpf_loader" }
solana-clap-utils = {path = "$solana_dir/clap-utils" }
solana-cli-config = {path = "$solana_dir/cli-config" }
solana-cli-output = {path = "$solana_dir/cli-output" }
solana-client = { path = "$solana_dir/client"}
solana-core = { path = "$solana_dir/core"}
solana-logger = {path = "$solana_dir/logger" }
solana-notifier = { path = "$solana_dir/notifier" }
solana-remote-wallet = {path = "$solana_dir/remote-wallet" }
solana-program = { path = "$solana_dir/sdk/program" }
solana-program-test = { path = "$solana_dir/program-test" }
solana-runtime = { path = "$solana_dir/runtime" }
solana-sdk = { path = "$solana_dir/sdk" }
solana-stake-program = { path = "$solana_dir/programs/stake" }
solana-transaction-status = { path = "$solana_dir/transaction-status" }
solana-vote-program = { path = "$solana_dir/programs/vote" }
solana-zk-token-sdk = { path = "$solana_dir/zk-token-sdk" }
PATCH
fi
done
./update-solana-dependencies.sh "$solana_ver"