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:
Georgios Konstantopoulos 2022-02-16 17:46:25 +02:00 committed by GitHub
parent 859af7e819
commit f97a8ca541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -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);

View File

@ -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"),
] ]