Rust BPF programs depend on Solana SDK (#5819)

This commit is contained in:
Jack May
2019-09-06 09:20:14 -07:00
committed by GitHub
parent 1f9fde5f7b
commit e5f902369c
40 changed files with 187 additions and 146 deletions

View File

@ -12,10 +12,11 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk-bpf-utils = { path = "../../../../sdk/bpf/rust/rust-utils", version = "0.19.0-pre0" }
solana-sdk = { path = "../../../../sdk/", version = "0.19.0-pre0", default-features = false }
[dev_dependencies]
solana-sdk-bpf-test = { path = "../../../../sdk/bpf/rust/rust-test", version = "0.19.0-pre0" }
[features]
program = ["solana-sdk/program"]
default = ["program"]
[workspace]
members = []

View File

@ -1,6 +1,6 @@
//! @brief Solana Rust-based BPF program utility functions and types
extern crate solana_sdk_bpf_utils;
extern crate solana_sdk;
pub fn uadd(x: u128, y: u128) -> u128 {
x + y
@ -36,17 +36,15 @@ pub fn modulo(n: i128, d: i128) -> i128 {
#[cfg(test)]
mod test {
extern crate std;
use super::*;
#[test]
fn pull_in_externs() {
// Rust on Linux excludes the solana_sdk_bpf_test library unless there is a
// Rust on Linux excludes the externs unless there is a
// direct dependency, use this test to force the pull in of the library.
// This is not necessary on macos and unfortunate on Linux
// Issue #4972
extern crate solana_sdk_bpf_test;
use solana_sdk_bpf_test::*;
use solana_sdk::program_test::*;
unsafe { sol_log_("X".as_ptr(), 1) };
sol_log_64_(1, 2, 3, 4, 5);
}