Skip to main content

Module compile

Module compile 

Source
Expand description

Support for compiling [foundry_compilers::Project]

Re-exportsยง

use crate::TestFunctionExt; ๐Ÿ”’
use crate::external_compiler::ExternalCompilation; ๐Ÿ”’
use crate::external_compiler::is_builtin_compiler_source; ๐Ÿ”’
use crate::fs::canonicalize_path; ๐Ÿ”’
use crate::preprocessor::DynamicTestLinkingPreprocessor; ๐Ÿ”’
use crate::shell; ๐Ÿ”’
use crate::term::SpinnerReporter; ๐Ÿ”’
use alloy_json_abi::JsonAbi; ๐Ÿ”’
use comfy_table::Cell; ๐Ÿ”’
use comfy_table::Color; ๐Ÿ”’
use comfy_table::Table; ๐Ÿ”’
use comfy_table::presets::ASCII_FULL; ๐Ÿ”’
use comfy_table::presets::ASCII_MARKDOWN; ๐Ÿ”’
use eyre::OptionExt; ๐Ÿ”’
use eyre::Result; ๐Ÿ”’
use foundry_block_explorers::contract::Metadata; ๐Ÿ”’
use foundry_compilers::Artifact; ๐Ÿ”’
use foundry_compilers::Project; ๐Ÿ”’
use foundry_compilers::ProjectBuilder; ๐Ÿ”’
use foundry_compilers::ProjectCompileOutput; ๐Ÿ”’
use foundry_compilers::ProjectPathsConfig; ๐Ÿ”’
use foundry_compilers::SolcConfig; ๐Ÿ”’
use foundry_compilers::artifacts::BytecodeObject; ๐Ÿ”’
use foundry_compilers::artifacts::Contract; ๐Ÿ”’
use foundry_compilers::artifacts::Error as SolcError; ๐Ÿ”’
use foundry_compilers::artifacts::Severity; ๐Ÿ”’
use foundry_compilers::artifacts::Source; ๐Ÿ”’
use foundry_compilers::artifacts::output_selection::OutputSelection; ๐Ÿ”’
use foundry_compilers::artifacts::remappings::Remapping; ๐Ÿ”’
use foundry_compilers::compilers::CompilationError; ๐Ÿ”’
use foundry_compilers::compilers::Compiler; ๐Ÿ”’
use foundry_compilers::compilers::solc::Solc; ๐Ÿ”’
use foundry_compilers::compilers::solc::SolcCompiler; ๐Ÿ”’
use foundry_compilers::info::ContractInfo as CompilerContractInfo; ๐Ÿ”’
use foundry_compilers::multi::MultiCompiler; ๐Ÿ”’
use foundry_compilers::multi::MultiCompilerError; ๐Ÿ”’
use foundry_compilers::multi::MultiCompilerSettings; ๐Ÿ”’
use foundry_compilers::project::Preprocessor; ๐Ÿ”’
use foundry_compilers::report::BasicStdoutReporter; ๐Ÿ”’
use foundry_compilers::report::NoReporter; ๐Ÿ”’
use foundry_compilers::report::Report; ๐Ÿ”’
use foundry_compilers::solc::SolcSettings; ๐Ÿ”’
use foundry_config::Config; ๐Ÿ”’
use num_format::Locale; ๐Ÿ”’
use num_format::ToFormattedString; ๐Ÿ”’
use revm::primitives::eip170; ๐Ÿ”’
use revm::primitives::eip3860; ๐Ÿ”’
use revm::primitives::hardfork::SpecId; ๐Ÿ”’
use solar::ast::Arena; ๐Ÿ”’
use solar::ast::ContractKind; ๐Ÿ”’
use solar::ast::ItemKind; ๐Ÿ”’
use solar::interface::Session; ๐Ÿ”’
use solar::interface::source_map::FileName; ๐Ÿ”’
use solar::parse::Parser; ๐Ÿ”’
use std::any::Any; ๐Ÿ”’
use std::collections::BTreeMap; ๐Ÿ”’
use std::collections::BTreeSet; ๐Ÿ”’
use std::collections::HashMap; ๐Ÿ”’
use std::collections::HashSet; ๐Ÿ”’
use std::fmt::Display; ๐Ÿ”’
use std::io::IsTerminal; ๐Ÿ”’
use std::path::Component; ๐Ÿ”’
use std::path::Path; ๐Ÿ”’
use std::path::PathBuf; ๐Ÿ”’
use std::str::FromStr; ๐Ÿ”’
use std::sync::Arc; ๐Ÿ”’
use std::time::Instant; ๐Ÿ”’

Structsยง

ContractInfo
How big the contract is and whether it is a dev contract where size limits can be neglected
ContractSizeLimits
Runtime and initcode byte-size limits for compiled contract size reports.
ProjectCompiler
Builder type to configure how to compile a project.
SizeReport
Contracts with info about their size

Enumsยง

PathOrContractInfo
Container type for parsing contract identifiers from CLI.

Constantsยง

AMSTERDAM_CONTRACT_INITCODE_SIZE_LIMIT ๐Ÿ”’
AMSTERDAM_CONTRACT_RUNTIME_SIZE_LIMIT ๐Ÿ”’
CONTRACT_INITCODE_SIZE_LIMIT ๐Ÿ”’
CONTRACT_INITCODE_SIZE_WARN_THRESHOLD ๐Ÿ”’
CONTRACT_RUNTIME_SIZE_LIMIT ๐Ÿ”’
CONTRACT_RUNTIME_SIZE_WARN_THRESHOLD ๐Ÿ”’

Functionsยง

add_storage_layout_output
Adds storageLayout to the compiler output selection for the given project.
collect_libraries ๐Ÿ”’
Parses each source file with solar and returns the library names declared in it.
compile_abi_project
Compiles the project requesting only ABI output.
compile_abi_project_cached
Acquires ABI output with compiler-owned persistence separate from normal artifacts.
compile_target
Compiles target file path.
compile_target_abi
Compiles the target contract requesting only ABI output and returns its ABI.
contract_size ๐Ÿ”’
Returns the deployed or init size of the contract.
dynamic_test_linking_failure ๐Ÿ”’
Recognizes only solc code-generation failures that DTLโ€™s source rewrites can introduce. Unrelated errors (including other languages) must not trigger a retry.
etherscan_project
Creates a [Project] from an Etherscan source.
linked_libraries_error ๐Ÿ”’
Describes the Solidity library dependencies in creation or runtime bytecode, if any.
push_linked_libraries_error ๐Ÿ”’
Appends a linked-library policy error to solc or multi-compiler diagnostics.
sanitize_relative_path ๐Ÿ”’
Normalizes an untrusted path relative to the source root, discarding leading separators, drive prefixes, and parent components that would escape that root.
scaled_threshold ๐Ÿ”’
with_compilation_reporter
Configures the reporter and runs the given closure.
with_compilation_reporter_and_settings ๐Ÿ”’

Type Aliasesยง

Analysis
A Solar compiler instance, to grant syntactic and semantic analysis capabilities.