Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stack_snapshot usable from another's module extension #1906

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

ylecornec
Copy link
Member

Depends on #1905

This PR makes the stack_snapshot repository rule usable from a non_module_dep extension of another module than rules_haskell (such as rules_haskell_tests).

These changes are needed because with bzlmod, when stack_snapshot is called by an extension of another module, rules_haskell does not have visibility of generated repositories (such as rules_haskell_stack) and cannot build labels to its targets using the Label constructor.

  • To work around this, an optional label_builder parameter can be passed to stack_snapshot, which can be used to build labels from the context of the caller modules extension and obtain their canonical names. Once we provide our own module extension to install stackage packages (Add a module extension for Stackage packages #1899), this label_builder parameter should not be necessary anymore.

  • For the same reason, the stack_update attribute to _stack_snapshot is now always present (so we do not have to hardcode its label), and is made into a string so that we only fetch the stack_update repository when explicitly reading from it.

@ylecornec ylecornec force-pushed the ylecornec/stack_snapshot_other_module branch from 9c321ce to e868628 Compare June 9, 2023 08:10
@ylecornec ylecornec marked this pull request as ready for review June 9, 2023 08:12
@ylecornec ylecornec requested a review from avdv as a code owner June 9, 2023 08:12
@ylecornec ylecornec force-pushed the ylecornec/pre_bzlmod_refactoring branch from f5d8e9f to 8988b52 Compare June 9, 2023 16:26
@ylecornec ylecornec force-pushed the ylecornec/stack_snapshot_other_module branch from e868628 to b4ad151 Compare June 9, 2023 16:27
Base automatically changed from ylecornec/pre_bzlmod_refactoring to master June 12, 2023 12:30
@dpulls
Copy link

dpulls bot commented Jun 12, 2023

🎉 All dependencies have been resolved !

With bzlmod, when using `stack_snapshot` in a module extension of another module,
rules_haskell does not have visibility of generated repositories (such as `rules_haskell_stack`) and cannot build labels to its targets using the `Label` constructor.

To work around this, an optional `label_builder` parameter can be passed to `stack_snapshot`, which is then used to canonicalize various labels.
For the same reason, the `stack_update` attribute to `_stack_snapshot` is now always present (so we do not have to hardcode its label), and is made into a string so that we only fetch the `stack_update` repository when explicitly reading from it.
@ylecornec ylecornec force-pushed the ylecornec/stack_snapshot_other_module branch from b4ad151 to 2b13e62 Compare June 12, 2023 12:31
Copy link
Member

@avdv avdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@ylecornec ylecornec added the merge-queue merge on green CI label Jun 13, 2023
@mergify mergify bot merged commit 5395543 into master Jun 13, 2023
@mergify mergify bot deleted the ylecornec/stack_snapshot_other_module branch June 13, 2023 13:01
@mergify mergify bot removed the merge-queue merge on green CI label Jun 13, 2023
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