From a70729779cf669b0e274fefd5e3fb872573cf4df Mon Sep 17 00:00:00 2001 From: AlexK Date: Mon, 7 Mar 2022 20:35:27 +0400 Subject: [PATCH] ci fix --- ethers-solc/src/artifacts/mod.rs | 6 ++++++ ethers-solc/src/compile/mod.rs | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index 142b5a69..0487ba48 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -823,6 +823,12 @@ impl CompilerOutput { err.source_location.as_ref().map(|s| files.contains(s.file.as_str())).unwrap_or(true) }); } + + pub fn merge(&mut self, other: CompilerOutput) { + self.errors.extend(other.errors); + self.contracts.extend(other.contracts); + self.sources.extend(other.sources); + } } /// A wrapper helper type for the `Contracts` type alias diff --git a/ethers-solc/src/compile/mod.rs b/ethers-solc/src/compile/mod.rs index af34c54f..7f4d48db 100644 --- a/ethers-solc/src/compile/mod.rs +++ b/ethers-solc/src/compile/mod.rs @@ -410,7 +410,12 @@ impl Solc { /// Convenience function for compiling all sources under the given path pub fn compile_source(&self, path: impl AsRef) -> Result { let path = path.as_ref(); - self.compile(&CompilerInput::new(path)?) + let mut res: CompilerOutput = Default::default(); + for input in CompilerInput::new(path)? { + let output = self.compile(&input)?; + res.merge(output) + } + Ok(res) } /// Same as [`Self::compile()`], but only returns those files which are included in the