Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

compile_sparse and compile_files ignores solc settings #1202

Closed
onbjerg opened this issue Apr 30, 2022 · 0 comments · Fixed by #1226
Closed

compile_sparse and compile_files ignores solc settings #1202

onbjerg opened this issue Apr 30, 2022 · 0 comments · Fixed by #1226

Comments

@onbjerg
Copy link
Collaborator

onbjerg commented Apr 30, 2022

compile_sparse and compile_files ignore auto-detection settings. See compile:

#[tracing::instrument(skip_all, name = "compile")]
pub fn compile(&self) -> Result<ProjectCompileOutput<T>> {
let sources = self.paths.read_input_files()?;
tracing::trace!("found {} sources to compile: {:?}", sources.len(), sources.keys());
#[cfg(all(feature = "svm-solc"))]
if self.auto_detect {
tracing::trace!("using solc auto detection to compile sources");
return self.svm_compile(sources)
}
let solc = self.configure_solc(self.solc.clone());
self.compile_with_version(&solc, sources)
}

Compare to the other two:

#[cfg(all(feature = "svm-solc"))]
pub fn compile_files<P, I>(&self, files: I) -> Result<ProjectCompileOutput<T>>
where
I: IntoIterator<Item = P>,
P: Into<PathBuf>,
{
project::ProjectCompiler::with_sources(self, Source::read_all(files)?)?.compile()
}

#[cfg(all(feature = "svm-solc"))]
pub fn compile_sparse<F: FileFilter + 'static>(
&self,
filter: F,
) -> Result<ProjectCompileOutput<T>> {
let sources =
Source::read_all(self.paths.input_files().into_iter().filter(|p| filter.is_match(p)))?;
let filter: Box<dyn FileFilter> = Box::new(filter);
project::ProjectCompiler::with_sources(self, sources)?.with_sparse_output(filter).compile()
}

Ideally all compile* functions would pass along the solc settings of the project

Ref foundry-rs/foundry#1155

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant