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

--skip is ignored in forge script #7799

Closed
2 tasks done
Thegaram opened this issue Apr 27, 2024 · 4 comments
Closed
2 tasks done

--skip is ignored in forge script #7799

Thegaram opened this issue Apr 27, 2024 · 4 comments
Labels
T-bug Type: bug

Comments

@Thegaram
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

19d69f2

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

It seems that --skip works with forge build to skip compilation, but it does not work with forge script.

> forge build --skip "*"
[⠊] Compiling...
No files changed, compilation skipped

> forge script scripts/foundry/Deploy.s.sol:Deploy --skip "*"
[⠆] Compiling...
[⠊] Compiling 282 files with 0.8.24
...

I tried multiple combinations (e.g. --skip "*", --skip "*.sol", --skip "src" --skip "scripts").

I have a Docker container in which I run multiple forge scripts. What I want to achieve is: Run forge build when building the container, then run the script (without building again) when I run the container.

@Thegaram Thegaram added the T-bug Type: bug label Apr 27, 2024
@klkvr
Copy link
Member

klkvr commented Apr 27, 2024

Running forge build without --skip flag will compile all contracts in project, and then forge script will just read cached script artifact, solving your usecase.

--skip flag on forge script doesn't really work, but currently forge script on its own is already smart enough to detect and compile only targeted script contract

@Thegaram
Copy link
Author

Thanks for your reply! Unfortunately that's not my experience, currently forge script seems to always recompile all my contracts, do you know what might be the reason?

Here's the output when I run these commands on the host machine (not in Docker):

> forge --version
forge 0.2.0 (26e6e57 2024-04-28T00:19:12.405804000Z)

> forge build                                         
[⠊] Compiling...
[⠒] Compiling 297 files with 0.8.24
[⠆] Solc 0.8.24 finished in 17.78s
Compiler run successful!

> forge script scripts/foundry/TomlTest.s.sol:TomlTest
[⠊] Compiling...
[⠘] Compiling 282 files with 0.8.24
[⠊] Solc 0.8.24 finished in 16.44s
Compiler run successful!
Traces:
...

@Thegaram
Copy link
Author

Possibly the same issue as #7379.

@Thegaram
Copy link
Author

Turns out it was a configuration issue, didn't realize I had force = true in foundry.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

2 participants