Skip to content
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

feat(compilation): allow selective compilation of sources with --via-ir, running tests and scripts without #9132

Closed
zerosnacks opened this issue Oct 16, 2024 · 2 comments
Labels
A-compiler Area: compiler C-forge Command: forge Cmd-forge-build Command: forge build Cmd-forge-test Command: forge test T-feature Type: feature T-question Type: question

Comments

@zerosnacks
Copy link
Member

zerosnacks commented Oct 16, 2024

Component

Forge

Describe the feature you would like

In a basic scenario I was able to selectively compile with --via-ir as follows using the --skip flag:

$ forge build --via-ir --skip tests scripts

or this should work in foundry.toml:

[profile.via-ir]
via-ir = true
skip = ["test/*", "script/*"]

[profile.test]
skip = ["src/*"]

and then:

$ FOUNDRY_PROFILE=via-ir forge build
$ FOUNDRY_PROFILE=test forge test

This appears to work in a basic Counter example but appears to not work in all cases e.g. https://github.com/uniswap/v4-core

cc @klkvr is there a better way to do this?

Additional context

Related: https://x.com/0xKaden/status/1846606449977532748 + https://x.com/emo_eth/status/1846645499358859469

@zerosnacks zerosnacks added T-feature Type: feature Cmd-forge-test Command: forge test C-forge Command: forge Cmd-forge-build Command: forge build A-compiler Area: compiler labels Oct 16, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Oct 16, 2024
@zerosnacks zerosnacks added the T-question Type: question label Oct 16, 2024
@klkvr
Copy link
Member

klkvr commented Oct 16, 2024

$ FOUNDRY_PROFILE=via-ir forge build
$ FOUNDRY_PROFILE=test forge test

this would work only if project is only deploying contracts through deployCode, otherwise during tests compilation contracts would still get compiled without via-ir

one approach which could allow such patterns is #8668 which would also require doing deployCode but without FOUNDRY_PROFILE stuff

and in combination with foundry-rs/compilers#197 it could allow avoiding manual deployCode stuff

though both PRs are drafts which ended up quite complex so I've deprioritized them at some point

@zerosnacks
Copy link
Member Author

Marking as duplicate, there are other tickets that already capture this goal, see: #7720

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiler Area: compiler C-forge Command: forge Cmd-forge-build Command: forge build Cmd-forge-test Command: forge test T-feature Type: feature T-question Type: question
Projects
Status: Done
Development

No branches or pull requests

3 participants
@klkvr @zerosnacks and others