get rid of ./cargo when building downstream projects (#29372)
This commit is contained in:
parent
65391a70cb
commit
8d11b28bc0
|
@ -11,7 +11,6 @@ source scripts/read-cargo-variable.sh
|
||||||
|
|
||||||
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
|
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
|
||||||
solana_dir=$PWD
|
solana_dir=$PWD
|
||||||
cargo="$solana_dir"/cargo
|
|
||||||
cargo_build_sbf="$solana_dir"/cargo-build-sbf
|
cargo_build_sbf="$solana_dir"/cargo-build-sbf
|
||||||
cargo_test_sbf="$solana_dir"/cargo-test-sbf
|
cargo_test_sbf="$solana_dir"/cargo-test-sbf
|
||||||
|
|
||||||
|
@ -44,13 +43,15 @@ anchor() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf anchor
|
rm -rf anchor
|
||||||
git clone https://github.com/coral-xyz/anchor.git
|
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
|
cd anchor
|
||||||
|
|
||||||
update_solana_dependencies . "$solana_ver"
|
update_solana_dependencies . "$solana_ver"
|
||||||
patch_crates_io_solana Cargo.toml "$solana_dir"
|
patch_crates_io_solana Cargo.toml "$solana_dir"
|
||||||
|
|
||||||
$cargo build
|
cargo build
|
||||||
$cargo test
|
cargo test
|
||||||
|
|
||||||
anchor_dir=$PWD
|
anchor_dir=$PWD
|
||||||
anchor_ver=$(readCargoVariable version "$anchor_dir"/lang/Cargo.toml)
|
anchor_ver=$(readCargoVariable version "$anchor_dir"/lang/Cargo.toml)
|
||||||
|
@ -63,6 +64,8 @@ mango() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf mango-v3
|
rm -rf mango-v3
|
||||||
git clone https://github.com/blockworks-foundation/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
|
cd mango-v3
|
||||||
|
|
||||||
update_solana_dependencies . "$solana_ver"
|
update_solana_dependencies . "$solana_ver"
|
||||||
|
@ -70,8 +73,8 @@ mango() {
|
||||||
patch_crates_io_solana Cargo.toml "$solana_dir"
|
patch_crates_io_solana Cargo.toml "$solana_dir"
|
||||||
patch_crates_io_anchor Cargo.toml "$anchor_dir"
|
patch_crates_io_anchor Cargo.toml "$anchor_dir"
|
||||||
|
|
||||||
$cargo build
|
cargo build
|
||||||
$cargo test
|
cargo test
|
||||||
$cargo_build_sbf
|
$cargo_build_sbf
|
||||||
$cargo_test_sbf
|
$cargo_test_sbf
|
||||||
)
|
)
|
||||||
|
@ -82,6 +85,8 @@ metaplex() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf metaplex-program-library
|
rm -rf metaplex-program-library
|
||||||
git clone https://github.com/metaplex-foundation/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
|
cd metaplex-program-library
|
||||||
|
|
||||||
update_solana_dependencies . "$solana_ver"
|
update_solana_dependencies . "$solana_ver"
|
||||||
|
@ -89,8 +94,8 @@ metaplex() {
|
||||||
patch_crates_io_solana Cargo.toml "$solana_dir"
|
patch_crates_io_solana Cargo.toml "$solana_dir"
|
||||||
patch_crates_io_anchor Cargo.toml "$anchor_dir"
|
patch_crates_io_anchor Cargo.toml "$anchor_dir"
|
||||||
|
|
||||||
$cargo build
|
cargo build
|
||||||
$cargo test
|
cargo test
|
||||||
$cargo_build_sbf
|
$cargo_build_sbf
|
||||||
$cargo_test_sbf
|
$cargo_test_sbf
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,7 +12,6 @@ source scripts/read-cargo-variable.sh
|
||||||
|
|
||||||
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
|
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
|
||||||
solana_dir=$PWD
|
solana_dir=$PWD
|
||||||
cargo="$solana_dir"/cargo
|
|
||||||
cargo_build_sbf="$solana_dir"/cargo-build-sbf
|
cargo_build_sbf="$solana_dir"/cargo-build-sbf
|
||||||
cargo_test_sbf="$solana_dir"/cargo-test-sbf
|
cargo_test_sbf="$solana_dir"/cargo-test-sbf
|
||||||
|
|
||||||
|
@ -24,6 +23,8 @@ example_helloworld() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf example-helloworld
|
rm -rf example-helloworld
|
||||||
git clone https://github.com/solana-labs/example-helloworld.git
|
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
|
cd example-helloworld
|
||||||
|
|
||||||
update_solana_dependencies src/program-rust "$solana_ver"
|
update_solana_dependencies src/program-rust "$solana_ver"
|
||||||
|
@ -57,6 +58,8 @@ spl() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf spl
|
rm -rf spl
|
||||||
git clone https://github.com/solana-labs/solana-program-library.git 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
|
cd spl
|
||||||
|
|
||||||
project_used_solana_version=$(sed -nE 's/solana-sdk = \"[>=<~]*(.*)\"/\1/p' <"token/program/Cargo.toml")
|
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
|
# 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
|
# the required programs to run the tests, so instead we run the tests
|
||||||
# after we know programs have been built
|
# after we know programs have been built
|
||||||
$cargo build
|
cargo build
|
||||||
$cargo test
|
cargo test
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +88,8 @@ openbook_dex() {
|
||||||
set -x
|
set -x
|
||||||
rm -rf openbook-dex
|
rm -rf openbook-dex
|
||||||
git clone https://github.com/openbook-dex/program.git 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
|
cd openbook-dex
|
||||||
|
|
||||||
update_solana_dependencies . "$solana_ver"
|
update_solana_dependencies . "$solana_ver"
|
||||||
|
@ -101,12 +106,12 @@ exclude = [
|
||||||
"permissioned",
|
"permissioned",
|
||||||
]
|
]
|
||||||
EOF
|
EOF
|
||||||
$cargo build
|
cargo build
|
||||||
|
|
||||||
$cargo_build_sbf \
|
$cargo_build_sbf \
|
||||||
--manifest-path dex/Cargo.toml --no-default-features --features program
|
--manifest-path dex/Cargo.toml --no-default-features --features program
|
||||||
|
|
||||||
$cargo test \
|
cargo test \
|
||||||
--manifest-path dex/Cargo.toml --no-default-features --features program
|
--manifest-path dex/Cargo.toml --no-default-features --features program
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue