foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.04k stars 1.64k forks source link

[feature] foundry.toml settings conditional on OS type #6373

Open marktoda opened 9 months ago

marktoda commented 9 months ago

Component

Forge

Describe the feature you would like

It would be nice to be able to set some settings in foundry.toml depending on the current OS.

My specific use case is that Uniswap/v4-core uses a custom solc binary, which has a different target for different OSes. We currently set the target using $OSTYPE in a sourced .env file, but this is annoying

One API would be something like

[os.linux]
solc = ./bin/static-linux-solc

[os.mac]
solc = ./bin/mac-solc

[os.default]
solc = ./bin/solc

But even better would be allowing some light variable definitions and callable functions in foundry.toml, similar to [just](https://github.com/casey/just/blob/master/examples/cross-platform.just)

Additional context

No response

mattsse commented 9 months ago

this is definitely something we want to support.

a profile specific [os] table that supports all config values would be possible and not to complex to add I believe like

[profile.default.{linux,macos,windows}] that is then merged into profile.default depending on the platform?

marktoda commented 9 months ago

That would work great!

mattsse commented 9 months ago

wdyt @Evalir @DaniPopes ?

mds1 commented 9 months ago

[profile.default.{linux,macos,windows}] that is then merged into profile.default depending on the platform?

Would the OS specific sections support all keys that regular profiles support, e.g. profile.default.linux.fuzz.seed would replace what is defined in profile.default.fuzz.seed?

mattsse commented 9 months ago

I think we can support all keys, and those set under [..linux] replace the others, if on linux.

so

Would the OS specific sections support all keys that regular profiles support, e.g. profile.default.linux.fuzz.seed would replace what is defined in profile.default.fuzz.seed?

yes