-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add a new rule haskell_prebuilt_library
.
#337
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
haskell/private/dependencies.bzl
Outdated
static_libraries = acc.static_libraries, | ||
dynamic_libraries = acc.dynamic_libraries, | ||
interface_files = acc.interface_files, | ||
prebuilt_dependencies = set.insert(acc.prebuilt_dependencies, pkg), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use set.mutable_insert
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very nice point in the design space. Thanks for contributing it. I think it works better than having a separate prebuilt_dependencies
field.
haskell_prebuilt_library
has (pretty much) the same function as cc_import
in the cc_*
rules world. Would it make sense to name it haskell_import_library
? prebuilt_dependencies
will soon become deprecated anyways, so we don't need to worry about being consistent with that.
haskell/haskell.bzl
Outdated
Example: | ||
```bzl | ||
haskell_prebuilt_library( | ||
name = "base_pkg", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be typo in this example, since you name the target "base_pkg"
by the rule below depends on ":base"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
haskell/haskell.bzl
Outdated
haskell_prebuilt_library = rule( | ||
_haskell_prebuilt_library, | ||
attrs = dict( | ||
package = attr.string(doc = "A non-Bazel-supplied GHC package name."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good for the package
to have name
as the default value. In fact, could name
alone be sufficient? The list of allowed characters in a package is a subset of the legal target names. Although people might want to import ghc-prim
as ghc_prim
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion; I've set it default to name. (I agree that ghc-prim
vs ghc_prim
means we should keep the separate attribute as an option.)
The CI failures seem to be due to a (transient?) bug in the CircleCI infrastructure. |
Renamed to |
Uses the functionality from tweag/rules_haskell#337. Hazel now generates repository rules for "core" GHC packages like `base` and `bytestring`. Thus, rules that uses Hazel shouldn't need to specify the `prebuilt_dependencies` attribute anymore. Also change all references to "prebuilt" to "core packages", to match the terminology in stack build plans.
This rule forwards a prebuilt dependency, so that it may be specified directly in `deps` rather than `prebuilt_dependencies`. This gives progress on #75. Similarly, it simplifies the use of Hazel, which can now generate repositories for the prebuilt dependencies just like for regular packages.
@judah FYI I know I proposed |
Uses the functionality from tweag/rules_haskell#337. Hazel now generates repository rules for "core" GHC packages like `base` and `bytestring`. Thus, rules that uses Hazel shouldn't need to specify the `prebuilt_dependencies` attribute anymore. Also change all references to "prebuilt" to "core packages", to match the terminology in stack build plans.
This rule forwards a prebuilt dependency, so that it may be
specified directly in
deps
rather thanprebuilt_dependencies
.This gives progress on #75. Similarly, it simplifies the use of Hazel,
which can now generate repositories for the prebuilt dependencies
just like for regular packages.
Relevant Hazel change that would depend on this one: FormationAI/hazel@143d8f7#diff-c40927b6657800717d4b0b498e1bad55
Let me know what you think of this change. I'm open to modifying the API/names.