Skip to content

bazel-runfiles package doesn’t return results correctly when invoked from Template Haskell #1337

Description

@patrickt

Describe the bug
I’m trying to build some source that accesses filesystem locations and generates code based on these files. (Gnarly, I know.) I ran into #1246, which interfered with our approach up until now (using cabal’s data-files), so I thought I’d try the haskell_library function’s data field, accessing the paths with the bazel-runfiles package. Unfortunately, though this works inside REPLs and executables, it doesn’t appear to work from Template Haskell splices. The call to getExecutableName here returns the path to the relevant ghc executable, which interferes when lookup up runfiles and their manifests.

To Reproduce
Call Runfiles.rlocation from a Template Haskell splice and observe the resulting error message.

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS name + version: macOS catalina
  • Bazel version: 3.10
  • Version of the rules: 0.12

Additional context
I’m probably going to work around this with file-embed for the time being, but I figured I’d file it for posterity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions