Open hasufell opened 5 years ago
Since the file /home/maerwald/git/hpath/dist-newstyle/setup-config
doesn't exist, then it is possible that the package hpath
was not built. The package should be built (using cabal
or stack
) before indexing (i.e., cabal new-build
,cabal build
, or stack build
command should be executed).
Sorry, I should have added that to the README (I will update the README soon).
The package was definitely built.
Oh, now I see, I've provided an incorrect example in the README. dist
directory (where setup-config
file is saved) for cabal new-build
should be not just dist-newstyle
, but something like dist-newstyle/build/x86_64-linux/ghc-8.2.2/hpath-0.9.2
.
Can you try to find a directory with setup-config
file manually? I'm not sure if there is a cabal command that returns relative path to a dist
directory (like stack path --dist-dir
).
Yes, that seems to work, but as expected... cabal-helper fails with random errors. It's a plague, really.
Can you show the output of haskell-code-indexer
with --verbose
option?
Registering library for Cabal-2.2.0.0..
done
[1 of 4] Compiling CabalHelper.Shared.Common ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Common.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Common.o )
[2 of 4] Compiling CabalHelper.Shared.InterfaceTypes ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/InterfaceTypes.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/InterfaceTypes.o )
[3 of 4] Compiling CabalHelper.Shared.Sandbox ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Sandbox.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Shared/Sandbox.o )
[4 of 4] Compiling Main ( /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Runtime/Main.hs, /home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/Main.o )
/home/maerwald/.cache/cabal-helper/cabal-helper0.8.0.2-Cabal2.2.0.0.build/CabalHelper/Runtime/Main.hs:47:1: error:
Could not find module ‘Distribution.PackageDescription.Parse’
Perhaps you meant
Distribution.PackageDescription.Parsec (from Cabal-2.2.0.0)
Distribution.PackageDescription.Check (from Cabal-2.2.0.0)
Distribution.PackageDescription.Quirks (from Cabal-2.2.0.0)
Use -v to see a list of the files searched for.
|
47 | import Distribution.PackageDescription.Parse
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
cabal-helper-0.8.0.2
that is used by haskell-code-indexer
supports only Cabal >=1.14 && <1.26 || ==2.0.*
I should update the cabal-helper
package
I'm having precisely this same issue. Would be great if you could add support!
cabal-helper
is a terrible hack. It really just adds more fragility to the tooling ecosystem.
Of course, compiling and linking cabal-helper
executable at runtime is an additional point of failure. Is there a simpler way to get build information (https://www.haskell.org/cabal/release/latest/doc/API/Cabal/Distribution-Simple-LocalBuildInfo.html)? The problem is that a format of setup-config
file depends on a version of Cabal
library.
I've hit this. It's trying to pick up MyProjectFoo/bar/dist/setup-config when the path should instead be:
$ cd MyProjectFoo/bar
$ ls
bar.cabal src
$ stack path --dist-dir
.stack-work/dist/x86_64-linux/Cabal-2.0.1.0
(It did work for me for the top level project which lives at MyProjectFoo/
)
Is there a workaround for this?
To answer my own question, this appears to work:
stack exec --no-ghc-package-path haskell-code-indexer -- -p . --dist $(stack path --dist-dir)
When there is no --dist
option, haskell-code-indexer
tries to find the 'dist' directory: https://haskell-code-explorer.mfix.io/package/haskell-code-explorer-0.1.0.0/show/src/HaskellCodeExplorer/PackageInfo.hs#L315
The logic is as follows: if the package directory contains stack.yaml
file, haskell-code-indexer
executes stack path --dist-dir
command to get the 'dist' directory, otherwise it tries to use the default 'dist' directory dist
.
So in my situation there is a MyProjectFoo/stack.yaml
but no MyProjectFoo/bar/stack.yaml
; the dist directory for bar
is at MyProjectFoo/bar/.stack-work/dist/x86_64-linux/Cabal-2.0.1.0
. Should the indexer check upper directories for a stack.yaml
and if it finds one fall back to running stack path --dist-dir
in the CWD?
I don't see how this is related to the original issue, which was about using cabal.
Apologies, I've filed a separate issue for that https://github.com/alexwl/haskell-code-explorer/issues/13.
I have no idea why it's trying to get into
.stack-work
directory of my package. I don't use stack for that package and told it to usedist-newstyle
.