chore: add info messages to solc install/compile (#838)

* chore: add info messages to solc install/compile

* chore: update changelog

* fix: remove added ';'

* Update ethers-solc/src/compile.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
odyslam.eth 2022-01-29 11:32:38 +03:00 committed by GitHub
parent 24c39bd32a
commit 8b9a18ce01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -22,6 +22,7 @@
and no nonce is specified and no nonce is specified
- Move `fill_transaction` implementation to the provider, to allow middleware - Move `fill_transaction` implementation to the provider, to allow middleware
to properly override its behavior. to properly override its behavior.
- Add informational messages to solc installation and compilation.
## ethers-contract-abigen ## ethers-contract-abigen

View File

@ -409,14 +409,19 @@ impl Solc {
#[cfg(feature = "svm")] #[cfg(feature = "svm")]
pub async fn install(version: &Version) -> std::result::Result<(), svm::SolcVmError> { pub async fn install(version: &Version) -> std::result::Result<(), svm::SolcVmError> {
tracing::trace!("installing solc version \"{}\"", version); tracing::trace!("installing solc version \"{}\"", version);
svm::install(version).await println!("installing solc version \"{}\"", version);
let result = svm::install(version).await;
println!("installation complete");
result
} }
/// Blocking version of `Self::install` /// Blocking version of `Self::install`
#[cfg(all(feature = "svm", feature = "async"))] #[cfg(all(feature = "svm", feature = "async"))]
pub fn blocking_install(version: &Version) -> std::result::Result<(), svm::SolcVmError> { pub fn blocking_install(version: &Version) -> std::result::Result<(), svm::SolcVmError> {
tracing::trace!("blocking installing solc version \"{}\"", version); tracing::trace!("blocking installing solc version \"{}\"", version);
println!("installing solc version \"{}\"", version);
tokio::runtime::Runtime::new().unwrap().block_on(svm::install(version))?; tokio::runtime::Runtime::new().unwrap().block_on(svm::install(version))?;
println!("installation completed");
Ok(()) Ok(())
} }
@ -483,7 +488,6 @@ impl Solc {
pub fn compile_output<T: Serialize>(&self, input: &T) -> Result<Vec<u8>> { pub fn compile_output<T: Serialize>(&self, input: &T) -> Result<Vec<u8>> {
let mut cmd = Command::new(&self.solc); let mut cmd = Command::new(&self.solc);
let mut child = cmd let mut child = cmd
.args(&self.args) .args(&self.args)
.arg("--standard-json") .arg("--standard-json")
@ -493,7 +497,6 @@ impl Solc {
.spawn() .spawn()
.map_err(|err| SolcError::io(err, &self.solc))?; .map_err(|err| SolcError::io(err, &self.solc))?;
let stdin = child.stdin.take().unwrap(); let stdin = child.stdin.take().unwrap();
serde_json::to_writer(stdin, input)?; serde_json::to_writer(stdin, input)?;
compile_output(child.wait_with_output().map_err(|err| SolcError::io(err, &self.solc))?) compile_output(child.wait_with_output().map_err(|err| SolcError::io(err, &self.solc))?)
} }