tweag / rules_haskell

Haskell rules for Bazel.
https://haskell.build
Apache License 2.0
266 stars 80 forks source link

Missing package error of stack_snapshot is pretty horrible #985

Closed aspiwack closed 5 years ago

aspiwack commented 5 years ago

I wrote the name of a package in the packages list of stackage_server wrong. The error message was really unhelpful. It consists of several copies (the copies may be subtly different, I don't know) of

ERROR: Analysis of target '//backend/api-types:api-types' failed; build aborted: no such package '@stackage//': Traceback (most recent call last):
    File "/home/aspiwack/.cache/bazel/_bazel_aspiwack/bd7cdf0b0195cd3d7f8d5aa71bc1df4e/external/io_tweag_rules_haskell/haskell/cabal.bzl", line 556
        _compute_dependency_graph(repository_ctx, versioned_packages, ...)
    File "/home/aspiwack/.cache/bazel/_bazel_aspiwack/bd7cdf0b0195cd3d7f8d5aa71bc1df4e/external/io_tweag_rules_haskell/haskell/cabal.bzl", line 491, in _compute_dependency_graph
        _execute_or_fail_loudly(repository_ctx, ((stack + ["unpack...))
    File "/home/aspiwack/.cache/bazel/_bazel_aspiwack/bd7cdf0b0195cd3d7f8d5aa71bc1df4e/external/io_tweag_rules_haskell/haskell/cabal.bzl", line 20, in _execute_or_fail_loudly
        fail("\n".join([("Command failed: " +...]))
    File "/home/aspiwack/.cache/bazel/_bazel_aspiwack/bd7cdf0b0195cd3d7f8d5aa71bc1df4e/external/io_tweag_rules_haskell/haskell/cabal.bzl", line 20, in fail
        "\n".join([("Command failed: " + " ".join(...])
    File "/home/aspiwack/.cache/bazel/_bazel_aspiwack/bd7cdf0b0195cd3d7f8d5aa71bc1df4e/external/io_tweag_rules_haskell/haskell/cabal.bzl", line 20, in "\n".join
        " ".join(arguments)
sequence element must be a string (got 'path'). See https://github.com/bazelbuild/bazel/issues/7802 for information about --incompatible_string_join_requires_strings.

Notice how:

Instead we should find a way to produce an error aimed at the user, not the developer, which:

To Reproduce

Make a workspace with a non-existing package in the package set. For instance:

stack_snapshot(
    name = "stackage",
    packages = [
        "no-package-here",
    ],
    snapshot = "lts-13.15",
)

Environment

mboes commented 5 years ago

This is a Bazel v0.27 migration issue. They tightened up the allowed types in a join().

Profpatsch commented 5 years ago

Closing, because we migrated a while ago.