Skip to content

Commit f78b859

Browse files
committed
solana: make network flags mutually exclusive
1 parent 1516fc7 commit f78b859

File tree

2 files changed

+12
-1
lines changed
  • cli/src
  • solana/programs/example-native-token-transfers/src

2 files changed

+12
-1
lines changed

cli/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ yargs(hideBin(process.argv))
6666
const objectFile = "example_native_token_transfers.so";
6767
const programId = "nttiK1SepaQt6sZ4WGW5whvc9tEnGXGxuKeptcQPCcS";
6868
assertNetwork(network);
69-
await $`cargo build-sbf --manifest-path=${dir}/Cargo.toml --features "${cargoNetworkFeature(network)}"`
69+
await $`cargo build-sbf --manifest-path=${dir}/Cargo.toml --no-default-features --features "${cargoNetworkFeature(network)}"`
7070
await $`solana program deploy --program-id ${programId} ${dir}/target/deploy/${objectFile} --keypair ${keypair} -u ${solanaMoniker(network)}`
7171
})
7272
.demandCommand()

solana/programs/example-native-token-transfers/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
use anchor_lang::prelude::*;
22

3+
// TODO: is there a more elegant way of checking that these 3 features are mutually exclusive?
4+
5+
#[cfg(all(feature = "mainnet", feature = "solana-devnet"))]
6+
compile_error!("Cannot enable both mainnet and solana-devnet features at the same time");
7+
8+
#[cfg(all(feature = "mainnet", feature = "tilt-devnet"))]
9+
compile_error!("Cannot enable both mainnet and tilt-devnet features at the same time");
10+
11+
#[cfg(all(feature = "solana-devnet", feature = "tilt-devnet"))]
12+
compile_error!("Cannot enable both solana-devnet and tilt-devnet features at the same time");
13+
314
pub mod bitmap;
415
pub mod clock;
516
pub mod config;

0 commit comments

Comments
 (0)