build-downstream-projects.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/env bash
  2. #
  3. # Builds known downstream projects against local solana source
  4. #
  5. set -e
  6. cd "$(dirname "$0")"/..
  7. source ci/_
  8. source scripts/patch-crates.sh
  9. source scripts/read-cargo-variable.sh
  10. solana_ver=$(readCargoVariable version sdk/Cargo.toml)
  11. solana_dir=$PWD
  12. cargo="$solana_dir"/cargo
  13. cargo_build_bpf="$solana_dir"/cargo-build-bpf
  14. cargo_test_bpf="$solana_dir"/cargo-test-bpf
  15. mkdir -p target/downstream-projects
  16. cd target/downstream-projects
  17. example_helloworld() {
  18. (
  19. set -x
  20. rm -rf example-helloworld
  21. git clone https://github.com/solana-labs/example-helloworld.git
  22. cd example-helloworld
  23. update_solana_dependencies src/program-rust "$solana_ver"
  24. patch_crates_io_solana src/program-rust/Cargo.toml "$solana_dir"
  25. echo "[workspace]" >> src/program-rust/Cargo.toml
  26. $cargo_build_bpf \
  27. --manifest-path src/program-rust/Cargo.toml
  28. # TODO: Build src/program-c/...
  29. )
  30. }
  31. spl() {
  32. (
  33. set -x
  34. rm -rf spl
  35. git clone https://github.com/solana-labs/solana-program-library.git spl
  36. cd spl
  37. ./patch.crates-io.sh "$solana_dir"
  38. $cargo build
  39. $cargo test
  40. $cargo_build_bpf
  41. $cargo_test_bpf
  42. )
  43. }
  44. serum_dex() {
  45. (
  46. set -x
  47. rm -rf serum-dex
  48. git clone https://github.com/project-serum/serum-dex.git
  49. cd serum-dex
  50. update_solana_dependencies . "$solana_ver"
  51. patch_crates_io_solana Cargo.toml "$solana_dir"
  52. patch_crates_io_solana dex/Cargo.toml "$solana_dir"
  53. cat >> dex/Cargo.toml <<EOF
  54. [workspace]
  55. exclude = [
  56. "crank",
  57. "permissioned",
  58. ]
  59. EOF
  60. $cargo build
  61. $cargo_build_bpf \
  62. --manifest-path dex/Cargo.toml --no-default-features --features program
  63. $cargo test \
  64. --manifest-path dex/Cargo.toml --no-default-features --features program
  65. )
  66. }
  67. _ example_helloworld
  68. _ spl
  69. _ serum_dex