Skip to content

gazelle-update-repos should avoid adding duplicates to stack_snapshot packages #46

@kczulko

Description

@kczulko

Describe the bug

gazelle-update-repos can generate duplicates within stack_snapshot::packages when one of the packages has "strict" versioning.

To Reproduce

  1. Add a "strict versioned" dependency to stack_snapshot::packages list, e.g.
stack_snapshot(
  packages = [
    ...
    "wai-make-assets-0.2", # keep
    ...
  ],
)
  1. If gazelle_cabal generated haskell_library contain following entry:
haskell_library(
  deps = [
    ...
    "@stackage//:wai-make-assets",
    ...
  ],
)

...
3. ..., then running :gazelle-update-repos will generate duplicates within stack_snapshot::deps

stack_snapshot(
  packages = [
    ...
    "wai-make-assets",
    "wai-make-assets-0.2", # keep
    ...
  ],
)

It doesn't cause failures for bazel since rules_haskell unify names and allows for a duplicates (but which shouldn't happened as confirmed with @aherrmann - defect is pending and will be added here).

Expected behavior
gazelle-update-repos should try to avoid generating duplicates while updating packages list of the stack repository when one of the packages has #keep comment. Maybe gazelle_cabal should produce additional warning about such case.

Environment

  • OS name + version: Nixos 22.05.2351.e4c9d950a3c
  • Version of the code:
gazelle_cabal_version = "34a41345973cdffa29bf4d5d349439e86fc30ed3"
rules_haskell_version = "rules_haskell-0.14"

Additional context
Observed while converting example-servant-elm to bazel. There are two places from which those dependencies come:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions