feat(solc): pass compile time to reporter (#1098)
* Pass compile time to solc_success/on_solc_success * Update changelog
This commit is contained in:
parent
33f5b7c5fa
commit
18dda9aa83
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
### Unreleased
|
### Unreleased
|
||||||
|
|
||||||
|
- Pass compilation time as additional argument to `Reporter::on_solc_success` [1098](https://github.com/gakonst/ethers-rs/pull/1098)
|
||||||
- Fix aws signer bug which maps un-normalized signature to error if no normalization occurs (in `aws::utils::decode_signature`)
|
- Fix aws signer bug which maps un-normalized signature to error if no normalization occurs (in `aws::utils::decode_signature`)
|
||||||
- `Transaction::from` will default to `Address::zero()`. Add `recover_from` and
|
- `Transaction::from` will default to `Address::zero()`. Add `recover_from` and
|
||||||
`recover_from_mut` methods for recovering the sender from signature, and also
|
`recover_from_mut` methods for recovering the sender from signature, and also
|
||||||
|
|
|
@ -115,7 +115,7 @@ use crate::{
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
use crate::filter::SparseOutputFileFilter;
|
use crate::filter::SparseOutputFileFilter;
|
||||||
use std::{collections::btree_map::BTreeMap, path::PathBuf};
|
use std::{collections::btree_map::BTreeMap, path::PathBuf, time::Instant};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ProjectCompiler<'a, T: ArtifactOutput> {
|
pub struct ProjectCompiler<'a, T: ArtifactOutput> {
|
||||||
|
@ -457,9 +457,10 @@ fn compile_sequential(
|
||||||
input.sources.keys()
|
input.sources.keys()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let start = Instant::now();
|
||||||
report::solc_spawn(&solc, &version, &input, &actually_dirty);
|
report::solc_spawn(&solc, &version, &input, &actually_dirty);
|
||||||
let output = solc.compile_exact(&input)?;
|
let output = solc.compile_exact(&input)?;
|
||||||
report::solc_success(&solc, &version, &output);
|
report::solc_success(&solc, &version, &output, &start.elapsed());
|
||||||
tracing::trace!("compiled input, output has error: {}", output.has_error());
|
tracing::trace!("compiled input, output has error: {}", output.has_error());
|
||||||
tracing::trace!("received compiler output: {:?}", output.contracts.keys());
|
tracing::trace!("received compiler output: {:?}", output.contracts.keys());
|
||||||
aggregated.extend(version.clone(), output);
|
aggregated.extend(version.clone(), output);
|
||||||
|
@ -542,9 +543,10 @@ fn compile_parallel(
|
||||||
input.sources.len(),
|
input.sources.len(),
|
||||||
input.sources.keys()
|
input.sources.keys()
|
||||||
);
|
);
|
||||||
|
let start = Instant::now();
|
||||||
report::solc_spawn(&solc, &version, &input, &actually_dirty);
|
report::solc_spawn(&solc, &version, &input, &actually_dirty);
|
||||||
solc.compile(&input).map(move |output| {
|
solc.compile(&input).map(move |output| {
|
||||||
report::solc_success(&solc, &version, &output);
|
report::solc_success(&solc, &version, &output, &start.elapsed());
|
||||||
(version, output)
|
(version, output)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -27,6 +27,7 @@ use std::{
|
||||||
atomic::{AtomicBool, AtomicUsize, Ordering},
|
atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||||
Arc,
|
Arc,
|
||||||
},
|
},
|
||||||
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
mod compiler;
|
mod compiler;
|
||||||
|
@ -115,7 +116,14 @@ pub trait Reporter: 'static {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invoked with the `CompilerOutput` if [`Solc::compile()`] was successful
|
/// Invoked with the `CompilerOutput` if [`Solc::compile()`] was successful
|
||||||
fn on_solc_success(&self, _solc: &Solc, _version: &Version, _output: &CompilerOutput) {}
|
fn on_solc_success(
|
||||||
|
&self,
|
||||||
|
_solc: &Solc,
|
||||||
|
_version: &Version,
|
||||||
|
_output: &CompilerOutput,
|
||||||
|
_duration: &Duration,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
/// Invoked before a new [`Solc`] bin is installed
|
/// Invoked before a new [`Solc`] bin is installed
|
||||||
fn on_solc_installation_start(&self, _version: &Version) {}
|
fn on_solc_installation_start(&self, _version: &Version) {}
|
||||||
|
@ -181,8 +189,13 @@ pub(crate) fn solc_spawn(
|
||||||
get_default(|r| r.reporter.on_solc_spawn(solc, version, input, dirty_files));
|
get_default(|r| r.reporter.on_solc_spawn(solc, version, input, dirty_files));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn solc_success(solc: &Solc, version: &Version, output: &CompilerOutput) {
|
pub(crate) fn solc_success(
|
||||||
get_default(|r| r.reporter.on_solc_success(solc, version, output));
|
solc: &Solc,
|
||||||
|
version: &Version,
|
||||||
|
output: &CompilerOutput,
|
||||||
|
duration: &Duration,
|
||||||
|
) {
|
||||||
|
get_default(|r| r.reporter.on_solc_success(solc, version, output, duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
|
Loading…
Reference in New Issue