Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(starknet_sierra_compile): move env var from run time to compile… #2454

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/blockifier/src/test_utils/cairo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn cairo1_compiler_tag() -> String {
/// overridden by the environment variable (otherwise, the default is used).
fn local_cairo1_compiler_repo_path() -> PathBuf {
// Location of blockifier's Cargo.toml.
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let manifest_dir = env!("CARGO_MANIFEST_DIR");

Path::new(&manifest_dir).join(
env::var(CAIRO1_REPO_RELATIVE_PATH_OVERRIDE_ENV_VAR)
Expand Down Expand Up @@ -217,7 +217,7 @@ fn verify_cairo0_compiler_deps() {
} else {
format!("installed version: {cairo_lang_version}")
},
env::var("CARGO_MANIFEST_DIR").unwrap(),
env!("CARGO_MANIFEST_DIR"),
CAIRO0_PIP_REQUIREMENTS_FILE
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ hex.workspace = true
indexmap = { workspace = true, features = ["serde"] }
itertools.workspace = true
num-bigint.workspace = true
papyrus_proc_macros.workspace = true
pretty_assertions.workspace = true
primitive-types = { workspace = true, features = ["serde"] }
semver.workspace = true
Expand All @@ -35,5 +34,6 @@ thiserror.workspace = true
assert_matches.workspace = true
rstest.workspace = true


[lints]
workspace = true
11 changes: 4 additions & 7 deletions crates/starknet_api/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashMap;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};

use papyrus_proc_macros::generate_get_package_dir;
use serde::{Deserialize, Serialize};
use serde_json::to_string_pretty;
use starknet_types_core::felt::Felt;
Expand All @@ -17,13 +16,11 @@ pub mod deploy_account;
pub mod invoke;
pub mod l1_handler;

generate_get_package_dir!();

/// Returns the path to a file in the resources directory. This assumes the package directory has a
/// `resources` folder. The value for file_path should be the path to the required file in the
/// folder "resources".
/// Returns the path to a file in the resources directory. This assumes the current working
/// directory has a `resources` folder. The value for file_path should be the path to the required
/// file in the folder "resources".
pub fn path_in_resources<P: AsRef<Path>>(file_path: P) -> PathBuf {
PathBuf::from(get_package_dir()).join("resources").join(file_path)
std::env::current_dir().unwrap().join("resources").join(file_path)
}

/// Reads from the directory containing the manifest at run time, same as current working directory.
Expand Down
2 changes: 1 addition & 1 deletion crates/starknet_sierra_compile/src/build_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ pub fn output_file_path() -> String {

#[cfg(feature = "cairo_native")]
pub fn repo_root_dir() -> PathBuf {
Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("../..").to_path_buf()
Path::new(env!("CARGO_MANIFEST_DIR")).join("../..").to_path_buf()
}
Loading