This turned out to be quite involved but save for this huge commit it's
actually quite awesome and squashes quite a few bugs and nasty
problems (hopefully). Most importantly we now have native cabal
component support without the user having to do anything to get it!
To do this we traverse imports starting from each component's
entrypoints (library modules or Main source file for executables) and
use this information to find which component's options each module will
build with. Under the assumption that these modules have to build with
every component they're used in we can now just pick one.
Quite a few internal assumptions have been invalidated by this
change. Most importantly the runGhcModT* family of cuntions now change
the current working directory to `cradleRootDir`.
The problem the reverted commit tried to fix seems to have been just a
symptom of another root cause that was later fixed as the problem does
not seem to occur anymore even without this changeset also this
changeset broke cabal sandboxes with ghc < 7.8.
Fix#262
This reverts commit 8741323f5b.
Conflicts:
Language/Haskell/GhcMod/GhcPkg.hs
- 'GhcPkg' now parses 'ghc-pkg -v list' output directly to also get the
package-id
- Remove unused field 'cradlePackages' in Cradle
- Remove 'getPackageDbPackages' and use 'ghcPkgListEx' instead
- cradle now stores a list of active package databases instead of only
the user store (if present).
- rename `cradlePackageDb` -> `cradlePkgDbStack` as that`s what the ghc
documentaion calls this kind of thing
- `getPackageDbPackages` now returns names of all visible packages in
the given directory. Also the implementation now uses `ghc-pkg`
instead of manually looking at the package database