Skip to content

bug(forge build, library): leaky abstraction: _with_root() #10300

@odyslam

Description

@odyslam

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

commit hash: 256cc50

What version of Foundryup are you on?

irrelevant

What command(s) is the bug in?

forge build entrypoint

Operating System

None

Describe the bug

I am building on top of forge build and I couldn't figure out why I can't change the default src directory of the foundry project.

It seems that here:

fn _with_root(root: &Path) -> Self {

It will be replaced with the src default in the foundry compilers codepath that is entered here.

That seems like a weird leaky abstraction between the two crates, as I would assume that ProjectPathsConfig::builder() should be instantiated with the defaults that are define in the Default implementation of the config, and not have two sources of truth for the default source directory of the smart contracts.

I may be missing something though, so would love to see if I should be using this in a different way. My use-case is basically to run the BuildArgs command (by either calling run() or replicating the code inside run, but with a different set of default directories for src, ,test, etc.

It's worth noting that it's only src and scripts that are not respected, but test will respect the definition in the Default implementation of the Config.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions