Skip to content

feat: add support for preprocessing sources #252

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

Merged
merged 75 commits into from
Apr 7, 2025

Conversation

grandizzy
Copy link
Contributor

@grandizzy grandizzy commented Feb 19, 2025

Implements a preprocessor allowing us to skip recompiling tests on non-interface source file changes. See the companion Foundry PR foundry-rs/foundry#10010 for benchmarks and more details.

Supersedes #198:

  • uses solar AST instead solang-parser to compute interface representation
  • uses solar HIR instead of solc AST to find bytecode dependencies
  • handles more edge cases, like deploying with salt/value

Closes #197.

TODO

### Depends on

@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from 1c02f7f to 325a627 Compare February 19, 2025 08:03
@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from 325a627 to 0f78197 Compare February 19, 2025 08:16
@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from b4c0746 to 7d0edb8 Compare February 19, 2025 14:37
@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from b5ebece to 4025e5a Compare February 19, 2025 16:56
@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from be6c378 to d37cafb Compare February 20, 2025 12:56
@grandizzy grandizzy force-pushed the klkvr/pp-test-rebase branch from 62f2933 to 446a5d8 Compare March 26, 2025 20:06
@grandizzy
Copy link
Contributor Author

You can manually load sources with SourceMap::new_dummy_source_file and add them with ParsingContext::add_file

"dummy" isn't right, it's just a way to intern a source file with a String rather than loading from disk

Awesome, that worked, committed in 446a5d8

@grandizzy grandizzy requested a review from DaniPopes March 28, 2025 07:40
@DaniPopes DaniPopes changed the title preprocessor to skip recompiling tests on non-interface source file changes feat: add support for preprocessing sources Apr 3, 2025
@grandizzy grandizzy requested a review from DaniPopes April 7, 2025 16:46
Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

lgtm, send it

@mattsse mattsse merged commit 5f3c3f7 into foundry-rs:main Apr 7, 2025
15 checks passed
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.

feat: optimize compilation through preprocessing and smarter caching
5 participants