Skip to content

Commit

Permalink
Merge pull request #326 from 0xPolygonMiden/greenhat/miden-base-sys-n…
Browse files Browse the repository at this point in the history
…o-deps-in-bindings

chore: remove `miden-assembly` dependency from `sdk/base-sys` for `bindings` feature
  • Loading branch information
bitwalker authored Sep 17, 2024
2 parents 5211b74 + 7639039 commit 4b0c16b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions sdk/base-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ readme.workspace = true
edition.workspace = true

[dependencies]
miden-assembly.workspace = true
miden-assembly = { workspace = true, optional = true }
miden-stdlib-sys = { version = "0.0.6", path = "../stdlib-sys", optional = true }

[build-dependencies]
miden-assembly.workspace = true
miden-assembly = { workspace = true, optional = true }

[features]
default = []

# User facing Rust bindings
"bindings" = ["dep:miden-stdlib-sys"]
# MASL library for Miden rollup (tx kernel, etc.) used by the compiler in the link phase
"masl-lib" = []
"masl-lib" = ["dep:miden-assembly"]
24 changes: 12 additions & 12 deletions sdk/base-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use std::{env, path::Path, sync::Arc};

use miden_assembly::{
diagnostics::{IntoDiagnostic, Result},
Assembler, Library as CompiledLibrary, LibraryNamespace,
};

/// Read and parse the contents from `./masm/*` and compile it to MASL.
fn main() -> Result<()> {
#[cfg(feature = "masl-lib")]
fn main() {
use std::{env, path::Path, sync::Arc};

use miden_assembly::{
diagnostics::IntoDiagnostic, Assembler, Library as CompiledLibrary, LibraryNamespace,
};
// re-build the `[OUT_DIR]/assets/` file iff something in the `./masm` directory
// or its builder changed:
println!("cargo:rerun-if-changed=masm");
Expand All @@ -19,12 +18,13 @@ fn main() -> Result<()> {

let tx_asm_dir = Path::new(manifest_dir).join("masm").join("tx");
let asm = Assembler::new(source_manager);
let txlib = CompiledLibrary::from_dir(tx_asm_dir, namespace, asm)?;
let txlib = CompiledLibrary::from_dir(tx_asm_dir, namespace, asm).unwrap();
let tx_masl_path = build_dir
.join("assets")
.join("tx")
.with_extension(CompiledLibrary::LIBRARY_EXTENSION);
txlib.write_to_file(tx_masl_path).into_diagnostic()?;

Ok(())
txlib.write_to_file(tx_masl_path).into_diagnostic().unwrap();
}

#[cfg(not(feature = "masl-lib"))]
fn main() {}

0 comments on commit 4b0c16b

Please sign in to comment.