Skip to content

Commit

Permalink
chore(solc): provide remappings on unresolved import message (#935)
Browse files Browse the repository at this point in the history
* chore(solc): provide remappings on unresolved import message

* feat: add on solc error

* bump ethers
  • Loading branch information
mattsse authored Mar 14, 2022
1 parent 0f58c52 commit 62a5556
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

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

17 changes: 14 additions & 3 deletions cli/src/term.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! terminal utils
use ansi_term::Colour;
use atty::{self, Stream};
use ethers::solc::{report::Reporter, CompilerInput, Solc};
use ethers::solc::{remappings::Remapping, report::Reporter, CompilerInput, Solc};
use once_cell::sync::Lazy;
use semver::Version;
use std::{
Expand Down Expand Up @@ -220,8 +221,18 @@ impl Reporter for SpinnerReporter {
self.send_msg(format!("Successfully installed solc {}", version));
}

fn on_unresolved_import(&self, import: &Path) {
self.send_msg(format!("Unable to resolve imported file: \"{}\"", import.display()));
fn on_solc_installation_error(&self, version: &Version, error: &str) {
self.send_msg(
Colour::Red.paint(format!("Failed to install solc {}: {}", version, error)).to_string(),
);
}

fn on_unresolved_import(&self, import: &Path, remappings: &[Remapping]) {
self.send_msg(format!(
"Unable to resolve import: \"{}\" with remappings:\n {}",
import.display(),
remappings.iter().map(|r| r.to_string()).collect::<Vec<_>>().join("\n ")
));
}
}

Expand Down

0 comments on commit 62a5556

Please sign in to comment.