Skip to content

Commit

Permalink
specify provides for binary/library rules
Browse files Browse the repository at this point in the history
Adds a `provides` field to haskell_library and haskell_binary to tell
users about our custom providers (and possibly throw better error
messages).

As a related change, the `load` targets for `providers.bzl` are made
absolute to work around
bazelbuild/bazel#3115
  • Loading branch information
Profpatsch committed Nov 22, 2018
1 parent 9e363eb commit dd2f5f7
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion haskell/c2hs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ load(
"target_unique_name",
)
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"C2hsLibraryInfo",
)
load("@bazel_skylib//:lib.bzl", "paths")
Expand Down
2 changes: 1 addition & 1 deletion haskell/cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ These rules are temporary and will be deprecated in the future.
"""

load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"CcSkylarkApiProviderHacked",
"HaskellBinaryInfo",
"HaskellBuildInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/doctest.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Doctest support"""

load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaskellBinaryInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/haddock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load(":private/context.bzl", "haskell_context")
load(":private/path_utils.bzl", "module_name")
load(":private/set.bzl", "set")
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaddockInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
Expand Down
16 changes: 15 additions & 1 deletion haskell/haskell.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
"""Core Haskell rules"""

load(":private/providers.bzl", "HaskellPrebuiltPackageInfo")
load(
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaskellBinaryInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
"HaskellPrebuiltPackageInfo",
)
load(":private/set.bzl", "set")
load("@bazel_skylib//:lib.bzl", "paths")
load(
Expand Down Expand Up @@ -137,6 +143,10 @@ def _mk_binary_rule(**kwargs):
"@io_tweag_rules_haskell//haskell:toolchain",
"@bazel_tools//tools/cpp:toolchain_type",
],
provides = [
HaskellBuildInfo,
HaskellBinaryInfo,
],
**kwargs
)

Expand Down Expand Up @@ -202,6 +212,10 @@ haskell_library = rule(
"@io_tweag_rules_haskell//haskell:toolchain",
"@bazel_tools//tools/cpp:toolchain_type",
],
provides = [
HaskellBuildInfo,
HaskellLibraryInfo,
],
)
"""Build a library from Haskell source.
Expand Down
2 changes: 1 addition & 1 deletion haskell/import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
load(":private/context.bzl", "haskell_context")
load(":private/actions/package.bzl", "package")
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaddockInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/lint.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load(
"target_unique_name",
)
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaskellBinaryInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/actions/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load(
)
load(":private/pkg_id.bzl", "pkg_id")
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"C2hsLibraryInfo",
"DefaultCompileInfo",
)
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/actions/repl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ load(
"shell",
)
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaskellBinaryInfo",
"HaskellBuildInfo",
"HaskellLibraryInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/dependencies.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load(":private/path_utils.bzl", "ln")
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"CcSkylarkApiProviderHacked",
"HaskellBinaryInfo",
"HaskellBuildInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/haskell_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ load(
"ln",
)
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"C2hsLibraryInfo",
"HaskellBinaryInfo",
"HaskellBuildInfo",
Expand Down
2 changes: 1 addition & 1 deletion haskell/protobuf.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for protocol buffers"""

load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
"HaskellBuildInfo",
"HaskellLibraryInfo",
"HaskellProtobufInfo",
Expand Down

0 comments on commit dd2f5f7

Please sign in to comment.