get rid of ./cargo when building downstream projects (#29372)

This commit is contained in:
kirill lykov 2022-12-23 10:02:23 +01:00 committed by GitHub
parent 65391a70cb
commit 8d11b28bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 12 deletions

View File

@ -11,7 +11,6 @@ source scripts/read-cargo-variable.sh
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
solana_dir=$PWD
cargo="$solana_dir"/cargo
cargo_build_sbf="$solana_dir"/cargo-build-sbf
cargo_test_sbf="$solana_dir"/cargo-test-sbf
@ -44,13 +43,15 @@ anchor() {
set -x
rm -rf anchor
git clone https://github.com/coral-xyz/anchor.git
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml anchor/
cd anchor
update_solana_dependencies . "$solana_ver"
patch_crates_io_solana Cargo.toml "$solana_dir"
$cargo build
$cargo test
cargo build
cargo test
anchor_dir=$PWD
anchor_ver=$(readCargoVariable version "$anchor_dir"/lang/Cargo.toml)
@ -63,6 +64,8 @@ mango() {
set -x
rm -rf mango-v3
git clone https://github.com/blockworks-foundation/mango-v3
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml mango-v3/
cd mango-v3
update_solana_dependencies . "$solana_ver"
@ -70,8 +73,8 @@ mango() {
patch_crates_io_solana Cargo.toml "$solana_dir"
patch_crates_io_anchor Cargo.toml "$anchor_dir"
$cargo build
$cargo test
cargo build
cargo test
$cargo_build_sbf
$cargo_test_sbf
)
@ -82,6 +85,8 @@ metaplex() {
set -x
rm -rf metaplex-program-library
git clone https://github.com/metaplex-foundation/metaplex-program-library
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml metaplex-program-library/
cd metaplex-program-library
update_solana_dependencies . "$solana_ver"
@ -89,8 +94,8 @@ metaplex() {
patch_crates_io_solana Cargo.toml "$solana_dir"
patch_crates_io_anchor Cargo.toml "$anchor_dir"
$cargo build
$cargo test
cargo build
cargo test
$cargo_build_sbf
$cargo_test_sbf
)

View File

@ -12,7 +12,6 @@ source scripts/read-cargo-variable.sh
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
solana_dir=$PWD
cargo="$solana_dir"/cargo
cargo_build_sbf="$solana_dir"/cargo-build-sbf
cargo_test_sbf="$solana_dir"/cargo-test-sbf
@ -24,6 +23,8 @@ example_helloworld() {
set -x
rm -rf example-helloworld
git clone https://github.com/solana-labs/example-helloworld.git
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml example-helloworld/
cd example-helloworld
update_solana_dependencies src/program-rust "$solana_ver"
@ -57,6 +58,8 @@ spl() {
set -x
rm -rf spl
git clone https://github.com/solana-labs/solana-program-library.git spl
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml spl/
cd spl
project_used_solana_version=$(sed -nE 's/solana-sdk = \"[>=<~]*(.*)\"/\1/p' <"token/program/Cargo.toml")
@ -75,8 +78,8 @@ spl() {
# TODO better: `build.rs` for spl-token-cli doesn't seem to properly build
# the required programs to run the tests, so instead we run the tests
# after we know programs have been built
$cargo build
$cargo test
cargo build
cargo test
)
}
@ -85,6 +88,8 @@ openbook_dex() {
set -x
rm -rf openbook-dex
git clone https://github.com/openbook-dex/program.git openbook-dex
# copy toolchain file to use solana's rust version
cp "$solana_dir"/rust-toolchain.toml openbook-dex/
cd openbook-dex
update_solana_dependencies . "$solana_ver"
@ -101,12 +106,12 @@ exclude = [
"permissioned",
]
EOF
$cargo build
cargo build
$cargo_build_sbf \
--manifest-path dex/Cargo.toml --no-default-features --features program
$cargo test \
cargo test \
--manifest-path dex/Cargo.toml --no-default-features --features program
)
}