Add --supported-solc-versions CLI command (#260)

### Description 

Adds `--supported-solc-versions` cli command to return a semver range of
supported `solc` versions.
Is a hack until #162 is implemented.

---------

Co-authored-by: xermicus <cyrill@parity.io>
This commit is contained in:
Pavlo Khrystenko
2025-03-19 16:07:48 +01:00
committed by GitHub
parent 2bbc5d713d
commit 36ea69b50f
4 changed files with 24 additions and 0 deletions
+1
View File
@@ -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.
+3
View File
@@ -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;
+10
View File
@@ -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");
+10
View File
@@ -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");