Skip to content

Remove Cabal dependency from hls-cabal-plugin #3383

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 2 commits into from

Conversation

cydparser
Copy link
Contributor

Only Cabal-syntax is needed. I was unable to build using Nix without this change due to errors like the following:

src/Ide/Plugin/Cabal/Diagnostics.hs:17:1: error:
    Ambiguous module name ‘Distribution.Fields’:
      it was found in multiple packages:
      Cabal-3.6.3.0 Cabal-syntax-3.8.1.0

@cydparser cydparser requested a review from fendor as a code owner December 6, 2022 02:24
@fendor
Copy link
Collaborator

fendor commented Dec 6, 2022

Love the idea, but you will need further adjustments to stack.yaml. I am curious whether this is feasible

@cydparser
Copy link
Contributor Author

@fendor what modifications to stack.yaml are necessary? The stackage resolvers used by this project include Cabal-syntax.

@fendor
Copy link
Collaborator

fendor commented Dec 8, 2022

If you make it work, great! Last time I checked, it was rather difficult to make it use a different Cabal version. (not sure whether we need a different one)

@lf-
Copy link
Contributor

lf- commented Dec 12, 2022

If you make it work, great! Last time I checked, it was rather difficult to make it use a different Cabal version. (not sure whether we need a different one)

I think this is resolved by use of cabal-syntax and thus cabal version of the toolchain should be possible to ignore, ideally? Needs trying, regardless.

@lf-
Copy link
Contributor

lf- commented Dec 12, 2022

I'm trying to build this branch with stack, will let you know how it goes.

@lf-
Copy link
Contributor

lf- commented Dec 12, 2022

Aah, shoot, yes, the problem is that Distribution.SPDX.LicenseId is in Cabal rather than Cabal-syntax. That's unfortunate! oh wait, no

@lf-
Copy link
Contributor

lf- commented Dec 12, 2022

From 777d681cb1f6a10a6fb7532bc97d9e87ebf31068 Mon Sep 17 00:00:00 2001
From: Jade Lovelace <jadel@mercury.com>
Date: Mon, 12 Dec 2022 12:29:32 -0800
Subject: [PATCH] Fix the stack build

---
 plugins/hls-cabal-plugin/hls-cabal-plugin.cabal | 2 +-
 stack-lts19.yaml                                | 2 +-
 stack.yaml                                      | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/hls-cabal-plugin/hls-cabal-plugin.cabal b/plugins/hls-cabal-plugin/hls-cabal-plugin.cabal
index eb331283..24ca74bc 100644
--- a/plugins/hls-cabal-plugin/hls-cabal-plugin.cabal
+++ b/plugins/hls-cabal-plugin/hls-cabal-plugin.cabal
@@ -33,7 +33,7 @@ library
   build-depends:
     , base                  >=4.12     && <5
     , bytestring
-    , Cabal-syntax          ^>= 3.6 || ^>= 3.8
+    , Cabal-syntax          ^>= 3.8
     , deepseq
     , directory
     , extra                 >=1.7.4
diff --git a/stack-lts19.yaml b/stack-lts19.yaml
index 74d90c33..a46e62f5 100644
--- a/stack-lts19.yaml
+++ b/stack-lts19.yaml
@@ -42,7 +42,7 @@ ghc-options:
   "$everything": -haddock
 
 extra-deps:
-- Cabal-3.6.0.0
+- Cabal-syntax-3.8.1.0
 # needed for tests of hls-cabal-fmt-plugin
 - cabal-fmt-0.1.6@sha256:54041d50c8148c32d1e0a67aef7edeebac50ae33571bef22312f6815908eac19,3626
 - floskell-0.10.6@sha256:e77d194189e8540abe2ace2c7cb8efafc747ca35881a2fefcbd2d40a1292e036,3819
diff --git a/stack.yaml b/stack.yaml
index b9244827..7863d00d 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -52,6 +52,7 @@ extra-deps:
 - lsp-types-1.6.0.0
 - lsp-test-0.14.1.0
 - hie-bios-0.11.0
+- Cabal-syntax-3.8.1.0
 
 # currently needed for ghcide>extra, etc.
 allow-newer: true
-- 
2.38.1

This patch fixes the stack build on your branch. I would push to your branch but don't have write access (don't want to accidentally become a HLS maintainer). You can copy paste it into a file then do git am < thepatch.patch.

@cydparser cydparser force-pushed the cabal-plugin-ambiguity branch from 497d284 to 095a628 Compare December 13, 2022 03:30
@lf-
Copy link
Contributor

lf- commented Dec 13, 2022

stackage-lts19 failure

This is due to the removal of the cabal-3.6.0.0 line, which is apparently required by hls-ormolu-plugin somehow? I thought it wasn't necessary so deleted it after testing but I was mistaken.

stackage-nightly failure

Fixed in commercialhaskell/stack#5886

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM, if stack CI is green :)

wavewave added a commit to MercuryTechnologies/haskell-language-server that referenced this pull request Dec 16, 2022
note that this is an opposite to haskell#3383, to prioritize CI fix first.
@wavewave wavewave mentioned this pull request Dec 16, 2022
mergify bot pushed a commit that referenced this pull request Dec 17, 2022
* fix fourmolu with -f-fixity-th in nix env

* ci failure test

* bump nix file.

* disable cachix action

* further comment out

* revive cachix action.

* remove commented-out

* fix hls-cabal-plugin by removing Cabal-syntax.
note that this is an opposite to #3383, to prioritize CI fix first.

* limit implicit-hie < 0.1.3

* added a small comment and link to the issue.

* put implicit-hie to ghcide dep

* bump CI
mergify bot pushed a commit that referenced this pull request Dec 21, 2022
…3317)

* Set buildable on GHC 9.4

* Start work on GHC 9.4 compat

* Use patched `retrie`

* update retrie with github address. circumvent nix-prefetch-url.

* handle ExactPrint

* fix ghc 9.0 env.

* unwrap big CPP conditional for GHC 9.4

* GHC 9.4 buildable by disabling a few suggest.. functions

* enable disabled suggest...!

* hls-fourmolu-plugin is buildable

* hls-splice-plugin is buildable

* hls-hlint-plugin is buildable

* Enable plugins on GHC 9.4

* Add fourmolu for GHC 9.4

* fourmolu tweawk

* Fix `hls-hlint-plugin` build

- Build against GHC 9.4 API
- Increase upper bound on `hlint`

* Fix build of `hls-splice-plugin`

* annotation on close parenthesis. still need more work.

* found where closing parenthesis were missing

* examine internal annotation information.

* make use of makeDeltaAst. This fixes most of test failures in GHC 9.4

* remove dead code

* update apply-refact and hlint deps

* temporarily comment out hls-fourmolu-plugin.

* comment out build-tool-depends. then hls-fourmolu-plugin build succeeds with cabal v2-build

* remove unused fourmolu flake inputs

* fix ghc 9.0 build again.

* hlint and fourmolu for GHC 9.2!

* fix mistakenly overriden nix exp.

* remove unused hlint-3.3.6

* Fix CPP in hls-refactor-plugin

* Fix build error in hls-refactor-plugin

* Fix import

* Use `showErrors` instead of `showBag`

* fix initialization test error in refactor plugin.

* alternateNumberFormat and explicitFixity don't build on GHC 9.4

* force demoteIfDefer = id in typecheckModule for GHC 9.4.

* ignore tests which were already ignored with GHC 9.2

* fix extractDoesNotExportModuleName for GHC 9.4 by adjusting regex match

* use makeDeltaAst in removeRedundantConstraints

* fix addTypeAnnotationsToLiteralsTest

* Revert "alternateNumberFormat and explicitFixity don't build on GHC 9.4"

This reverts commit 4903092.

* Update flake lockfile

* Use upstream `retrie`

* Use upstream `retrie`

* Update lockfile

* Use upstream fourmolu

* fix arrow annotation on ghc 9.4

* fix flake.nix issue

* revert demoteIfDefer change for GHC 9.4.

* fix hls-splice-plugin build on GHC 9.0.2

* disable tracy on darwin.

* disable fourmolu plugin and ekg-json for now.

* fourmolu update to 0.10.1.0

* build fix for hls-refactor-plugin after merge

* update index-state.

* downgrade fourmolu to 0.9 for ghc 9.2 and 9.0

* remove unnecessary problematic Cabal-syntax dependency.

* update Cabal for ormolu in ghc 9.0 nix env.

* use custom apply-refact for now for both ghc 9.2 and 9.4

* added ghc >= 9.2 condition

* fix fourmolu with -f-fixity-th in nix env

* limit implicit-hie < 0.1.3

* add fourmolu back to build-tools-depends

* mark GHC92-failing tests to be failed on GHC 9.4

* ci failure test

* bump nix file.

* disable cachix action

* further comment out

* revive cachix action.

* remove commented-out

* fix hls-cabal-plugin by removing Cabal-syntax.
note that this is an opposite to #3383, to prioritize CI fix first.

* limit implicit-hie < 0.1.3

* added a small comment and link to the issue.

* put implicit-hie to ghcide dep

* update apply-refact rev

* use apply-refact-0.11.0.0 on hackage.

* 9.4 support for gadt and retrie plugins

Co-authored-by: Ian-Woo Kim <ianwookim@gmail.com>
Co-authored-by: Gabriella Gonzalez <gabriella@mercury.com>
Co-authored-by: Zubin Duggal <zubin.duggal@gmail.com>
@cydparser
Copy link
Contributor Author

Cabal-syntax is no longer a dependency: f5db150#diff-5e8d34349db491632161012cabc6a29aa032853e30534abb7e36d9462a0b1df2L48

@cydparser cydparser closed this Jan 4, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants