Skip to content

Commit 9164910

Browse files
authored
Merge pull request #2311 from tweag/has-ifaces
Skip import-dirs for empty libraries
2 parents 3322610 + ce37cf4 commit 9164910

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

haskell/private/actions/package.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def package(
5252
other_modules,
5353
my_pkg_id,
5454
has_hs_library,
55+
has_iface = True,
5556
empty_libs_dir = ""):
5657
"""Create GHC package using ghc-pkg.
5758
@@ -65,9 +66,9 @@ def package(
6566
other_modules: List of hidden modules.
6667
my_pkg_id: Package id object for this package.
6768
has_hs_library: Whether hs-libraries should be created.
68-
empty_libs_dir: Directory name where the empty library should be.
69-
If empty, this is assumed to be a package description
70-
for a real library. See Note [Empty Libraries] in haskell_impl.bzl.
69+
has_iface: Whether the import-dirs field should be populated.
70+
empty_libs_dir: Directory name where the empty library should be.
71+
If empty, this is assumed to be a package description for a real library. See Note [Empty Libraries] in haskell_impl.bzl.
7172
7273
Returns:
7374
(File, File): GHC package conf file, GHC package cache file
@@ -98,7 +99,7 @@ def package(
9899
"key": pkg_id.to_string(my_pkg_id),
99100
"exposed": "True",
100101
"hidden-modules": other_modules,
101-
"import-dirs": [import_dir],
102+
"import-dirs": [import_dir] if has_iface else [],
102103
"library-dirs": [pkgroot_lib_path] + extra_lib_dirs,
103104
"dynamic-library-dirs": [pkgroot_lib_path] + extra_dynamic_lib_dirs,
104105
"extra-libraries": extra_libs,

haskell/private/haskell_impl.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ def haskell_library_impl(ctx):
544544
other_modules,
545545
my_pkg_id,
546546
non_empty,
547+
has_iface = non_empty,
547548
)
548549

549550
empty_libs_dir = "empty_libs"
@@ -557,6 +558,7 @@ def haskell_library_impl(ctx):
557558
other_modules,
558559
my_pkg_id,
559560
has_hs_library = False,
561+
has_iface = non_empty,
560562
empty_libs_dir = empty_libs_dir,
561563
)
562564

0 commit comments

Comments
 (0)