Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions cli/src/rust_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum ProgramTemplate {
pub fn create_program(name: &str, template: ProgramTemplate, with_mollusk: bool) -> Result<()> {
let program_path = Path::new("programs").join(name);
let common_files = vec![
("Cargo.toml".into(), workspace_manifest().into()),
("Cargo.toml".into(), workspace_manifest()),
("rust-toolchain.toml".into(), rust_toolchain_toml()),
(
program_path.join("Cargo.toml"),
Expand Down Expand Up @@ -171,13 +171,18 @@ pub fn handler(ctx: Context<Initialize>) -> Result<()> {
]
}

const fn workspace_manifest() -> &'static str {
r#"[workspace]
fn workspace_manifest() -> String {
format!(
r#"[workspace]
members = [
"programs/*"
]
resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "{ANCHOR_MSRV}"

[profile.release]
overflow-checks = true
lto = "fat"
Expand All @@ -187,6 +192,7 @@ opt-level = 3
incremental = false
codegen-units = 1
"#
)
}

fn cargo_toml(name: &str, with_mollusk: bool) -> String {
Expand All @@ -205,7 +211,8 @@ mollusk-svm = "~0.4"
name = "{0}"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
edition.workspace = true
rust-version.workspace = true

[lib]
crate-type = ["cdylib", "lib"]
Expand Down Expand Up @@ -667,7 +674,7 @@ impl TestTemplate {
}
}
Self::Rust => "cargo test".to_owned(),
Self::Mollusk => "cargo test-sbf".to_owned(),
Self::Mollusk => "cargo test-sbf --tools-version v1.52".to_owned(),
}
}

Expand Down
Loading