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(solc): provide remappings on unresolved import message #935

Merged
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
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