foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Add command to check solc autodetected version

Open izcoser opened this issue 2 months ago • 4 comments

Component

Forge

Describe the feature you would like

Foundry has a config which is auto detect solc version. It defaults to true and when you type forge build, it detects the appropriate newest allowed version and uses that.

I propose you add a "forge detect-sol" command which spits out the detected version.

Additional context

No response

izcoser avatar Apr 14 '24 03:04 izcoser

hey @mattsse! I would like to try this and have done the setup, but I need help with how to get the solc version if I have the root or path of the project you want to check for?

kamuik16 avatar Apr 14 '24 14:04 kamuik16

@kamuik16 Just to clarify, this feature is already built in, just not exposed as a command. So ideally you'd just find where this happens in the code.

I have no Rust experience and would take a while to learn this project's structure, which is why I didn't come up with a PR straight away.

izcoser avatar Apr 14 '24 16:04 izcoser

@kamuik16 Just to clarify, this feature is already built in, just not exposed as a command. So ideally you'd just find where this happens in the code.

I have no Rust experience and would take a while to learn this project's structure, which is why I didn't come up with a PR straight away.

I was asking for some refs or what to use, the project is pretty large.

kamuik16 avatar Apr 14 '24 17:04 kamuik16

it's likely we need some helpers for this type

https://github.com/foundry-rs/compilers/blob/ce808f4a81d953b571b5dd823a74fdc3260c1441/src/resolver/mod.rs#L462-L468

the way this is used during the compilation step is:

https://github.com/foundry-rs/compilers/blob/ce808f4a81d953b571b5dd823a74fdc3260c1441/src/compile/project.rs#L138-L147

but for this command we'd need to do this ourselves: resolve the project's graph, then the versions and print them

mattsse avatar Apr 14 '24 18:04 mattsse