-
Notifications
You must be signed in to change notification settings - Fork 70
feat: allow multiple compiler configs #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
55fbc56 to
c269a7d
Compare
b9e5f7f to
9b13ed2
Compare
9d6a8b8 to
2e82dc5
Compare
2e82dc5 to
1b80617
Compare
1b80617 to
5b42d05
Compare
0c2f7d8 to
26a2657
Compare
mattsse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of this makes sense,
was able to follow, but could use some additional docs
| pub trait CompilerSettingsRestrictions: Copy + Debug + Sync + Send + Clone + Default { | ||
| fn merge(self, other: Self) -> Option<Self>; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs docs
|
In case anyone googles for this feature, and lands here, the syntax given in this post is no longer correct, and silently does nothing. The correct syntax is given here: foundry-rs/foundry#8668 This post, wrong syntax: Correct syntax: Definitely some docs would be helpful. |
This adds
CompilerSettings::Restrictionsassociated type which allows configuring constraints for compilation settings. Those constraints can be checked against a settings object and merged.Ideally given a set of constraints we'd be able to automatically resolve configurations given only basic (default) config, though I think we can do this in follow-up. Current implementation requires user to provide us with concrete profiles such that for each defined constraint at least one of the profiles matches it. This should be enough for most of the usecases for now.
Profile to use is resolved in
Graphsimilarly to version resolution.The way this could look in foundry.toml is:
When writing artifacts, a profile name is added to artifact file name if the same contract was compiled with multiple artifacts.