Skip to content

stack_snapshot: vendored_packages - #1060

Merged
mergify[bot] merged 5 commits into
masterfrom
ah-vendored-packages
Sep 8, 2019
Merged

stack_snapshot: vendored_packages#1060
mergify[bot] merged 5 commits into
masterfrom
ah-vendored-packages

Conversation

@aherrmann

Copy link
Copy Markdown
Contributor

This is based on #910 but based on latest master and adds a few more features.

  • Adds the vendored_packages attribute to stack_snapshot in the same form as [WIP] Implement stack_snapshot.vendored_packages #910. To be used as
    stack_snapshot(
        name = "stackage",
        ...
        vendored_packages = {"split": "@split//:split"},
    )
    
  • Injects the vendored packages into stack's dependency resolution.
    In [WIP] Implement stack_snapshot.vendored_packages #910 stack would still look at the non-vendored unpacked version of e.g. split in the above example. That means that if the vendored version changes the dependency graph, then stack would not pick up this change. Here stack will be pointed to the vendored package instead.
  • Exports the dependency graph in generated packages.bzl.
    This allows to load the dependencies of a vendored package from that file, instead of having to hard-code it manually.
  • Adds a use-case of vendored packages to the examples repository.

Closes #910

mboes and others added 4 commits August 27, 2019 14:55
This feature allows overriding packages in the snapshot with targets
defined manually. Useful when the source distribution needs to be
patched, or when the `BUILD` file needs to be customized.
Before vendored packages were only used when generating the `BUILD` file
to override `deps` attribute to `haskell_cabal_library`. However, this
did not affect stack's dependency graph generation. A vendored package
could have a different Cabal file introducing different package
dependencies. Furthermore, the generated target for a vendored package
would still point to the unvendored original version.

This change takes this into account, by pointing stack to the source
directories of the vendored packages. It also changes the generated
targets to be aliases to the vendored target.

This requires the vendored target to contain a Cabal file at the
top-level which is not a generated file.
Exports the stack generated dependency graph, so that Starlark code can
import and use this information. E.g. a vendored package could import
the dependency graph into the BUILD file and use it to define the
package dependencies instead of manually hard-coding them.
Adds an example usage of vendored_packages to bump cabal version bounds.
@aherrmann
aherrmann requested a review from mboes August 27, 2019 13:36
@mboes mboes added the merge-queue merge on green CI label Sep 8, 2019
@mergify
mergify Bot merged commit c557239 into master Sep 8, 2019
@mergify
mergify Bot deleted the ah-vendored-packages branch September 8, 2019 20:09
@mergify mergify Bot removed the merge-queue merge on green CI label Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants