Skip to content

Commit 125acf8

Browse files
authored
Merge pull request #352 from tweag/repls-depend-on-their-targets
Make REPLs not to depend on their targets
2 parents 2efb1e2 + 1fb3967 commit 125acf8

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

haskell/haskell.bzl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,6 @@ _haskell_common_attrs = {
6868
"prebuilt_dependencies": attr.string_list(
6969
doc = "Non-Bazel supplied Cabal dependencies.",
7070
),
71-
"repl_interpreted": attr.bool(
72-
default = True,
73-
doc = """
74-
Whether source files should be interpreted rather than compiled. This allows
75-
for e.g. reloading of sources on editing, but in this case we don't handle
76-
boot files and hsc processing.
77-
78-
For `haskell_binary` targets, `repl_interpreted` must be set to `True` for
79-
REPL to work.
80-
""",
81-
),
8271
"repl_ghci_args": attr.string_list(
8372
doc = "Arbitrary extra arguments to pass to GHCi. This extends `compiler_flags` and `repl_ghci_args` from the toolchain",
8473
),

haskell/private/actions/repl.bzl

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ def build_haskell_repl(
3030
compiler_flags,
3131
repl_ghci_args,
3232
build_info,
33-
target_files,
34-
interpreted,
3533
output,
3634
lib_info = None,
3735
bin_info = None):
@@ -46,10 +44,6 @@ def build_haskell_repl(
4644
bin_info: If we're building REPL for a binary target, pass
4745
HaskellBinaryInfo here, otherwise it should be None.
4846
49-
target_files: Output files of the target we're generating REPL for.
50-
These are passed so we can force their building on REPL
51-
building.
52-
5347
Returns:
5448
None.
5549
"""
@@ -59,13 +53,12 @@ def build_haskell_repl(
5953
for dep in set.to_list(build_info.prebuilt_dependencies):
6054
args += ["-package ", dep]
6155
for package in set.to_list(build_info.package_ids):
62-
if not (interpreted and lib_info != None and package == lib_info.package_id):
56+
if not (lib_info != None and package == lib_info.package_id):
6357
args += ["-package-id", package]
6458
for cache in set.to_list(build_info.package_caches):
6559
args += ["-package-db", cache.dirname]
6660

67-
# Specify import directory for library in interpreted mode.
68-
if interpreted and lib_info != None:
61+
if lib_info != None:
6962
for idir in set.to_list(lib_info.import_dirs):
7063
args += ["-i{0}".format(idir)]
7164

@@ -82,10 +75,9 @@ def build_haskell_repl(
8275

8376
add_modules = []
8477
if lib_info != None:
85-
# If we have a library, we put names of its exposed modules here but
86-
# only if we're in interpreted mode.
78+
# If we have a library, we put names of its exposed modules here.
8779
add_modules = set.to_list(
88-
lib_info.exposed_modules if interpreted else set.empty(),
80+
lib_info.exposed_modules,
8981
)
9082
elif bin_info != None:
9183
# Otherwise we put paths to module files, mostly because it also works
@@ -148,10 +140,5 @@ def build_haskell_repl(
148140
# hs.tools.ghci and ghci_script and the best way to do that is
149141
# to use hs.actions.run. That action, it turn must produce
150142
# a result, so using ln seems to be the only sane choice.
151-
extra_inputs = depset(
152-
transitive = [
153-
depset([hs.tools.ghci, ghci_repl_script, repl_file]),
154-
target_files,
155-
],
156-
)
143+
extra_inputs = depset([hs.tools.ghci, ghci_repl_script, repl_file])
157144
ln(hs, repl_file, output, extra_inputs)

haskell/private/haskell_impl.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ def haskell_binary_impl(ctx):
127127
compiler_flags = ctx.attr.compiler_flags,
128128
repl_ghci_args = ctx.attr.repl_ghci_args,
129129
output = ctx.outputs.repl,
130-
interpreted = ctx.attr.repl_interpreted,
131130
build_info = build_info,
132-
target_files = target_files,
133131
bin_info = bin_info,
134132
)
135133

@@ -294,9 +292,7 @@ def haskell_library_impl(ctx):
294292
repl_ghci_args = ctx.attr.repl_ghci_args,
295293
compiler_flags = ctx.attr.compiler_flags,
296294
output = ctx.outputs.repl,
297-
interpreted = ctx.attr.repl_interpreted,
298295
build_info = build_info,
299-
target_files = target_files,
300296
lib_info = lib_info,
301297
)
302298

0 commit comments

Comments
 (0)