|
1 | | -diff --git a/cli/src/lib.rs b/cli/src/lib.rs |
2 | | -index 4fdf34b0..0ef43c9e 100644 |
3 | | ---- a/cli/src/lib.rs |
4 | | -+++ b/cli/src/lib.rs |
5 | | -@@ -129,7 +129,7 @@ pub enum Command { |
6 | | - #[clap(long)] |
7 | | - no_docs: bool, |
8 | | - /// Architecture to use when building the program |
9 | | -- #[clap(value_enum, long, default_value = "bpf")] |
10 | | -+ #[clap(value_enum, long, default_value = "sbf")] |
11 | | - arch: ProgramArch, |
12 | | - }, |
13 | | - /// Expands macros (wrapper around cargo expand) |
14 | | -@@ -166,7 +166,7 @@ pub enum Command { |
15 | | - #[clap(value_enum, short, long, default_value = "none")] |
16 | | - bootstrap: BootstrapMode, |
17 | | - /// Architecture to use when building the program |
18 | | -- #[clap(value_enum, long, default_value = "bpf")] |
19 | | -+ #[clap(value_enum, long, default_value = "sbf")] |
20 | | - arch: ProgramArch, |
21 | | - /// Environment variables to pass into the docker container |
22 | | - #[clap(short, long, required = false)] |
23 | | -@@ -199,7 +199,7 @@ pub enum Command { |
24 | | - #[clap(long)] |
25 | | - skip_build: bool, |
26 | | - /// Architecture to use when building the program |
27 | | -- #[clap(value_enum, long, default_value = "bpf")] |
28 | | -+ #[clap(value_enum, long, default_value = "sbf")] |
29 | | - arch: ProgramArch, |
30 | | - /// Flag to keep the local validator running after tests |
31 | | - /// to be able to check the transactions. |
32 | | -@@ -297,7 +297,7 @@ pub enum Command { |
33 | | - #[clap(long)] |
34 | | - skip_build: bool, |
35 | | - /// Architecture to use when building the program |
36 | | -- #[clap(value_enum, long, default_value = "bpf")] |
37 | | -+ #[clap(value_enum, long, default_value = "sbf")] |
38 | | - arch: ProgramArch, |
39 | | - }, |
40 | | - /// Keypair commands. |
41 | | -@@ -320,7 +320,7 @@ pub enum Command { |
42 | | - #[clap(long)] |
43 | | - skip_lint: bool, |
44 | | - /// Architecture to use when building the program |
45 | | -- #[clap(value_enum, long, default_value = "bpf")] |
46 | | -+ #[clap(value_enum, long, default_value = "sbf")] |
47 | | - arch: ProgramArch, |
48 | | - /// Environment variables to pass into the docker container |
49 | | - #[clap(short, long, required = false)] |
| 1 | +diff --git a/idl/src/build.rs b/idl/src/build.rs |
| 2 | +index 96dc3db2..1b098718 100644 |
| 3 | +--- a/idl/src/build.rs |
| 4 | ++++ b/idl/src/build.rs |
| 5 | +@@ -60,16 +60,8 @@ pub fn build_idl( |
| 6 | + |
| 7 | + /// Build IDL. |
| 8 | + fn build(program_path: &Path, resolution: bool, skip_lint: bool, no_docs: bool) -> Result<Idl> { |
| 9 | +- // `nightly` toolchain is currently required for building the IDL. |
| 10 | +- let toolchain = std::env::var("RUSTUP_TOOLCHAIN") |
| 11 | +- .map(|toolchain| format!("+{}", toolchain)) |
| 12 | +- .unwrap_or_else(|_| "+nightly".to_string()); |
| 13 | +- |
| 14 | +- install_toolchain_if_needed(&toolchain)?; |
| 15 | +- |
| 16 | + let output = Command::new("cargo") |
| 17 | + .args([ |
| 18 | +- &toolchain, |
| 19 | + "test", |
| 20 | + "__anchor_private_print_idl", |
| 21 | + "--features", |
| 22 | +@@ -202,23 +194,6 @@ fn build(program_path: &Path, resolution: bool, skip_lint: bool, no_docs: bool) |
| 23 | + idl.ok_or_else(|| anyhow!("IDL doesn't exist")) |
| 24 | + } |
| 25 | + |
| 26 | +-/// Install the given toolchain if it's not already installed. |
| 27 | +-fn install_toolchain_if_needed(toolchain: &str) -> Result<()> { |
| 28 | +- let is_installed = Command::new("cargo") |
| 29 | +- .arg(toolchain) |
| 30 | +- .output()? |
| 31 | +- .status |
| 32 | +- .success(); |
| 33 | +- if !is_installed { |
| 34 | +- Command::new("rustup") |
| 35 | +- .args(["toolchain", "install", toolchain.trim_start_matches('+')]) |
| 36 | +- .spawn()? |
| 37 | +- .wait()?; |
| 38 | +- } |
| 39 | +- |
| 40 | +- Ok(()) |
| 41 | +-} |
| 42 | +- |
| 43 | + /// Convert paths to name if there are no conflicts. |
| 44 | + fn convert_module_paths(idl: Idl) -> Idl { |
| 45 | + let idl = serde_json::to_string(&idl).unwrap(); |
0 commit comments