Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[features,pkg_win] fix feature and toolchain resolution bugs #39

Merged
merged 3 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/features.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def reify_with_features_set(
fail("the argument to with_features must be an array of values created by with_feature_set")
return with_feature_set(
features,
not_features
not_features,
)

def reify_flag_set(
Expand All @@ -89,7 +89,7 @@ def reify_flag_set(
type_name = None):
return __flag_set(
actions,
with_features =[reify_with_features_set(**v) for v in with_features],
with_features = [reify_with_features_set(**v) for v in with_features],
flag_groups = [reify_flag_group(**v) for v in flag_groups],
)

Expand Down Expand Up @@ -183,14 +183,14 @@ feature = rule(
provides = [FeatureInfo],
)

def feature_single_flag_c_cpp(name, flag, enabled = True):
def feature_single_flag_c_cpp(name, flag, c_only = False, enabled = True):
"""This macro produces a C/C++ feature() that enables a single flag."""
feature(
name = name,
enabled = enabled,
flag_sets = [
flag_set(
actions = CPP_ALL_COMPILE_ACTIONS + C_ALL_COMPILE_ACTIONS,
actions = C_ALL_COMPILE_ACTIONS + ([] if c_only else CPP_ALL_COMPILE_ACTIONS),
flag_groups = [
flag_group(
flags = [flag],
Expand Down
3 changes: 2 additions & 1 deletion features/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ feature_single_flag_c_cpp(

feature_single_flag_c_cpp(
name = "strict_prototypes_warnings",
c_only = True,
flag = "-Wstrict-prototypes",
)

Expand Down Expand Up @@ -174,7 +175,7 @@ feature(
flag_groups = [
flag_group(
flags = [
"-flto"
"-flto",
],
),
],
Expand Down
3 changes: 2 additions & 1 deletion rules/pkg_win.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def _pkg_win_impl(ctx):
else:
fail("Unknown platform:", ctx.attr.platform)

cc_toolchain = find_cc_toolchain(ctx)
toolchain = find_cc_toolchain(ctx)
cc_toolchain = getattr(toolchain, "cc", toolchain)
mxe = _get_toolchain_dir(cc_toolchain)

args = [
Expand Down
6 changes: 3 additions & 3 deletions third_party/bazel/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def bazel_repos():
http_archive,
name = "platforms",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
],
sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee",
)

maybe(
Expand Down
Loading