Skip to content

Commit 5889c3f

Browse files
committed
Switch --incompatible_require_ctx_in_configure_features
See: bazelbuild/bazel#7793 buildifier needed an update of buildtools and rules_go, and starting from rules_go 0.17.0, it must be loaded using go:deps.bzl.
1 parent fb6e474 commit 5889c3f

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

.bazelrc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ build --incompatible_use_python_toolchains=false
3131
# see: https://github.com/tweag/rules_haskell/issues/647#issuecomment-459001362
3232
test:windows --experimental_enable_runfiles
3333

34-
# WIP: bazel 0.27 fixs
35-
build\
36-
--incompatible_require_ctx_in_configure_features=false
37-
test\
38-
--incompatible_require_ctx_in_configure_features=false
39-
4034
# test environment does not propagate locales by default
4135
# some tests reads files written in UTF8, we need to propagate the correct
4236
# environment variables, such as LOCALE_ARCHIVE

WORKSPACE

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,16 +385,16 @@ skydoc_repositories()
385385

386386
http_archive(
387387
name = "io_bazel_rules_go",
388-
sha256 = "8be57ff66da79d9e4bd434c860dce589195b9101b2c187d144014bbca23b5166",
389-
strip_prefix = "rules_go-0.16.3",
390-
urls = ["https://github.com/bazelbuild/rules_go/archive/0.16.3.tar.gz"],
388+
sha256 = "9084496dde809363c491137e077ace81780463ead0060a0a6c3c4c0f613e9fcb",
389+
strip_prefix = "rules_go-0.18.6",
390+
urls = ["https://github.com/bazelbuild/rules_go/archive/0.18.6.tar.gz"],
391391
)
392392

393393
http_archive(
394394
name = "com_github_bazelbuild_buildtools",
395-
sha256 = "0a0920151acf18c51866331944d12db9023707a6861e78225366f5711efc845b",
396-
strip_prefix = "buildtools-0.25.1",
397-
urls = ["https://github.com/bazelbuild/buildtools/archive/0.25.1.tar.gz"],
395+
sha256 = "86592d703ecbe0c5cbb5139333a63268cf58d7efd2c459c8be8e69e77d135e29",
396+
strip_prefix = "buildtools-0.26.0",
397+
urls = ["https://github.com/bazelbuild/buildtools/archive/0.26.0.tar.gz"],
398398
)
399399

400400
# A repository that generates the Go SDK imports, see ./tools/go_sdk/README
@@ -404,7 +404,7 @@ local_repository(
404404
)
405405

406406
load(
407-
"@io_bazel_rules_go//go:def.bzl",
407+
"@io_bazel_rules_go//go:deps.bzl",
408408
"go_register_toolchains",
409409
"go_rules_dependencies",
410410
)

haskell/c2hs.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ c2hs_library = rule(
116116
"@io_tweag_rules_haskell//haskell:toolchain",
117117
"@io_tweag_rules_haskell//haskell/c2hs:toolchain",
118118
],
119+
fragments = ["cpp"],
119120
)
120121

121122
def _c2hs_toolchain_impl(ctx):

haskell/cabal.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def _haskell_cabal_library_impl(ctx):
231231
lib_info = HaskellLibraryInfo(package_id = name, version = None)
232232
cc_toolchain = find_cpp_toolchain(ctx)
233233
feature_configuration = cc_common.configure_features(
234+
ctx = ctx,
234235
cc_toolchain = cc_toolchain,
235236
requested_features = ctx.features,
236237
unsupported_features = ctx.disabled_features,
@@ -277,6 +278,7 @@ haskell_cabal_library = rule(
277278
),
278279
},
279280
toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"],
281+
fragments = ["cpp"],
280282
)
281283
"""Use Cabal to build a library.
282284
@@ -401,6 +403,7 @@ haskell_cabal_binary = rule(
401403
),
402404
},
403405
toolchains = ["@io_tweag_rules_haskell//haskell:toolchain"],
406+
fragments = ["cpp"],
404407
)
405408
"""Use Cabal to build a binary.
406409

haskell/cc.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def cc_interop_info(ctx):
7373
# Should be find_cpp_toolchain() instead.
7474
cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
7575
feature_configuration = cc_common.configure_features(
76+
# XXX: protobuf is passing a "patched ctx"
77+
# which includes the real ctx as "real_ctx"
78+
ctx = getattr(ctx, "real_ctx", ctx),
7679
cc_toolchain = cc_toolchain,
7780
requested_features = ctx.features,
7881
unsupported_features = ctx.disabled_features,

haskell/haskell.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def _mk_binary_rule(**kwargs):
187187
toolchains = [
188188
"@io_tweag_rules_haskell//haskell:toolchain",
189189
],
190+
fragments = ["cpp"],
190191
**kwargs
191192
)
192193

@@ -257,6 +258,7 @@ haskell_library = rule(
257258
toolchains = [
258259
"@io_tweag_rules_haskell//haskell:toolchain",
259260
],
261+
fragments = ["cpp"],
260262
)
261263
"""Build a library from Haskell source.
262264
@@ -315,6 +317,7 @@ haskell_toolchain_libraries = rule(
315317
toolchains = [
316318
"@io_tweag_rules_haskell//haskell:toolchain",
317319
],
320+
fragments = ["cpp"],
318321
)
319322

320323
haskell_toolchain_library = rule(
@@ -327,6 +330,7 @@ haskell_toolchain_library = rule(
327330
default = Label("@io_tweag_rules_haskell//haskell:toolchain-libraries"),
328331
),
329332
),
333+
fragments = ["cpp"],
330334
)
331335
"""Import packages that are prebuilt outside of Bazel.
332336

haskell/private/haskell_impl.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ def haskell_library_impl(ctx):
569569
# Should be find_cpp_toolchain() instead.
570570
cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
571571
feature_configuration = cc_common.configure_features(
572+
# XXX: protobuf is passing a "patched ctx"
573+
# which includes the real ctx as "real_ctx"
574+
ctx = getattr(ctx, "real_ctx", ctx),
572575
cc_toolchain = cc_toolchain,
573576
requested_features = ctx.features,
574577
unsupported_features = ctx.disabled_features,
@@ -643,6 +646,7 @@ def haskell_toolchain_libraries_impl(ctx):
643646
# Should be find_cpp_toolchain() instead.
644647
cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
645648
feature_configuration = cc_common.configure_features(
649+
ctx = ctx,
646650
cc_toolchain = cc_toolchain,
647651
requested_features = ctx.features,
648652
unsupported_features = ctx.disabled_features,

haskell/protobuf.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ def _haskell_proto_aspect_impl(target, ctx):
185185
label = ctx.label,
186186
toolchains = ctx.toolchains,
187187
var = ctx.var,
188+
real_ctx = ctx,
188189
)
189190

190191
# TODO this pattern match is very brittle. Let's not do this. The
@@ -242,6 +243,7 @@ _haskell_proto_aspect = aspect(
242243
"@io_tweag_rules_haskell//haskell:toolchain",
243244
"@io_tweag_rules_haskell//protobuf:toolchain",
244245
],
246+
fragments = ["cpp"],
245247
)
246248

247249
def _haskell_proto_library_impl(ctx):

0 commit comments

Comments
 (0)