Skip to content

Commit

Permalink
Introduce use_same_package_name
Browse files Browse the repository at this point in the history
to use the specified name as GHC package name.

In some special cases (especially GHC boot libraries), the package name
needs to be given as specified.
  • Loading branch information
wavewave committed Sep 24, 2024
1 parent ba2c53a commit 3983076
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions decls/haskell_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ haskell_library = prelude_rule(
"linker_flags": attrs.list(attrs.arg(), default = []),
"platform": attrs.option(attrs.string(), default = None),
"platform_linker_flags": attrs.list(attrs.tuple(attrs.regex(), attrs.list(attrs.arg())), default = []),
"use_same_package_name": attrs.bool(default = False),
}
),
)
Expand Down
8 changes: 6 additions & 2 deletions haskell/haskell.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,12 @@ def haskell_library_impl(ctx: AnalysisContext) -> list[Provider]:
indexing_tsets = {}
sub_targets = {}

libname = repr(ctx.label.path).replace("//", "_").replace("/", "_") + "_" + ctx.label.name
pkgname = libname.replace("_", "-")
if(ctx.attrs.use_same_package_name):
libname = ctx.label.name
pkgname = libname
else:
libname = repr(ctx.label.path).replace("//", "_").replace("/", "_") + "_" + ctx.label.name
pkgname = libname.replace("_", "-")

md_file = target_metadata(
ctx,
Expand Down

0 comments on commit 3983076

Please sign in to comment.