Skip to content

Commit

Permalink
feat: use the regualr dependnacies to import the install the starknet…
Browse files Browse the repository at this point in the history
…-sierra-compile crate
  • Loading branch information
ArniStarkware committed Sep 8, 2024
1 parent c77fb53 commit ee93161
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 121 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions crates/gateway/build.rs

This file was deleted.

1 change: 1 addition & 0 deletions crates/starknet_sierra_compile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version.workspace = true
workspace = true

[dependencies]
starknet-sierra-compile = {version = "2.7.0", artifact = "bin" }
cairo-lang-sierra.workspace = true
cairo-lang-starknet-classes.workspace = true
cairo-lang-utils.workspace = true
Expand Down
81 changes: 0 additions & 81 deletions crates/starknet_sierra_compile/build.rs

This file was deleted.

28 changes: 0 additions & 28 deletions crates/starknet_sierra_compile/src/build_utils.rs

This file was deleted.

13 changes: 8 additions & 5 deletions crates/starknet_sierra_compile/src/command_line_compiler.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;

use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use cairo_lang_starknet_classes::contract_class::ContractClass;
use tempfile::NamedTempFile;

use crate::build_utils::binary_path;
use crate::config::SierraToCasmCompilationConfig;
use crate::errors::CompilationUtilError;
use crate::SierraToCasmCompiler;

#[derive(Clone)]
pub struct CommandLineCompiler {
pub config: SierraToCasmCompilationConfig,
path_to_starknet_sierra_compile_binary: PathBuf,
path_to_starknet_sierra_compile_binary: String,
}

impl CommandLineCompiler {
pub fn new(config: SierraToCasmCompilationConfig) -> Self {
Self { config, path_to_starknet_sierra_compile_binary: binary_path() }
Self { config, path_to_starknet_sierra_compile_binary: new_binary_path() }
}
}

fn new_binary_path() -> String {
// "starknet-sierra-compile".to_owned()
env!("CARGO_BIN_FILE_STARKNET_SIERRA_COMPILE").to_string()
}

impl SierraToCasmCompiler for CommandLineCompiler {
fn compile(
&self,
Expand All @@ -39,7 +42,7 @@ impl SierraToCasmCompiler for CommandLineCompiler {

// Set the parameters for the compile process.
// TODO(Arni): Setup the ulimit for the process.
let mut command = Command::new(self.path_to_starknet_sierra_compile_binary.as_os_str());
let mut command = Command::new(&self.path_to_starknet_sierra_compile_binary);
command.args([
temp_file_path,
"--add-pythonic-hints",
Expand Down
1 change: 0 additions & 1 deletion crates/starknet_sierra_compile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use cairo_lang_starknet_classes::contract_class::ContractClass;

use crate::errors::CompilationUtilError;

pub mod build_utils;
pub mod cairo_lang_compiler;
pub mod command_line_compiler;
pub mod config;
Expand Down
3 changes: 0 additions & 3 deletions crates/tests-integration/build.rs

This file was deleted.

0 comments on commit ee93161

Please sign in to comment.