fix(abigen): do not panic when run on non-cargo projects (#918)
* fix(abigen): do not panic when run on non-cargo projects * chore: bump solidity test to 0.8.12
This commit is contained in:
parent
859af7e819
commit
f97a8ca541
|
@ -43,7 +43,14 @@ pub fn ethers_providers_crate() -> Path {
|
||||||
/// `cargo metadata` if a `Cargo.lock` file exists and delete it afterwards if
|
/// `cargo metadata` if a `Cargo.lock` file exists and delete it afterwards if
|
||||||
/// it was created by `cargo metadata`.
|
/// it was created by `cargo metadata`.
|
||||||
pub fn determine_ethers_crates() -> (&'static str, &'static str, &'static str) {
|
pub fn determine_ethers_crates() -> (&'static str, &'static str, &'static str) {
|
||||||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").expect("No Manifest found");
|
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR");
|
||||||
|
|
||||||
|
// if there is no cargo manifest, default to `ethers::`-style imports.
|
||||||
|
let manifest_dir = if let Ok(manifest_dir) = manifest_dir {
|
||||||
|
manifest_dir
|
||||||
|
} else {
|
||||||
|
return ("ethers::core", "ethers::contract", "ethers::providers")
|
||||||
|
};
|
||||||
|
|
||||||
// check if the lock file exists, if it's missing we need to clean up afterward
|
// check if the lock file exists, if it's missing we need to clean up afterward
|
||||||
let lock_file = format!("{}/Cargo.lock", manifest_dir);
|
let lock_file = format!("{}/Cargo.lock", manifest_dir);
|
||||||
|
|
|
@ -728,7 +728,7 @@ mod tests {
|
||||||
// update this test whenever there's a new sol
|
// update this test whenever there's a new sol
|
||||||
// version. that's ok! good reminder to check the
|
// version. that's ok! good reminder to check the
|
||||||
// patch notes.
|
// patch notes.
|
||||||
(">=0.5.0", "0.8.11"),
|
(">=0.5.0", "0.8.12"),
|
||||||
// range
|
// range
|
||||||
(">=0.4.0 <0.5.0", "0.4.26"),
|
(">=0.4.0 <0.5.0", "0.4.26"),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue