Skip to content

Conversation

@grandizzy
Copy link
Collaborator

@grandizzy grandizzy commented Nov 4, 2024

Motivation

Closes #3440

Solution

  • when loading projects figment, add configured project src, script and test dir remappings in Remappings struct
  • when merging/pushing new remappings make sure they're not equal to / overriding project paths

@grandizzy grandizzy changed the title fix(remappings): ignore remappings of root proj dir when merging fix(remappings): ignore remappings of root proj dirs when merging Nov 4, 2024
let config_path = canonicalized(config_path);
Config::figment_with_root(config_path.parent().unwrap())
let root_path = config_path.parent().unwrap();
(Config::figment_with_root(root_path), Config::load_with_root(root_path))
Copy link
Collaborator Author

@grandizzy grandizzy Nov 4, 2024

Choose a reason for hiding this comment

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

not sure if this could be an issue for different profile (than the default one) specific paths

Copy link
Member

Choose a reason for hiding this comment

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

this is very expensive and now does Config::figment_with_root(root_path) twice under the hood.

especially because this is only used to apply smth to arguments?
feels like the wrong location to do this

Copy link
Member

Choose a reason for hiding this comment

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

looks like we only need the project paths and not the entire config to modify the remappings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yep, good point, I changed this in 8b2d7b0 to load them from figment, this also correctly loads the current profile src/script/test dirs.
Hope this makes sense, pls check. thanks!

@grandizzy grandizzy marked this pull request as ready for review November 4, 2024 14:59
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@grandizzy grandizzy merged commit 10a8e88 into foundry-rs:master Nov 7, 2024
21 checks passed
@grandizzy grandizzy deleted the issue-3440 branch November 7, 2024 14:44
rplusq pushed a commit to rplusq/foundry that referenced this pull request Nov 29, 2024
…undry-rs#9258)

* fix(remappings): ignore remappings of root proj dir when merging

* Remove unused code

* Add test

* Update

* Load project paths from figment

---------

Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
@grandizzy grandizzy added T-bug Type: bug C-forge Command: forge labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-forge Command: forge T-bug Type: bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

bug(config): file paths not resolved if submodule specifies root path remappings

3 participants