Skip to content

Commit

Permalink
Enable native-* rules
Browse files Browse the repository at this point in the history
With bazel 8.x these should now be loaded externally. It's currently
only a soft requirement, but at this point all users should start
migrating to this.
  • Loading branch information
keith committed Jan 6, 2025
1 parent a9c248f commit 158a320
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
3 changes: 0 additions & 3 deletions WARNINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@ UPPER_SNAKE_CASE, and providers should be UpperCamelCase ending with `Info`.
* Category name: `native-android`
* Flag in Bazel: [`--incompatible_disable_native_android_rules`](https://github.com/bazelbuild/bazel/issues/8391)
* Automatic fix: yes
* [Disabled by default](buildifier/README.md#linter)
* [Suppress the warning](#suppress): `# buildifier: disable=native-android`

The Android build rules should be loaded from Starlark.
Expand All @@ -701,7 +700,6 @@ as global symbols there.
* Category name: `native-cc`
* Flag in Bazel: [`--incompatible_load_cc_rules_from_bzl`](https://github.com/bazelbuild/bazel/issues/8743)
* Automatic fix: yes
* [Disabled by default](buildifier/README.md#linter)
* [Suppress the warning](#suppress): `# buildifier: disable=native-cc`

The CC build rules should be loaded from Starlark.
Expand Down Expand Up @@ -937,7 +935,6 @@ The ProtoLangToolchainInfo provider should be loaded from Starlark.
* Category name: `native-py`
* Flag in Bazel: [`--incompatible_load_python_rules_from_bzl`](https://github.com/bazelbuild/bazel/issues/9006)
* Automatic fix: yes
* [Disabled by default](buildifier/README.md#linter)
* [Suppress the warning](#suppress): `# buildifier: disable=native-py`

The Python build rules should be loaded from Starlark.
Expand Down
16 changes: 8 additions & 8 deletions buildifier/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ func TestValidate(t *testing.T) {
"load",
"module-docstring",
"name-conventions",
// "native-android",
"native-android",
"native-build",
// "native-cc",
"native-cc",
"native-cc-proto",
"native-java-binary",
"native-java-common",
Expand All @@ -376,7 +376,7 @@ func TestValidate(t *testing.T) {
"native-proto-info",
"native-proto-lang-toolchain",
"native-proto-lang-toolchain-info",
// "native-py",
"native-py",
"no-effect",
"output-group",
"overly-nested-depset",
Expand All @@ -398,7 +398,7 @@ func TestValidate(t *testing.T) {
// "unsorted-dict-items",
"unused-variable",
}},
"warnings plus/minus": {options: "--warnings=+native-cc,-print,-deprecated-function", wantWarnings: []string{
"warnings plus/minus": {options: "--warnings=+unsorted-dict-items,-print,-deprecated-function", wantWarnings: []string{
"attr-applicable_licenses",
"attr-cfg",
"attr-license",
Expand Down Expand Up @@ -432,8 +432,9 @@ func TestValidate(t *testing.T) {
"load",
"module-docstring",
"name-conventions",
// "native-android",
"native-android",
"native-build",
"native-cc",
"native-cc-proto",
"native-java-binary",
"native-java-common",
Expand All @@ -454,7 +455,7 @@ func TestValidate(t *testing.T) {
"native-proto-info",
"native-proto-lang-toolchain",
"native-proto-lang-toolchain-info",
// "native-py",
"native-py",
"no-effect",
"output-group",
"overly-nested-depset",
Expand All @@ -474,9 +475,8 @@ func TestValidate(t *testing.T) {
"uninitialized",
"unnamed-macro",
"unreachable",
// "unsorted-dict-items",
"unused-variable",
"native-cc",
"unsorted-dict-items",
}},
"warnings error": {options: "--warnings=native-cc,-print,-deprecated-function", wantErr: fmt.Errorf(`warning categories with modifiers ("+" or "-") can't be mixed with raw warning categories`)},
} {
Expand Down
3 changes: 0 additions & 3 deletions warn/warn.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ var MultiFileWarningMap = map[string]func(f *build.File, fileReader *FileReader)
// for all files and cause too much diff noise when applied.
var nonDefaultWarnings = map[string]bool{
"unsorted-dict-items": true, // dict items should be sorted
"native-android": true, // disables native android rules
"native-cc": true, // disables native cc rules
"native-py": true, // disables native python rules
}

// fileWarningWrapper is a wrapper that converts a file warning function to a generic function.
Expand Down

0 comments on commit 158a320

Please sign in to comment.