-
Notifications
You must be signed in to change notification settings - Fork 62
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
Detect implicit cabal cradle in the absence of cabal.project #221
Conversation
When would the implicit stack cradle be selected with this logic? |
Always selected first, if possible. Cabal cradles are the “last resort” in the implicit lookup and this only extends the Cabal part |
d6ba01e
to
82b39d5
Compare
82b39d5
to
bef1ffc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the .hie-bios.stop file doesnt do anything, it should be removed
666de6a
to
77e8132
Compare
A cabal cradle doesn't need a cabal.project file and isn't guaranteed to have one either. This improves the implicit cradle search for cabal by falling back to finding .cabal files if hie-bios couldn't find any cabal.project files. Because it falls back, if hie-bios tries to query a multi-package cabal project with a nested cabal package, it will still find use the "larger" cradle with the upper cabal.project file. See the implicit-cabal-deep-project test project for an example of this.
77e8132
to
051ec49
Compare
@@ -32,7 +32,7 @@ jobs: | |||
key: ${{ runner.OS }}-${{ matrix.ghc }}-cabal-0 | |||
|
|||
- name: Run ShellCheck | |||
uses: ludeeus/action-shellcheck@master | |||
uses: ludeeus/action-shellcheck@2f2aa0d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround for this
-- don't spin up a ghc session, just run the opts program manually since | ||
-- we're not guaranteed to be able to get the ghc libdir if the cradle is | ||
-- failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is interesting and not documented: https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Types.hs#L60
Or what do you mean with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that hie-bios no longer uses ghc-paths it has to call cabal exec ghc
for the failing-cabal test case to set up the ghc session. But cabal exec ghc
fails because it can’t resolve the constraints in the first place! So we aren’t able to get a lib dir. Prior to this it was just working by fluke, since there’s no cabal.project in this directory cabal exec ghc
was using the hie-bios project to resolve it fine.
We can still test loading the flags etc and it will still fail, we just need to do it without a ghc session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should document it better that we require runCradle
to succeed and how the results for libdir may be non-sensical if it fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still the .hie-bios.stop files in the PR, not necessary right?
@fendor let's remove them when we revert the stop files commit |
This prevents the cabal.project/hie.yaml of hie-bios's source tree from interfering with the cradle stuff
051ec49
to
df4941b
Compare
A cabal cradle doesn't need a cabal.project file and isn't guaranteed to have one either. This improves the implicit cradle search for cabal by falling back to finding .cabal files if hie-bios couldn't find any cabal.project files.
Because it falls back, if hie-bios tries to query a multi-package cabal project with a nested cabal package, it will still find use the "larger" cradle with the upper cabal.project file. See the implicit-cabal-deep-project test project for an example of this.