elaborate impl of findProjectRoot
Take an extra arg to control where to start searching, not just process current directory. This is mainly to make it easier to test without having to mutate the cwd but is potentially useful generally for cwd-independence. Return more detailed info: not just the directory but return if it's an implicit or an explict project root with a cabal.project file. In the latter case also return the cabal.project file since its name can be overridden. Then also adjust defaultDistDirLayout to take this more detailed ProjectRoot type, thus avoiding having to duplicate the logic about the location of the cabal.project file. Change the behaviour so that if an explicit cabal.project file name is given and it is not found then fail, rather than falling back to an implicit project root style. This would seem to make most sense: if the user specifies an explict cabal.project file then it'd be odd if we silently ignore that if the user misspells it or something. The implicit root default is really for the really simple case, not when users are explicitly specifying stuff. Also add a couple simple tests for findProjectRoot.
Showing
- cabal-install/Distribution/Client/DistDirLayout.hs 25 additions, 7 deletionscabal-install/Distribution/Client/DistDirLayout.hs
- cabal-install/Distribution/Client/Outdated.hs 4 additions, 2 deletionscabal-install/Distribution/Client/Outdated.hs
- cabal-install/Distribution/Client/ProjectConfig.hs 32 additions, 22 deletionscabal-install/Distribution/Client/ProjectConfig.hs
- cabal-install/Distribution/Client/ProjectOrchestration.hs 4 additions, 4 deletionscabal-install/Distribution/Client/ProjectOrchestration.hs
- cabal-install/tests/IntegrationTests2.hs 32 additions, 9 deletionscabal-install/tests/IntegrationTests2.hs
Loading
Please register or sign in to comment