Files
revive-differential-tests/crates/solc-binaries/src/lib.rs
T
xermicus c590fa7bfd Scaffold utility and library (#3)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <bigcyrill@hotmail.com>
2025-03-31 11:40:05 +02:00

40 lines
1.0 KiB
Rust

//! This crates provides serializable Rust type definitions for the [solc binary lists][0]
//! and download helpers.
//!
//! [0]: https://binaries.soliditylang.org
use std::path::{Path, PathBuf};
use cache::get_or_download;
use download::GHDownloader;
use semver::Version;
pub mod cache;
pub mod download;
pub mod list;
/// Downloads the solc binary for Wasm is `wasm` is set, otherwise for
/// the target platform.
///
/// Subsequent calls for the same version will use a cached artifact
/// and not download it again.
pub fn download_solc(
cache_directory: &Path,
version: Version,
wasm: bool,
) -> anyhow::Result<PathBuf> {
let downloader = if wasm {
GHDownloader::wasm(version)
} else if cfg!(target_os = "linux") {
GHDownloader::linux(version)
} else if cfg!(target_os = "macos") {
GHDownloader::macosx(version)
} else if cfg!(target_os = "windows") {
GHDownloader::windows(version)
} else {
unimplemented!()
};
get_or_download(cache_directory, &downloader)
}