fix: Update Rust-BPF example (#406)
This commit is contained in:
parent
2e3c5e7820
commit
408e8e7500
|
@ -41,7 +41,7 @@ script:
|
|||
- npm run lint
|
||||
- npm run codecov
|
||||
- make -C examples/bpf-c-noop/
|
||||
- bpf-sdk/rust/build.sh examples/bpf-rust-noop
|
||||
- examples/bpf-rust-noop/do.sh build
|
||||
- npm run localnet:update
|
||||
- npm run localnet:up
|
||||
- npm run examples || true
|
||||
|
|
|
@ -13,10 +13,14 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
solana-sdk-bpf-utils = { path = "../../bpf-sdk/rust/rust-utils" }
|
||||
solana-sdk-bpf-no-std = { path = "../../bpf-sdk/rust/rust-no-std" }
|
||||
|
||||
[dev_dependencies]
|
||||
solana-sdk-bpf-test = { path = "../../bpf-sdk/rust/rust-test"}
|
||||
|
||||
[workspace]
|
||||
members = []
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
name = "solana_bpf_rust_noop"
|
||||
crate-type = ["cdylib"]
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
Usage: do.sh action <project>
|
||||
|
||||
If relative_project_path is ommitted then action will
|
||||
be performed on all projects
|
||||
|
||||
Supported actions:
|
||||
build
|
||||
clean
|
||||
test
|
||||
clippy
|
||||
fmt
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
perform_action() {
|
||||
set -e
|
||||
case "$1" in
|
||||
build)
|
||||
../../bpf-sdk/rust/build.sh "$PWD"
|
||||
;;
|
||||
clean)
|
||||
../../bpf-sdk/rust/clean.sh "$PWD"
|
||||
;;
|
||||
test)
|
||||
echo "test $2"
|
||||
cargo +nightly test
|
||||
;;
|
||||
clippy)
|
||||
echo "clippy $2"
|
||||
cargo +nightly clippy
|
||||
;;
|
||||
fmt)
|
||||
echo "formatting $2"
|
||||
cargo fmt
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown command"
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
perform_action "$1"
|
|
@ -4,6 +4,8 @@
|
|||
#![allow(unreachable_code)]
|
||||
#![allow(unused_attributes)]
|
||||
|
||||
#[cfg(not(test))]
|
||||
extern crate solana_sdk_bpf_no_std;
|
||||
extern crate solana_sdk_bpf_utils;
|
||||
|
||||
use solana_sdk_bpf_utils::entrypoint::*;
|
||||
|
|
|
@ -3,5 +3,5 @@ set -ex
|
|||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
../../../bpf-sdk/rust/build.sh ../../../examples/bpf-rust-noop
|
||||
../../../examples/bpf-rust-noop/do.sh build
|
||||
cp ../../../examples/bpf-rust-noop/target/bpfel-unknown-unknown/release/solana_bpf_rust_noop.so .
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue