diff --git a/.bazelrc b/.bazelrc index 85f35ee81b..3541beff1e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -31,12 +31,6 @@ build --incompatible_use_python_toolchains=false # see: https://github.com/tweag/rules_haskell/issues/647#issuecomment-459001362 test:windows --experimental_enable_runfiles -# WIP: bazel 0.27 fixs -build\ - --incompatible_require_ctx_in_configure_features=false -test\ - --incompatible_require_ctx_in_configure_features=false - # test environment does not propagate locales by default # some tests reads files written in UTF8, we need to propagate the correct # environment variables, such as LOCALE_ARCHIVE diff --git a/WORKSPACE b/WORKSPACE index 677430de5d..8d6a899047 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -385,16 +385,16 @@ skydoc_repositories() http_archive( name = "io_bazel_rules_go", - sha256 = "8be57ff66da79d9e4bd434c860dce589195b9101b2c187d144014bbca23b5166", - strip_prefix = "rules_go-0.16.3", - urls = ["https://github.com/bazelbuild/rules_go/archive/0.16.3.tar.gz"], + sha256 = "9084496dde809363c491137e077ace81780463ead0060a0a6c3c4c0f613e9fcb", + strip_prefix = "rules_go-0.18.6", + urls = ["https://github.com/bazelbuild/rules_go/archive/0.18.6.tar.gz"], ) http_archive( name = "com_github_bazelbuild_buildtools", - sha256 = "0a0920151acf18c51866331944d12db9023707a6861e78225366f5711efc845b", - strip_prefix = "buildtools-0.25.1", - urls = ["https://github.com/bazelbuild/buildtools/archive/0.25.1.tar.gz"], + sha256 = "86592d703ecbe0c5cbb5139333a63268cf58d7efd2c459c8be8e69e77d135e29", + strip_prefix = "buildtools-0.26.0", + urls = ["https://github.com/bazelbuild/buildtools/archive/0.26.0.tar.gz"], ) # A repository that generates the Go SDK imports, see ./tools/go_sdk/README @@ -404,7 +404,7 @@ local_repository( ) load( - "@io_bazel_rules_go//go:def.bzl", + "@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies", ) diff --git a/haskell/c2hs.bzl b/haskell/c2hs.bzl index 5dcf4a2cf3..2db120e6a3 100644 --- a/haskell/c2hs.bzl +++ b/haskell/c2hs.bzl @@ -116,6 +116,7 @@ c2hs_library = rule( "@io_tweag_rules_haskell//haskell:toolchain", "@io_tweag_rules_haskell//haskell/c2hs:toolchain", ], + fragments = ["cpp"], ) def _c2hs_toolchain_impl(ctx): diff --git a/haskell/cabal.bzl b/haskell/cabal.bzl index 0b35130a4e..62218059a4 100644 --- a/haskell/cabal.bzl +++ b/haskell/cabal.bzl @@ -231,6 +231,7 @@ def _haskell_cabal_library_impl(ctx): lib_info = HaskellLibraryInfo(package_id = name, version = None) cc_toolchain = find_cpp_toolchain(ctx) feature_configuration = cc_common.configure_features( + ctx = ctx, cc_toolchain = cc_toolchain, requested_features = ctx.features, unsupported_features = ctx.disabled_features, @@ -277,6 +278,7 @@ haskell_cabal_library = rule( ), }, toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"], + fragments = ["cpp"], ) """Use Cabal to build a library. @@ -401,6 +403,7 @@ haskell_cabal_binary = rule( ), }, toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"], + fragments = ["cpp"], ) """Use Cabal to build a binary. diff --git a/haskell/cc.bzl b/haskell/cc.bzl index e97e0c73c4..c9effcf233 100644 --- a/haskell/cc.bzl +++ b/haskell/cc.bzl @@ -73,6 +73,9 @@ def cc_interop_info(ctx): # Should be find_cpp_toolchain() instead. cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo] feature_configuration = cc_common.configure_features( + # XXX: protobuf is passing a "patched ctx" + # which includes the real ctx as "real_ctx" + ctx = getattr(ctx, "real_ctx", ctx), cc_toolchain = cc_toolchain, requested_features = ctx.features, unsupported_features = ctx.disabled_features, diff --git a/haskell/haskell.bzl b/haskell/haskell.bzl index 6b9c211e3f..bdf38f9c77 100644 --- a/haskell/haskell.bzl +++ b/haskell/haskell.bzl @@ -187,6 +187,7 @@ def _mk_binary_rule(**kwargs): toolchains = [ "@io_tweag_rules_haskell//haskell:toolchain", ], + fragments = ["cpp"], **kwargs ) @@ -257,6 +258,7 @@ haskell_library = rule( toolchains = [ "@io_tweag_rules_haskell//haskell:toolchain", ], + fragments = ["cpp"], ) """Build a library from Haskell source. @@ -315,6 +317,7 @@ haskell_toolchain_libraries = rule( toolchains = [ "@io_tweag_rules_haskell//haskell:toolchain", ], + fragments = ["cpp"], ) haskell_toolchain_library = rule( @@ -327,6 +330,7 @@ haskell_toolchain_library = rule( default = Label("@io_tweag_rules_haskell//haskell:toolchain-libraries"), ), ), + fragments = ["cpp"], ) """Import packages that are prebuilt outside of Bazel. diff --git a/haskell/private/haskell_impl.bzl b/haskell/private/haskell_impl.bzl index 50460a7f0c..aafdbdb6cb 100644 --- a/haskell/private/haskell_impl.bzl +++ b/haskell/private/haskell_impl.bzl @@ -569,6 +569,9 @@ def haskell_library_impl(ctx): # Should be find_cpp_toolchain() instead. cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo] feature_configuration = cc_common.configure_features( + # XXX: protobuf is passing a "patched ctx" + # which includes the real ctx as "real_ctx" + ctx = getattr(ctx, "real_ctx", ctx), cc_toolchain = cc_toolchain, requested_features = ctx.features, unsupported_features = ctx.disabled_features, @@ -643,6 +646,7 @@ def haskell_toolchain_libraries_impl(ctx): # Should be find_cpp_toolchain() instead. cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo] feature_configuration = cc_common.configure_features( + ctx = ctx, cc_toolchain = cc_toolchain, requested_features = ctx.features, unsupported_features = ctx.disabled_features, diff --git a/haskell/protobuf.bzl b/haskell/protobuf.bzl index 89e3a98102..af2154b94e 100644 --- a/haskell/protobuf.bzl +++ b/haskell/protobuf.bzl @@ -185,6 +185,7 @@ def _haskell_proto_aspect_impl(target, ctx): label = ctx.label, toolchains = ctx.toolchains, var = ctx.var, + real_ctx = ctx, ) # TODO this pattern match is very brittle. Let's not do this. The @@ -242,6 +243,7 @@ _haskell_proto_aspect = aspect( "@io_tweag_rules_haskell//haskell:toolchain", "@io_tweag_rules_haskell//protobuf:toolchain", ], + fragments = ["cpp"], ) def _haskell_proto_library_impl(ctx):