Return solc_version in CompilerOutput

This commit is contained in:
James Wilson
2025-08-27 10:45:22 +01:00
parent 4af9f6695d
commit dd94b12b34
8 changed files with 131 additions and 178 deletions
+11 -21
View File
@@ -4,17 +4,15 @@
use std::{
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
fs::OpenOptions,
path::PathBuf,
time::{SystemTime, UNIX_EPOCH},
};
use alloy_primitives::Address;
use anyhow::{Context as _, Result};
use indexmap::IndexMap;
use revive_dt_compiler::{CompilerInput, CompilerOutput, Mode};
use revive_dt_compiler::{CompilerInput, CompilerOutput, Mode, SolcCompilerInformation};
use revive_dt_config::{Arguments, TestingPlatform};
use revive_dt_format::{case::CaseIdx, corpus::Corpus, metadata::ContractInstance};
use semver::Version;
use serde::Serialize;
use serde_with::{DisplayFromStr, serde_as};
use tokio::sync::{
@@ -292,6 +290,7 @@ impl ReportAggregator {
} else {
None
};
let solc_info = event.compiler_output.solc.clone();
let compiler_output = if include_output {
Some(event.compiler_output)
} else {
@@ -300,8 +299,7 @@ impl ReportAggregator {
execution_information.pre_link_compilation_status = Some(CompilationStatus::Success {
is_cached: event.is_cached,
compiler_version: event.compiler_version,
compiler_path: event.compiler_path,
solc_info,
compiler_input,
compiler_output,
});
@@ -321,6 +319,7 @@ impl ReportAggregator {
} else {
None
};
let solc_info = event.compiler_output.solc.clone();
let compiler_output = if include_output {
Some(event.compiler_output)
} else {
@@ -329,8 +328,7 @@ impl ReportAggregator {
execution_information.post_link_compilation_status = Some(CompilationStatus::Success {
is_cached: event.is_cached,
compiler_version: event.compiler_version,
compiler_path: event.compiler_path,
solc_info,
compiler_input,
compiler_output,
});
@@ -352,8 +350,7 @@ impl ReportAggregator {
execution_information.pre_link_compilation_status = Some(CompilationStatus::Failure {
reason: event.reason,
compiler_version: event.compiler_version,
compiler_path: event.compiler_path,
solc_info: event.solc_info,
compiler_input,
});
}
@@ -374,8 +371,7 @@ impl ReportAggregator {
execution_information.post_link_compilation_status = Some(CompilationStatus::Failure {
reason: event.reason,
compiler_version: event.compiler_version,
compiler_path: event.compiler_path,
solc_info: event.solc_info,
compiler_input,
});
}
@@ -528,10 +524,8 @@ pub enum CompilationStatus {
Success {
/// A flag with information on whether the compilation artifacts were cached or not.
is_cached: bool,
/// The version of the compiler used to compile the contracts.
compiler_version: Version,
/// The path of the compiler used to compile the contracts.
compiler_path: PathBuf,
/// The version and path of the solc compiler used to compile the contracts.
solc_info: SolcCompilerInformation,
/// The input provided to the compiler to compile the contracts. This is only included if
/// the appropriate flag is set in the CLI configuration and if the contracts were not
/// cached and the compiler was invoked.
@@ -546,12 +540,8 @@ pub enum CompilationStatus {
Failure {
/// The failure reason.
reason: String,
/// The version of the compiler used to compile the contracts.
#[serde(skip_serializing_if = "Option::is_none")]
compiler_version: Option<Version>,
/// The path of the compiler used to compile the contracts.
#[serde(skip_serializing_if = "Option::is_none")]
compiler_path: Option<PathBuf>,
/// The version and path of the solc compiler used to compile the contracts.
solc_info: Option<SolcCompilerInformation>,
/// The input provided to the compiler to compile the contracts. This is only included if
/// the appropriate flag is set in the CLI configuration and if the contracts were not
/// cached and the compiler was invoked.
+6 -19
View File
@@ -1,16 +1,15 @@
//! The types associated with the events sent by the runner to the reporter.
#![allow(dead_code)]
use std::{collections::BTreeMap, path::PathBuf, sync::Arc};
use std::{collections::BTreeMap, sync::Arc};
use alloy_primitives::Address;
use anyhow::Context as _;
use indexmap::IndexMap;
use revive_dt_compiler::{CompilerInput, CompilerOutput};
use revive_dt_compiler::{CompilerInput, CompilerOutput, SolcCompilerInformation};
use revive_dt_config::TestingPlatform;
use revive_dt_format::metadata::Metadata;
use revive_dt_format::{corpus::Corpus, metadata::ContractInstance};
use semver::Version;
use tokio::sync::{broadcast, oneshot};
use crate::{ExecutionSpecifier, ReporterEvent, TestSpecifier, common::MetadataFilePath};
@@ -547,10 +546,6 @@ define_event! {
PreLinkContractsCompilationSucceeded {
/// A specifier for the execution that's taking place.
execution_specifier: Arc<ExecutionSpecifier>,
/// The version of the compiler used to compile the contracts.
compiler_version: Version,
/// The path of the compiler used to compile the contracts.
compiler_path: PathBuf,
/// A flag of whether the contract bytecode and ABI were cached or if they were compiled
/// anew.
is_cached: bool,
@@ -565,10 +560,6 @@ define_event! {
PostLinkContractsCompilationSucceeded {
/// A specifier for the execution that's taking place.
execution_specifier: Arc<ExecutionSpecifier>,
/// The version of the compiler used to compile the contracts.
compiler_version: Version,
/// The path of the compiler used to compile the contracts.
compiler_path: PathBuf,
/// A flag of whether the contract bytecode and ABI were cached or if they were compiled
/// anew.
is_cached: bool,
@@ -583,10 +574,8 @@ define_event! {
PreLinkContractsCompilationFailed {
/// A specifier for the execution that's taking place.
execution_specifier: Arc<ExecutionSpecifier>,
/// The version of the compiler used to compile the contracts.
compiler_version: Option<Version>,
/// The path of the compiler used to compile the contracts.
compiler_path: Option<PathBuf>,
/// The version and path of the solc compiler used to compile the contracts.
solc_info: Option<SolcCompilerInformation>,
/// The input provided to the compiler - this is optional and not provided if the
/// contracts were obtained from the cache.
compiler_input: Option<CompilerInput>,
@@ -598,10 +587,8 @@ define_event! {
PostLinkContractsCompilationFailed {
/// A specifier for the execution that's taking place.
execution_specifier: Arc<ExecutionSpecifier>,
/// The version of the compiler used to compile the contracts.
compiler_version: Option<Version>,
/// The path of the compiler used to compile the contracts.
compiler_path: Option<PathBuf>,
/// The version and path of the solc compiler used to compile the contracts.
solc_info: Option<SolcCompilerInformation>,
/// The input provided to the compiler - this is optional and not provided if the
/// contracts were obtained from the cache.
compiler_input: Option<CompilerInput>,