Skip to content

Commit

Permalink
Ensure compatibility with incompatible flags close to flipping
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Oct 14, 2022
1 parent d517cd9 commit 6c075eb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ tasks:
build_flags:
- "--incompatible_load_proto_rules_from_bzl"
- "--incompatible_enable_cc_toolchain_resolution"
- "--incompatible_config_setting_private_default_visibility"
- "--incompatible_enforce_config_setting_visibility"
- "--incompatible_disallow_empty_glob"
test_flags:
- "--incompatible_load_proto_rules_from_bzl"
- "--incompatible_enable_cc_toolchain_resolution"
- "--incompatible_config_setting_private_default_visibility"
- "--incompatible_enforce_config_setting_visibility"
- "--incompatible_disallow_empty_glob"
build_targets:
- "//..."
test_targets:
Expand Down
3 changes: 3 additions & 0 deletions go/platform/list.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ def declare_config_settings():
native.config_setting(
name = goos,
constraint_values = [Label("//go/toolchain:" + goos)],
visibility = ["//visibility:public"],
)
for goarch in GOARCH:
native.config_setting(
name = goarch,
constraint_values = [Label("//go/toolchain:" + goarch)],
visibility = ["//visibility:public"],
)
for goos, goarch in GOOS_GOARCH:
native.config_setting(
Expand All @@ -52,6 +54,7 @@ def declare_config_settings():
Label("//go/toolchain:" + goos),
Label("//go/toolchain:" + goarch),
],
visibility = ["//visibility:public"],
)

# Setting that determines whether cgo is enabled.
Expand Down
17 changes: 2 additions & 15 deletions go/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,10 @@ filegroup(
visibility = ["//visibility:public"],
)

config_setting(
name = "strip-always",
values = {"strip": "always"},
)

config_setting(
name = "strip-sometimes",
values = {"strip": "sometimes"},
)

config_setting(
name = "strip-never",
values = {"strip": "never"},
)

config_setting(
name = "stamp",
values = {"stamp": "true"},
visibility = ["//:__pkg__"],
)

bzl_library(
Expand Down Expand Up @@ -187,6 +173,7 @@ config_setting(
":bootstrap_nogo": "False",
":request_nogo": "True",
},
visibility = ["//visibility:public"],
)

bool_setting(
Expand Down
7 changes: 7 additions & 0 deletions go/private/BUILD.sdk.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,31 @@ config_setting(
flag_values = {
sdk_version_label: "",
},
visibility = ["//visibility:private"],
)

config_setting(
name = "match_major_version",
flag_values = {
sdk_version_label: "{major_version}",
},
visibility = ["//visibility:private"],
)

config_setting(
name = "match_major_minor_version",
flag_values = {
sdk_version_label: "{major_version}.{minor_version}",
},
visibility = ["//visibility:private"],
)

config_setting(
name = "match_patch_version",
flag_values = {
sdk_version_label: "{major_version}.{minor_version}.{patch_version}",
},
visibility = ["//visibility:private"],
)

# If prerelease version is "", this will be the same as ":match_patch_version", but that's fine since we use match_any in config_setting_group.
Expand All @@ -95,13 +99,15 @@ config_setting(
flag_values = {
sdk_version_label: "{major_version}.{minor_version}.{patch_version}{prerelease_suffix}",
},
visibility = ["//visibility:private"],
)

config_setting(
name = "match_sdk_type",
flag_values = {
sdk_version_label: "{sdk_type}",
},
visibility = ["//visibility:private"],
)

selects.config_setting_group(
Expand All @@ -114,6 +120,7 @@ selects.config_setting_group(
":match_prerelease_version",
":match_sdk_type",
],
visibility = ["//visibility:private"],
)

declare_toolchains(
Expand Down

0 comments on commit 6c075eb

Please sign in to comment.