diff --git a/CHANGELOG.md b/CHANGELOG.md index 42ef1a1e..c58a162f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Supported `polkadot-sdk` rev:`c29e72a8628835e34deb6aa7db9a78a2e4eabcee` ### Added - Support for solc v0.8.29 +- `--supported-solc-versions` for `resolc` binary to return a `semver` range of supported `solc` versions. ### Changed - Runner `resolc` using webkit is no longer supported. diff --git a/crates/solidity/src/lib.rs b/crates/solidity/src/lib.rs index 7214120e..24776e2f 100644 --- a/crates/solidity/src/lib.rs +++ b/crates/solidity/src/lib.rs @@ -44,8 +44,11 @@ pub use self::solc::standard_json::output::contract::Contract as SolcStandardJso pub use self::solc::standard_json::output::Output as SolcStandardJsonOutput; pub use self::solc::version::Version as SolcVersion; pub use self::solc::Compiler; +pub use self::solc::FIRST_SUPPORTED_VERSION as SolcFirstSupportedVersion; +pub use self::solc::LAST_SUPPORTED_VERSION as SolcLastSupportedVersion; pub use self::version::Version as ResolcVersion; pub use self::warning::Warning; + #[cfg(not(target_os = "emscripten"))] pub mod test_utils; pub mod tests; diff --git a/crates/solidity/src/resolc/arguments.rs b/crates/solidity/src/resolc/arguments.rs index e0e9e923..c777b6b3 100644 --- a/crates/solidity/src/resolc/arguments.rs +++ b/crates/solidity/src/resolc/arguments.rs @@ -19,6 +19,10 @@ pub struct Arguments { #[arg(long = "version")] pub version: bool, + /// Print supported `solc` versions and exit. + #[arg(long = "supported-solc-versions")] + pub supported_solc_versions: bool, + /// Print the licence and exit. #[arg(long = "license")] pub license: bool, @@ -171,6 +175,12 @@ impl Arguments { anyhow::bail!("No other options are allowed while getting the compiler version."); } + if self.supported_solc_versions && std::env::args().count() > 2 { + anyhow::bail!( + "No other options are allowed while getting the supported `solc` versions." + ); + } + #[cfg(debug_assertions)] if self.recursive_process_input.is_some() && !self.recursive_process { anyhow::bail!("--process-input can be only used when --recursive-process is given"); diff --git a/crates/solidity/src/resolc/main.rs b/crates/solidity/src/resolc/main.rs index b308771c..5e133f6a 100644 --- a/crates/solidity/src/resolc/main.rs +++ b/crates/solidity/src/resolc/main.rs @@ -41,6 +41,16 @@ fn main_inner() -> anyhow::Result<()> { return Ok(()); } + if arguments.supported_solc_versions { + writeln!( + std::io::stdout(), + ">={},<={}", + revive_solidity::SolcFirstSupportedVersion, + revive_solidity::SolcLastSupportedVersion, + )?; + return Ok(()); + } + if arguments.license { let license_mit = include_str!("../../../../LICENSE-MIT"); let license_apache = include_str!("../../../../LICENSE-APACHE");