Skip to content

Commit 6b3fdd2

Browse files
committed
Include package dbs of source loaded dependencies in unit files
Package dbs are one of the few things that need to be transitively included in a unit file. Fix the following case: There are two units A and B, and A depends on B. B depends on an external dependency C. In this case the unit file for A needs to include the package db for C. HLS and GHC will not pick up the package db indirectly through B's unit file. Fix this by passing a set of package-db-only HaskellReplDepInfo when merging.
1 parent c3dc0cf commit 6b3fdd2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

haskell/repl.bzl

+10-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def _merge_HaskellReplLoadInfoMulti(root_info, load_infos):
203203
java_deps = depset(transitive = java_deps),
204204
)
205205

206-
def _merge_HaskellReplDepInfo(dep_infos):
206+
def _merge_HaskellReplDepInfo(dep_infos, dep_infos_for_package_dbs = []):
207207
package_ids = depset()
208208
package_databases = depset()
209209
interface_dirs = depset()
@@ -219,6 +219,9 @@ def _merge_HaskellReplDepInfo(dep_infos):
219219
cc_infos.append(dep_info.cc_info)
220220
runfiles.append(dep_info.runfiles)
221221

222+
for dep_info in dep_infos_for_package_dbs:
223+
package_databases = depset(transitive = [package_databases, dep_info.package_databases])
224+
222225
return HaskellReplDepInfo(
223226
direct_package_ids = [],
224227
package_ids = package_ids,
@@ -409,7 +412,12 @@ def _create_HaskellMultiReplInfo(from_source, from_binary, collect_info):
409412
for label in deps_list
410413
if label in dep_infos and not sets.contains(local_labels, label)
411414
]
412-
merged_dep_info = _merge_HaskellReplDepInfo(dep_infos_to_merge)
415+
dep_infos_for_package_dbs = [
416+
dep_infos[label]
417+
for label in deps_list
418+
if label in dep_infos and sets.contains(local_labels, label)
419+
]
420+
merged_dep_info = _merge_HaskellReplDepInfo(dep_infos_to_merge, dep_infos_for_package_dbs)
413421
if dep_info and not load_as_source:
414422
dep_info_with_self = _merge_HaskellReplDepInfo([dep_info, merged_dep_info])
415423
else:

0 commit comments

Comments
 (0)