Skip to content

Commit 3357036

Browse files
committed
Skip import-dirs for empty libraries
Otherwise Windows builds can fail with a missing directory error on the `_iface` directory of empty libraries such as mtl-compat.
1 parent 4169f8a commit 3357036

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

haskell/private/actions/package.bzl

Lines changed: 3 additions & 1 deletion
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,6 +66,7 @@ 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.
69+
has_iface: Whether the import-dirs field should be populated.
6870
empty_libs_dir: Directory name where the empty library should be.
6971
If empty, this is assumed to be a package description
7072
for a real library. See Note [Empty Libraries] in haskell_impl.bzl.
@@ -98,7 +100,7 @@ def package(
98100
"key": pkg_id.to_string(my_pkg_id),
99101
"exposed": "True",
100102
"hidden-modules": other_modules,
101-
"import-dirs": [import_dir],
103+
"import-dirs": [import_dir] if has_iface else [],
102104
"library-dirs": [pkgroot_lib_path] + extra_lib_dirs,
103105
"dynamic-library-dirs": [pkgroot_lib_path] + extra_dynamic_lib_dirs,
104106
"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)