rules_haskell icon indicating copy to clipboard operation
rules_haskell copied to clipboard

Handle location expansion in compiler flags in haskell_repl

Open aherrmann opened this issue 3 years ago • 1 comments

Replaces #1581

Haskell rules support location expansion (e.g. $(execpath ...)) in ghcopts and similar attributes. The resulting paths may not be valid in the source repository, but only in the execroot. E.g. location expansion on source files in external repositories will yield paths starting with external/... that are invalid in the source repository.

The GHCi wrapper generated by haskell_repl changes into the source repository before invoking GHCi, so that source changes are visible as expected and paths to files in the repository work as expected from within the REPL session. The generated GHCi wrapper defines the env-var RULES_HASKELL_EXEC_ROOT to be set as a path-prefix. This prefix does not currently apply to paths resulting from location expansion in user provided compiler flags.

haskell_repl should be extended to add this env-var prefix to paths resulting from location expansion in user provided compiler flags.

aherrmann avatar Aug 18 '21 09:08 aherrmann

I'm not sure that would be related or not but while trying to get haskell-language-server to work on out project, i tried to get bazel not to generate symlinks in the project repository as they seemed to be interfering. In order to do so i used the following https://github.com/aveltras/rules_haskell/commit/5ff836f3267a8e785ac8c25e27eafc3b1c33ec6f (bazel info output_path) which resolves to some directory that would get symlinked to from the project repo. It might be nice to not depend on the presence of symlinks at all.

aveltras avatar Aug 30 '21 10:08 aveltras