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(forge): add solc subcommand and utilities #7909

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jpgonzalezra
Copy link

@jpgonzalezra jpgonzalezra commented May 11, 2024

Closes: #7656

Motivation

The "issue 7654" it is proposed to add a new command, forge detect-solc (in this PR "forge solc vr" or "forge solc version-resolving"), which returns the detected version of the Solidity compiler based on the project configuration. This command aims to help users identify compatible versions of the Solidity compiler for different folders in large projects by providing insights into the version resolution algorithm used.

Solution

Added a solc command with the subcommand version-resolving, which retrieves the resolved versions of the Solidity compiler (solc) within the project using the SolcVersionManager from the foundry_compilers library.

  • Ex. with solmate project
$ forge solc vr 

Screenshot 2024-05-11 at 18 40 24

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this seems fine,

wdyt @klkvr

Copy link
Member

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

looks good to me

@mds1
Copy link
Collaborator

mds1 commented May 13, 2024

Support for the --skip flag that forge build has would be really nice to allow filtering out directories from the results. When I test this, the output is dominated by e.g. lib/ and test/ files that obscure the src/ files of interest (not a blocker for this PR, can be done in a follow up)

@jpgonzalezra
Copy link
Author

jpgonzalezra commented May 13, 2024

Thanks for the comments, I can add support for the --skip flag in this PR or another one.
And maybe we can add --silent to only print the version, something link:

one version:

  • 0.8.15

More than one:

  • 0.8.15
  • 0.8.25

What do you think guys?

@zerosnacks
Copy link
Member

zerosnacks commented Jul 15, 2024

Hi @jpgonzalezra thanks for the PR! Would be great to get this ready to be merged

I support adding the --skip flag to this PR. Perhaps rather than --silent it makes sense to add different levels of verbosity for the logs that are emitted where the lowest level yields:

  • 0.8.15
  • 0.8.25

And higher levels of verbosity as proposed by you:

- 0.8.15
  - <path>
  - <path>
  - <path>

- 0.8.25
  - <path>
  - <path>
  - <path>

@jpgonzalezra
Copy link
Author

@zerosnacks Awesome, I'll fix the conflicts so we can merge. If we want to add anything else, I'll do it in a separate PR. What do you think?

@zerosnacks
Copy link
Member

@zerosnacks Awesome, I'll fix the conflicts so we can merge. If we want to add anything else, I'll do it in a separate PR. What do you think?

Great, we can do this as follow ups - not a blocker for me for this PR

@jpgonzalezra
Copy link
Author

@zerosnacks I need to make some changes to the PR because there have been significant updates in the compilers repository. See this commit: foundry-rs/compilers@c78e2ea. I believe I need to use the "detect_version" function. I'll work on that. 💪

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 31, 2024
@zerosnacks
Copy link
Member

Thanks @jpgonzalezra! Let me know if you run into any problems

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

Successfully merging this pull request may close these issues.

feat(forge): add command to check solc autodetected version
5 participants