Skip to content

feat(foundry-ignore-compile): read from ignore file and filter out al…#1

Open
tringuyenskymavis wants to merge 4 commits into
feature/foundry-ignore-compilefrom
implement-feature/foundry-ignore-compile/read-foundry-ignore-file
Open

feat(foundry-ignore-compile): read from ignore file and filter out al…#1
tringuyenskymavis wants to merge 4 commits into
feature/foundry-ignore-compilefrom
implement-feature/foundry-ignore-compile/read-foundry-ignore-file

Conversation

@tringuyenskymavis
Copy link
Copy Markdown

Description

This PR adds a feature to allow ignoring all paths specified in the foundry_ignore file when running forge build.

Copy link
Copy Markdown

@nxqbao nxqbao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply current rustfmt.toml

Comment thread crates/config/src/lib.rs Outdated
let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer use warning here

Comment thread crates/config/src/lib.rs Outdated
Comment on lines +838 to +851
let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
}

let ignore_pattern: Vec<GlobMatcher> = foundry_ignored_paths
.iter()
.filter_map(|path| GlobMatcher::from_str(path).ok())
.collect();

let ignore_filter: SkipBuildFilters =
SkipBuildFilters::new(ignore_pattern.clone(), self.root.0.clone());
builder = builder.sparse_output(ignore_filter);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group these lines in to a fn

Comment thread crates/config/src/lib.rs Outdated
let foundry_ignored_paths: Vec<String> = self.get_ignore_paths()?;

if foundry_ignored_paths.is_empty() {
println!("No ignored paths found");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
println!("No ignored paths found");
println!("No skipped paths found in .foundryignore");

Comment thread crates/config/src/lib.rs

let ignore_filter: SkipBuildFilters =
SkipBuildFilters::new(ignore_pattern.clone(), self.root.0.clone());
builder = builder.sparse_output(ignore_filter);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
builder = builder.sparse_output(ignore_filter);
builder = builder.sparse_output(ignore_filter);

Comment thread crates/config/src/lib.rs Outdated
Comment on lines +1084 to +1086
if !path.exists() {
return Ok(Vec::new());
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return more clear error, to differentiate "file not found", and "file not contains items"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants