haskell / hie-bios

Set up a GHC API session for various Haskell Projects
https://hackage.haskell.org/package/hie-bios
BSD 3-Clause "New" or "Revised" License
179 stars 62 forks source link

hie-bios can't load packages with build-tool-depends #187

Open maksbotan opened 4 years ago

maksbotan commented 4 years ago

Hi,

I try to use haskell-ide-engine with this project: https://gitlab.com/morley-framework/morley

My hie.yaml:

cradle:
    cabal:
        - path: "code/morley"
          component: "lib:morley"
        - path: "code/morley/test"
          component: "morley:morley-test"

When I try to load tests in hie:

$ hie code/morley/test/Test/Michelson/Runtime.hs 
...
Dumping diagnostics:

/home/maks/Projects/SRK/morley/code/morley/test/Test/Michelson/Runtime.hs: FAILED
    "could not execute: tasty-discover"

This is probably related to the fact that tasty-discover is used as build-tool-depends in the cabal file:

test-suite morley-test
  build-tool-depends:
      tasty-discover:tasty-discover

For some reason hie does not see it, while cabal new-build morley --enable-test passes.

Env:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
$ hie --version
Version 1.4 x86_64 ghc-8.8.3
$ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library 

HIE commit haskell/haskell-ide-engine@51b9739510b0ec013ff7c9959a67ac2d506838d5, built with hie-bios-0.5.0:

            "id": "hie-bios-0.5.0-6bd5e18e4c0ad98baf912355907c1f817c9dc3d30f0b5a44dde99fc8fd608f07",
            "pkg-name": "hie-bios",
            "pkg-version": "0.5.0",
            "flags": {},
            "style": "global",
            "pkg-src": {
                "type": "repo-tar",
                "repo": {
                    "type": "secure-repo",
                    "uri": "http://hackage.haskell.org/"
                }
            },
ndmitchell commented 4 years ago

I think this might be related to https://github.com/mpickering/hie-bios/issues/125

maksbotan commented 4 years ago

Maybe it is, however I'm using pure Cabal cradle. Maybe they share some code in this regard...

jneira commented 4 years ago

Just in case, a temporary workaround could be install tasty-discover globally.

maksbotan commented 4 years ago

Sure, that's what I did :)

georgefst commented 4 years ago

FWIW, the title here isn't quite true in general since I'm happily using HLS on a project involving c2hs. I suspect the difference there is that the build tool is only ever run on .chs files, which hie-bios ignores completely.

(This does mean that I need to manually kick c2hs, via cabal, when I change a .chs file, in order for the changes to show up in my editor, but I'd expect nothing less right now.)