-
Notifications
You must be signed in to change notification settings - Fork 80
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
Simplify and rationalize provider model #852
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.
Great cleanup.
haskell/cc.bzl
Outdated
@@ -312,8 +305,8 @@ cc_haskell_import = rule( | |||
attrs = { | |||
"dep": attr.label( | |||
doc = """ | |||
Target providing a `HaskellLibraryInfo` or `HaskellBinaryInfo`, such as | |||
`haskell_library` or `haskell_binary`. | |||
Target providing a `HaskellLiInfo` such as `haskell_library` or |
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.
HaskellLiInfo
6a34786
to
bcfbc9c
Compare
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.
Nice! Looks much better.
Also checked that it doesn't break our use-site.
@aherrmann this branch interacts badly with #847 in ways that I don't understand. Could you have a look? |
@mboes Sure, I'll have a look. |
bcfbc9c
to
a5826f1
Compare
I've rebased this PR on master. I had to change the version macros generation because it was relying on the headers attribute of the HaskellLibrary provider. See commit message for details. |
We will in future commits merge `HaskellBinaryInfo` and `HaskellLibrary` into `HaskellBuildInfo`, which at that point will become the one-stop shop generic provider for Haskell, much like `JavaInfo` and `CcInfo`. So it makes sense to follow the same naming scheme.
They are not read by the compiler, only the .cache files are.
We rename package_caches to package_databases. Cache files are an implementation detail.
import_dirs are common to HaskellLibraryInfo and HaskellBinary. Move it up to HaskellInfo.
This field was common to HaskellLibraryInfo and HaskellBinaryInfo.
Only `haskell_library` returned `CcInfo` previously. Now `haskell_binary` and `haskell_protobuf_library` do so too - at least by forwarding the CcInfos that were given to them.
As a side effect of this, we no longer export headers, which by default should be considered private. There is no mechanism to export headers now, though we could add a `hdrs` attribute like `cc_library` has.
…lags internally This is to be consistent with cc_common API.
It has no fields by now, so conveys no useful information.
Before, the version_macros header file was forwarded in the HaskellLibrary.header_files attribute, which contained the cc_interop_info.hdrs attribute, which contained the version_macros header. HaskellLibrary.header_files was effectively replaced by CcInfo. However, CcInfo tracks the full transitive closure of dependencies, whereas we only want to include the version_macros header files of direct dependencies. (Some packages treat the presence of version macros as indication that the package is a direct dependency. This can cause missing module errors). This commit changes the handling of version macro headers to not forward them in cc_interop_info, but instead explicitly collect them for the preprocessors c2hs and hsc2hs which require them. It also only forwards those headers if the target itself defines the version attribute.
a5826f1
to
d707d50
Compare
Depends on #844.
We used to have the following main providers:
HaskellBuildInfo
exposing information common to both binaries andlibraries,
HaskellBinaryInfo
exposing information specific to binaries,HaskellLibraryInfo
exposing information specific to libraries.We now have:
HaskellInfo
, a generic provider returned by all core Haskellrules.
HaskellLibraryInfo
, returned only byhaskell_library
.Most of the provider attributes are now in
HaskellInfo
(thoughseveral have been removed entirely). A library is something that
additionally has an identifier and a version number, that's it.
It's best to review this commit by commit, but for each commit, first
look at the changes in
haskell/providers.bzl
. All other changes inthe commit are a direct consequence of any changes in that first file.