From 8afd670a65eafc5534784d0dd3dd13a7dc601ada Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 27 Apr 2022 14:37:40 +0200 Subject: [PATCH] chore(solc): remove async feature requirement (#1181) --- ethers-solc/src/compile/mod.rs | 12 ++++++------ ethers-solc/src/compile/project.rs | 4 ++-- ethers-solc/src/lib.rs | 12 ++++++------ ethers-solc/src/resolver/mod.rs | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ethers-solc/src/compile/mod.rs b/ethers-solc/src/compile/mod.rs index 6c31a0b9..57665002 100644 --- a/ethers-solc/src/compile/mod.rs +++ b/ethers-solc/src/compile/mod.rs @@ -224,7 +224,7 @@ impl Solc { /// Returns the list of all versions that are available to download and marking those which are /// already installed. - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn all_versions() -> Vec { let mut all_versions = Self::installed_versions(); let mut uniques = all_versions @@ -285,7 +285,7 @@ impl Solc { /// to build it, and returns it. /// /// If the required compiler version is not installed, it also proceeds to install it. - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn detect_version(source: &Source) -> Result { // detects the required solc version let sol_version = Self::source_version_req(source)?; @@ -296,7 +296,7 @@ impl Solc { /// used to build it, and returns it. /// /// If the required compiler version is not installed, it also proceeds to install it. - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn ensure_installed(sol_version: &VersionReq) -> Result { #[cfg(any(test, feature = "tests"))] let _lock = take_solc_installer_lock(); @@ -371,7 +371,7 @@ impl Solc { } /// Blocking version of `Self::install` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn blocking_install(version: &Version) -> std::result::Result { tracing::trace!("blocking installing solc version \"{}\"", version); crate::report::solc_installation_start(version); @@ -389,7 +389,7 @@ impl Solc { /// Verify that the checksum for this version of solc is correct. We check against the SHA256 /// checksum from the build information published by binaries.soliditylang - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn verify_checksum(&self) -> Result<()> { let version = self.version_short()?; let mut version_path = svm::version_path(version.to_string().as_str()); @@ -733,7 +733,7 @@ mod tests { #[test] // This test might be a bit hard to maintain - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] fn test_detect_version() { for (pragma, expected) in [ // pinned diff --git a/ethers-solc/src/compile/project.rs b/ethers-solc/src/compile/project.rs index e7a82d97..2d08c7f7 100644 --- a/ethers-solc/src/compile/project.rs +++ b/ethers-solc/src/compile/project.rs @@ -140,7 +140,7 @@ impl<'a, T: ArtifactOutput> ProjectCompiler<'a, T> { /// let project = Project::builder().build().unwrap(); /// let output = project.compile().unwrap(); /// ``` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn new(project: &'a Project) -> Result { Self::with_sources(project, project.paths.read_input_files()?) } @@ -151,7 +151,7 @@ impl<'a, T: ArtifactOutput> ProjectCompiler<'a, T> { /// /// Multiple (`Solc` -> `Sources`) pairs can be compiled in parallel if the `Project` allows /// multiple `jobs`, see [`crate::Project::set_solc_jobs()`]. - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn with_sources(project: &'a Project, sources: Sources) -> Result { let graph = Graph::resolve_sources(&project.paths, sources)?; let (versions, edges) = graph.into_sources_by_version(project.offline)?; diff --git a/ethers-solc/src/lib.rs b/ethers-solc/src/lib.rs index dd879d6b..c2fcd705 100644 --- a/ethers-solc/src/lib.rs +++ b/ethers-solc/src/lib.rs @@ -209,7 +209,7 @@ impl Project { let sources = self.paths.read_input_files()?; tracing::trace!("found {} sources to compile: {:?}", sources.len(), sources.keys()); - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] if self.auto_detect { tracing::trace!("using solc auto detection to compile sources"); return self.svm_compile(sources) @@ -243,7 +243,7 @@ impl Project { /// let output = project.svm_compile(sources).unwrap(); /// # } /// ``` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn svm_compile(&self, sources: Sources) -> Result> { project::ProjectCompiler::with_sources(self, sources)?.compile() } @@ -260,7 +260,7 @@ impl Project { /// let output = project.compile_file("example/Greeter.sol").unwrap(); /// # } /// ``` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn compile_file(&self, file: impl Into) -> Result> { let file = file.into(); let source = Source::read(&file)?; @@ -282,7 +282,7 @@ impl Project { /// ).unwrap(); /// # } /// ``` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn compile_files(&self, files: I) -> Result> where I: IntoIterator, @@ -321,7 +321,7 @@ impl Project { /// ).unwrap(); /// # } /// ``` - #[cfg(all(feature = "svm-solc", feature = "async"))] + #[cfg(all(feature = "svm-solc"))] pub fn compile_sparse( &self, filter: F, @@ -807,7 +807,7 @@ impl ArtifactOutput for Project { } #[cfg(test)] -#[cfg(all(feature = "svm-solc", feature = "async"))] +#[cfg(all(feature = "svm-solc"))] mod tests { use crate::remappings::Remapping; diff --git a/ethers-solc/src/resolver/mod.rs b/ethers-solc/src/resolver/mod.rs index 02debcfb..b4c6ed7f 100644 --- a/ethers-solc/src/resolver/mod.rs +++ b/ethers-solc/src/resolver/mod.rs @@ -380,7 +380,7 @@ impl Graph { } } -#[cfg(all(feature = "svm-solc", feature = "async"))] +#[cfg(all(feature = "svm-solc"))] impl Graph { /// Consumes the nodes of the graph and returns all input files together with their appropriate /// version and the edges of the graph @@ -689,14 +689,14 @@ impl<'a> Iterator for NodesIter<'a> { } /// Container type for solc versions and their compatible sources -#[cfg(all(feature = "svm-solc", feature = "async"))] +#[cfg(all(feature = "svm-solc"))] #[derive(Debug)] pub struct VersionedSources { inner: HashMap, offline: bool, } -#[cfg(all(feature = "svm-solc", feature = "async"))] +#[cfg(all(feature = "svm-solc"))] impl VersionedSources { /// Resolves or installs the corresponding `Solc` installation. pub fn get(