Skip to content

Commit

Permalink
Add ctx argument to cc_common.configure_features
Browse files Browse the repository at this point in the history
In order to migrate C++ rules to platforms, we need the access to the C++
configuration fragment in Starlark APIs. All existing APIs have already access
to it, but cc_common.configure_features doesn't. This change adds a
ctx argument to configure_features.

This is the migration needed for
bazelbuild/bazel#7793, and is part of the effort for
bazelbuild/bazel#6516.

If the rule doesn't depend on cpp fragment yet, you will have to add `fragments
=['cpp']` argument to the rule() call.

Note that this behavior is only available in Bazel 0.25 (to be released this month).

RELNOTES: None.
PiperOrigin-RevId: 248534309
  • Loading branch information
Googler authored and swiple-rules-gardener committed May 16, 2019
1 parent 4e6476f commit 2ddb4cc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions swift/internal/swift_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def _swift_import_impl(ctx):
# toolchains.
cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
cc_feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
Expand Down Expand Up @@ -126,5 +127,6 @@ The C++ toolchain from which linking flags and other tools needed by the Swift t
Allows for the use of precompiled Swift modules as dependencies in other `swift_library` and
`swift_binary` targets.
""",
fragments = ["cpp"],
implementation = _swift_import_impl,
)

0 comments on commit 2ddb4cc

Please sign in to comment.