Skip to content

Commit

Permalink
Only use GHC_VERSION if rules_haskell{,_test} is the root module
Browse files Browse the repository at this point in the history
module_ctx.modules only contains the modules that use the extension, if the
root module does not use it, the first module in that list is not the root module.

Fixes #1967
  • Loading branch information
avdv committed Sep 28, 2023
1 parent e31617d commit ccde8f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions extensions/ghc_version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ load(
)

def _ghc_default_version_impl(mctx):
root_module = mctx.modules[0].name
root_module = mctx.modules[0]

if root_module in ["rules_haskell", "rules_haskell_tests"]:
if root_module.is_root and root_module.name in ["rules_haskell", "rules_haskell_tests"]:
_ghc_version(name = "rules_haskell_ghc_version")
else:
_ghc_default_version(name = "rules_haskell_ghc_version")
Expand Down

0 comments on commit ccde8f7

Please sign in to comment.