Skip to content

Commit

Permalink
cabal.bzl: Use to_json() to serialize package list.
Browse files Browse the repository at this point in the history
  • Loading branch information
mboes committed May 23, 2019
1 parent 7912560 commit 3305999
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions haskell/cabal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,7 @@ def _compute_dependency_graph(repository_ctx, versioned_packages, unversioned_pa
_execute_or_fail_loudly(repository_ctx, stack + ["unpack"] + unversioned_packages)
exec_result = _execute_or_fail_loudly(repository_ctx, ["ls"])
unpacked_sdists = exec_result.stdout.splitlines()
stack_yaml_content = "\n".join(["resolver: none", "packages:"]) + "\n" + "\n".join([
"- {}".format(dir)
for dir in unpacked_sdists
])
stack_yaml_content = struct(resolver = "none", packages = unpacked_sdists).to_json()
repository_ctx.file("stack.yaml", content = stack_yaml_content, executable = False)
exec_result = _execute_or_fail_loudly(
repository_ctx,
Expand All @@ -336,10 +333,7 @@ def _compute_dependency_graph(repository_ctx, versioned_packages, unversioned_pa
if unpacked_sdist not in unpacked_sdists
],
)
stack_yaml_content = "\n".join(["resolver: none", "packages:"]) + "\n" + "\n".join([
"- {}".format(dir)
for dir in transitive_unpacked_sdists
])
stack_yaml_content = struct(resolver = "none", packages = transitive_unpacked_sdists).to_json()
repository_ctx.file("stack.yaml", stack_yaml_content, executable = False)

# Compute dependency graph.
Expand Down

0 comments on commit 3305999

Please sign in to comment.