Skip to content
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

Merged plugins pull in disabled deps when building with Setup.hs #4100

Closed
hololeap opened this issue Feb 28, 2024 · 3 comments · Fixed by #4160
Closed

Merged plugins pull in disabled deps when building with Setup.hs #4100

hololeap opened this issue Feb 28, 2024 · 3 comments · Fixed by #4160
Labels
status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@hololeap
Copy link
Contributor

I'm taking a look at packaging haskell-language-server-2.7.0.0 for Gentoo Linux. Currently, I have 2.6.0.0 and most plugins installed to my system, although I do not have the hls-fourmolu-plugin or fourmolu packages installed. Just experimenting with the Setup.hs interface, I notice that the fourmolu dependency is being pulled in even when the fourmolu flag is disabled:

cd haskell-language-server-2.7.0.0/
runhaskell Setup.hs configure --flag=-fourmolu

As you can see, it is still looking for fourmolu:

Configuring haskell-language-server-2.7.0.0...
Setup.hs: Encountered missing or private dependencies:
fourmolu >=0.14 && <0.16,
ghcide ==2.7.0.0,
hiedb >=0.6.0.0 && <0.7,
hls-graph ==2.7.0.0,
hls-plugin-api ==2.7.0.0,
lsp >=2.4 && <2.5

The changes made in #3976 seem to be selectively choosing which sub-libraries to build using build-depends:

common fourmolu
if flag(fourmolu)
build-depends: haskell-language-server:hls-fourmolu-plugin
cpp-options: -Dhls_fourmolu

It seems to me that Setup.hs does not seem to have the functionality to handle this, and instead tries to build all sub-libraries mentioned in the .cabal file, regardless of what flags are toggled.

This experiment was done using ghc-9.2.8 and Cabal-3.6.3.0.

@hololeap hololeap added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Feb 28, 2024
@michaelpj
Copy link
Collaborator

I am pretty sure the Setup.hs should have the ability to build individual components correctly. haskell.nix uses it fine. I note that I get all sorts of weird errors from running just runhaskell Setup.hs configure, so I wonder if that simply isn't the right way to use it?

@michaelpj
Copy link
Collaborator

You might need to pass a target? runhaskell Setup.hs configure exe:haskell-language-server --flags=-fourmolu?

@michaelpj michaelpj added the status: needs info Not actionable, because there's missing information label Mar 3, 2024
michaelpj added a commit that referenced this issue Apr 6, 2024
This ensures that cabal does not consider them at all, and won't try to
solve for their dependencies. So if we turn off the fourmolu plugin, cabal
really won't consider fourmolu at all.

This gets us some of the benefits of #4156 with much less work.

Fixes #4100.
michaelpj added a commit that referenced this issue Apr 6, 2024
This ensures that cabal does not consider them at all, and won't try to
solve for their dependencies. So if we turn off the fourmolu plugin, cabal
really won't consider fourmolu at all.

This gets us some of the benefits of #4156 with much less work.

Fixes #4100.
fendor pushed a commit that referenced this issue Apr 6, 2024
* Mark plugins as not buildable if the flag is disabled

This ensures that cabal does not consider them at all, and won't try to
solve for their dependencies. So if we turn off the fourmolu plugin, cabal
really won't consider fourmolu at all.

This gets us some of the benefits of #4156 with much less work.

Fixes #4100.

* Stick to no space after flag for consistency
@hololeap
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants