mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-19 11:01:11 +00:00
the solc download per target helper
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
//! - Polkadot revive resolc compiler
|
||||
//! - Polkadot revive Wasm compiler
|
||||
|
||||
use std::{fs::read_to_string, hash::Hash, path::Path};
|
||||
use std::{
|
||||
fs::read_to_string,
|
||||
hash::Hash,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use revive_common::EVMVersion;
|
||||
use revive_solc_json_interface::{
|
||||
@@ -28,7 +32,7 @@ pub trait SolidityCompiler {
|
||||
input: CompilerInput<Self::Options>,
|
||||
) -> anyhow::Result<CompilerOutput<Self::Options>>;
|
||||
|
||||
fn new(solc_version: &Version) -> Self;
|
||||
fn new(solc_executable: PathBuf) -> Self;
|
||||
}
|
||||
|
||||
/// The generic compilation input configuration.
|
||||
@@ -142,8 +146,8 @@ where
|
||||
self
|
||||
}
|
||||
|
||||
pub fn try_build(self, solc_version: &Version) -> anyhow::Result<CompilerOutput<T::Options>> {
|
||||
T::new(solc_version).build(CompilerInput {
|
||||
pub fn try_build(self, solc_path: PathBuf) -> anyhow::Result<CompilerOutput<T::Options>> {
|
||||
T::new(solc_path).build(CompilerInput {
|
||||
extra_options: self.extra_options,
|
||||
input: self.input,
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@ use semver::Version;
|
||||
use crate::{CompilerInput, CompilerOutput, SolidityCompiler};
|
||||
|
||||
pub struct Solc {
|
||||
binary_path: PathBuf,
|
||||
solc_path: PathBuf,
|
||||
}
|
||||
|
||||
impl SolidityCompiler for Solc {
|
||||
@@ -21,7 +21,7 @@ impl SolidityCompiler for Solc {
|
||||
&self,
|
||||
input: CompilerInput<Self::Options>,
|
||||
) -> anyhow::Result<CompilerOutput<Self::Options>> {
|
||||
let mut child = Command::new(&self.binary_path)
|
||||
let mut child = Command::new(&self.solc_path)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
@@ -38,9 +38,7 @@ impl SolidityCompiler for Solc {
|
||||
})
|
||||
}
|
||||
|
||||
fn new(_solc_version: &Version) -> Self {
|
||||
Self {
|
||||
binary_path: "solc".into(),
|
||||
}
|
||||
fn new(solc_path: PathBuf) -> Self {
|
||||
Self { solc_path }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user