Files
solana/scripts/build-downstream-projects.sh

110 lines
2.8 KiB
Bash
Raw Normal View History

2020-10-23 10:45:19 -07:00
#!/usr/bin/env bash
#
# Builds known downstream projects against local solana source
#
set -e
cd "$(dirname "$0")"/..
source ci/_
source scripts/read-cargo-variable.sh
solana_ver=$(readCargoVariable version sdk/Cargo.toml)
solana_dir=$PWD
2020-11-01 21:07:28 -08:00
cargo="$solana_dir"/cargo
cargo_build_bpf="$solana_dir"/cargo-build-bpf
cargo_test_bpf="$solana_dir"/cargo-test-bpf
2020-10-23 10:45:19 -07:00
mkdir -p target/downstream-projects
cd target/downstream-projects
update_solana_dependencies() {
declare tomls=()
while IFS='' read -r line; do tomls+=("$line"); done < <(find "$1" -name Cargo.toml)
2020-11-01 21:07:28 -08:00
sed -i -e "s#\(solana-program = \"\)[^\"]*\(\"\)#\1$solana_ver\2#g" "${tomls[@]}" || return $?
2020-10-23 10:45:19 -07:00
sed -i -e "s#\(solana-sdk = \"\).*\(\"\)#\1$solana_ver\2#g" "${tomls[@]}" || return $?
2020-11-01 21:07:28 -08:00
sed -i -e "s#\(solana-sdk = { version = \"\)[^\"]*\(\"\)#\1$solana_ver\2#g" "${tomls[@]}" || return $?
sed -i -e "s#\(solana-client = \"\)[^\"]*\(\"\)#\1$solana_ver\2#g" "${tomls[@]}" || return $?
sed -i -e "s#\(solana-client = { version = \"\)[^\"]*\(\"\)#\1$solana_ver\2#g" "${tomls[@]}" || return $?
2020-10-23 10:45:19 -07:00
}
patch_crates_io() {
cat >> "$1" <<EOF
[patch.crates-io]
2020-11-01 21:07:28 -08:00
solana-client = { path = "$solana_dir/client" }
solana-program = { path = "$solana_dir/sdk/program" }
2020-10-23 10:45:19 -07:00
solana-sdk = { path = "$solana_dir/sdk" }
EOF
}
example_helloworld() {
(
set -x
rm -rf example-helloworld
git clone https://github.com/solana-labs/example-helloworld.git
cd example-helloworld
update_solana_dependencies src/program-rust
patch_crates_io src/program-rust/Cargo.toml
echo "[workspace]" >> src/program-rust/Cargo.toml
2020-11-01 21:07:28 -08:00
$cargo_build_bpf \
--manifest-path src/program-rust/Cargo.toml
2020-10-23 10:45:19 -07:00
# TODO: Build src/program-c/...
)
}
spl() {
(
set -x
rm -rf spl
git clone https://github.com/solana-labs/solana-program-library.git spl
cd spl
2020-11-01 21:07:28 -08:00
./patch.crates-io.sh "$solana_dir"
$cargo build
# Generic `cargo test`/`cargo test-bpf` disabled due to BPF VM interface changes between Solana 1.4
# and 1.5...
#$cargo test
#$cargo_test_bpf
2020-10-23 10:45:19 -07:00
2020-11-01 21:07:28 -08:00
$cargo_test_bpf --manifest-path token/program/Cargo.toml
$cargo_test_bpf --manifest-path associated-token-account/program/Cargo.toml
$cargo_test_bpf --manifest-path feature-proposal/program/Cargo.toml
2020-10-23 10:45:19 -07:00
)
}
serum_dex() {
(
set -x
rm -rf serum-dex
git clone https://github.com/project-serum/serum-dex.git
2020-10-23 10:45:19 -07:00
cd serum-dex
update_solana_dependencies .
patch_crates_io Cargo.toml
patch_crates_io dex/Cargo.toml
chore: bump serde from 1.0.112 to 1.0.118 (bp #14828) (#15394) * chore: bump serde from 1.0.112 to 1.0.118 (#14828) * chore: bump serde from 1.0.112 to 1.0.122 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.112 to 1.0.122. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.112...v1.0.122) Signed-off-by: dependabot[bot] <support@github.com> * [auto-commit] Update all Cargo lock files * Update frozen_abi digest following serde update * Revert "chore: bump serde from 1.0.112 to 1.0.122" This reverts commit a3ef4442a4c985144ae2bd7ceaf8899a7ab8d7c0. * Revert "[auto-commit] Update all Cargo lock files" This reverts commit c41c3b005fb1ccade55155302c52cd5736c4b55f. * chore: bump serde from 1.0.112 to 1.0.118 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.112 to 1.0.118. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.112...v1.0.118) Signed-off-by: dependabot[bot] <support@github.com> * [auto-commit] Update all Cargo lock files * Remove serum-dex pinning * blind commit! Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com> Co-authored-by: Ryo Onodera <ryoqun@gmail.com> (cherry picked from commit 1df93fa2bef7b987b14915f1ae2a005a49755424) # Conflicts: # banks-interface/Cargo.toml # perf/Cargo.toml # programs/config/Cargo.toml * Fix conflicts Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2021-02-18 13:29:17 +00:00
cat >> dex/Cargo.toml <<EOF
[workspace]
exclude = [
"crank",
]
EOF
2020-11-01 21:07:28 -08:00
$cargo build
2020-10-23 10:45:19 -07:00
2020-11-01 21:07:28 -08:00
$cargo_build_bpf \
2020-10-23 10:45:19 -07:00
--manifest-path dex/Cargo.toml --no-default-features --features program
2020-10-23 10:45:19 -07:00
2020-11-01 21:07:28 -08:00
$cargo test \
2020-10-23 10:45:19 -07:00
--manifest-path dex/Cargo.toml --no-default-features --features program
2020-10-23 10:45:19 -07:00
)
}
_ example_helloworld
_ spl
2020-10-23 10:45:19 -07:00
_ serum_dex