From dd2f5f771a04feb703641e65d08766e482afe541 Mon Sep 17 00:00:00 2001 From: Philip Patsch Date: Thu, 22 Nov 2018 02:53:34 +0100 Subject: [PATCH] specify `provides` for binary/library rules 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 https://github.com/bazelbuild/bazel/issues/3115 --- haskell/c2hs.bzl | 2 +- haskell/cc.bzl | 2 +- haskell/doctest.bzl | 2 +- haskell/haddock.bzl | 2 +- haskell/haskell.bzl | 16 +++++++++++++++- haskell/import.bzl | 2 +- haskell/lint.bzl | 2 +- haskell/private/actions/compile.bzl | 2 +- haskell/private/actions/repl.bzl | 2 +- haskell/private/dependencies.bzl | 2 +- haskell/private/haskell_impl.bzl | 2 +- haskell/protobuf.bzl | 2 +- 12 files changed, 26 insertions(+), 12 deletions(-) diff --git a/haskell/c2hs.bzl b/haskell/c2hs.bzl index a653c1cbc..dfba31657 100644 --- a/haskell/c2hs.bzl +++ b/haskell/c2hs.bzl @@ -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") diff --git a/haskell/cc.bzl b/haskell/cc.bzl index 15c9be5f8..b61dea5e0 100644 --- a/haskell/cc.bzl +++ b/haskell/cc.bzl @@ -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", diff --git a/haskell/doctest.bzl b/haskell/doctest.bzl index 7bc9bc87c..6a049f997 100644 --- a/haskell/doctest.bzl +++ b/haskell/doctest.bzl @@ -1,7 +1,7 @@ """Doctest support""" load( - ":private/providers.bzl", + "@io_tweag_rules_haskell//haskell:private/providers.bzl", "HaskellBinaryInfo", "HaskellBuildInfo", "HaskellLibraryInfo", diff --git a/haskell/haddock.bzl b/haskell/haddock.bzl index 360cbef58..b7cf64191 100644 --- a/haskell/haddock.bzl +++ b/haskell/haddock.bzl @@ -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", diff --git a/haskell/haskell.bzl b/haskell/haskell.bzl index 16aa099f5..83b006173 100644 --- a/haskell/haskell.bzl +++ b/haskell/haskell.bzl @@ -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( @@ -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 ) @@ -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. diff --git a/haskell/import.bzl b/haskell/import.bzl index 154f85ceb..f77eda30f 100644 --- a/haskell/import.bzl +++ b/haskell/import.bzl @@ -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", diff --git a/haskell/lint.bzl b/haskell/lint.bzl index 90ef849df..78b7a13aa 100644 --- a/haskell/lint.bzl +++ b/haskell/lint.bzl @@ -7,7 +7,7 @@ load( "target_unique_name", ) load( - ":private/providers.bzl", + "@io_tweag_rules_haskell//haskell:private/providers.bzl", "HaskellBinaryInfo", "HaskellBuildInfo", "HaskellLibraryInfo", diff --git a/haskell/private/actions/compile.bzl b/haskell/private/actions/compile.bzl index 59a80d956..2c186748f 100644 --- a/haskell/private/actions/compile.bzl +++ b/haskell/private/actions/compile.bzl @@ -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", ) diff --git a/haskell/private/actions/repl.bzl b/haskell/private/actions/repl.bzl index 24faacb18..55ab3da00 100644 --- a/haskell/private/actions/repl.bzl +++ b/haskell/private/actions/repl.bzl @@ -6,7 +6,7 @@ load( "shell", ) load( - ":private/providers.bzl", + "@io_tweag_rules_haskell//haskell:private/providers.bzl", "HaskellBinaryInfo", "HaskellBuildInfo", "HaskellLibraryInfo", diff --git a/haskell/private/dependencies.bzl b/haskell/private/dependencies.bzl index 92dc4981e..3be77c42e 100644 --- a/haskell/private/dependencies.bzl +++ b/haskell/private/dependencies.bzl @@ -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", diff --git a/haskell/private/haskell_impl.bzl b/haskell/private/haskell_impl.bzl index c5073229d..5ecc639f8 100644 --- a/haskell/private/haskell_impl.bzl +++ b/haskell/private/haskell_impl.bzl @@ -21,7 +21,7 @@ load( "ln", ) load( - ":private/providers.bzl", + "@io_tweag_rules_haskell//haskell:private/providers.bzl", "C2hsLibraryInfo", "HaskellBinaryInfo", "HaskellBuildInfo", diff --git a/haskell/protobuf.bzl b/haskell/protobuf.bzl index 0fdf5c676..2f6f1d1d4 100644 --- a/haskell/protobuf.bzl +++ b/haskell/protobuf.bzl @@ -1,7 +1,7 @@ """Support for protocol buffers""" load( - ":private/providers.bzl", + "@io_tweag_rules_haskell//haskell:private/providers.bzl", "HaskellBuildInfo", "HaskellLibraryInfo", "HaskellProtobufInfo",