Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

have haskell_repl output absolute paths or paths relative to a different folder than the workspace one #1432

Closed
teto opened this issue Sep 24, 2020 · 3 comments

Comments

@teto
Copy link
Contributor

teto commented Sep 24, 2020

Is your feature request related to a problem? Please describe.
This may be more of a bazel issue: I would like bazel to write paths relative to a different folder than the workspace root.

Specifically, calling

	bazel build "//hie_bios" \
	--output_groups=hie_bios \
	--experimental_show_artifacts \

defined by

load("@rules_haskell//haskell:defs.bzl", "haskell_repl")

# See https://api.haskell.build/haskell/defs.html#haskell_repl
haskell_repl(
    name = "hie_bios",
    collect_data = False,
    deps = {deps},
    experimental_from_source = {deps},
    # Required because we might depend on tests, and bazel only allows
    # 'testonly' targets to depend on tests
    testonly = True,
)

returns

-package-db
bazel-out/k8-fastbuild/bin/external/hackage/lrucaching-0.3.3/_install/lrucaching-0.3.3.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/haskell-lexer-1.1/_install/haskell-lexer-1.1.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/pretty-show-1.10/_install/pretty-show-1.10.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/unbounded-delays-0.1.1.0/_install/unbounded-delays-0.1.1.0.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/wcwidth-0.0.2/_install/wcwidth-0.0.2.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/tasty-1.2.3/_install/tasty-1.2.3.conf.d
-package-db
bazel-out/k8-fastbuild/bin/external/hackage/tasty-hunit-0.10.0.2/_install/tasty-hunit-0.10.0.2.conf.d
-pgma
bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/cc_wrapper-python
-pgmc
bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/cc_wrapper-python
-pgml
bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/cc_wrapper-python
-pgmP
bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/cc_wrapper-python -E -undef -traditional
-optc-fno-stack-protector
-fdiagnostics-color=always
-freduction-depth=0
-fwrite-ide-info
...

that I save in a module.flags file.

I would like to prefix the paths bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/ with ../.. for instance to get ../../bazel-out/k8-fastbuild/bin/external/rules_haskell/haskell/ instead. Or alternativatel absolute paths should work too.

Additional context
While trying to write a multicradle hie.yaml (see #1386), I realized that local hie.yaml files override the hie.yaml in the parent directory (haskell/hie-bios#250 (comment)). I liked the idea and went on with it so I have a:
BAZEL_WORKSPACE/subproject/hie.yaml that reads flags from BAZEL_WORKSPACE/module.flags . The problem is ghcide interprets paths from the hie.yaml directory so it looks for
BAZEL_WORKSPACE/subproject/bazel-out/k8-fastbuild/bin/external/hackage/lrucaching-0.3.3/_install/lrucaching-0.3.3.conf.d instead of BAZEL_WORKSPACE/bazel-out/k8-fastbuild/bin/external/hackage/lrucaching-0.3.3/_install/lrucaching-0.3.3.conf.d.
I've tried adding symlinks to bazel-out in BAZEL_WORKSPACE/subproject and itkinda fixed it, only to create infinite loops later that confuse both bazel and ghcide.

@teto teto changed the title change working directory of a haskell_repl/paths relative to a nested folder have haskell_repl output absolute paths or paths relative to a different folder than the workspace one Sep 24, 2020
@teto
Copy link
Contributor Author

teto commented Sep 24, 2020

btw I tried patching rules_haskell to get this behavior (just to try) and I could check my changes were taken into account but I couldn't see the output of my print statements in haskell/repl.bzl if you have any tip :)

@aherrmann
Copy link
Member

This was addressed in #1531. @teto feel free to re-open if you feel something is still missing.

@teto
Copy link
Contributor Author

teto commented Jun 22, 2021

thanks for everyone's work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants