diff --git a/WARNINGS.md b/WARNINGS.md index 167eb9863..9bbc414ec 100644 --- a/WARNINGS.md +++ b/WARNINGS.md @@ -39,8 +39,25 @@ Warning categories supported by buildifier's linter: * [`name-conventions`](#name-conventions) * [`native-android`](#native-android) * [`native-build`](#native-build) - * [`native-cc`](#native-cc) + * [`native-cc-binary`](#native-cc-binary) + * [`native-cc-common`](#native-cc-common) + * [`native-cc-debug-package-info`](#native-cc-debug-package-info) + * [`native-cc-fdo-prefetch-hints`](#native-cc-fdo-prefetch-hints) + * [`native-cc-fdo-profile`](#native-cc-fdo-profile) + * [`native-cc-import`](#native-cc-import) + * [`native-cc-info`](#native-cc-info) + * [`native-cc-library`](#native-cc-library) + * [`native-cc-memprof-profile`](#native-cc-memprof-profile) + * [`native-cc-objc-import`](#native-cc-objc-import) + * [`native-cc-objc-library`](#native-cc-objc-library) + * [`native-cc-propeller-optimize`](#native-cc-propeller-optimize) * [`native-cc-proto`](#native-cc-proto) + * [`native-cc-shared-library`](#native-cc-shared-library) + * [`native-cc-shared-library-hint-info`](#native-cc-shared-library-hint-info) + * [`native-cc-shared-library-info`](#native-cc-shared-library-info) + * [`native-cc-test`](#native-cc-test) + * [`native-cc-toolchain`](#native-cc-toolchain) + * [`native-cc-toolchain-suite`](#native-cc-toolchain-suite) * [`native-java-binary`](#native-java-binary) * [`native-java-common`](#native-java-common) * [`native-java-import`](#native-java-import) @@ -698,18 +715,32 @@ as global symbols there. -------------------------------------------------------------------------------- -## All C++ build rules should be loaded from Starlark +## All C++ build rules should be loaded from Starlark - * Category name: `native-cc` - * Flag in Bazel: [`--incompatible_load_cc_rules_from_bzl`](https://github.com/bazelbuild/bazel/issues/8743) + * Category names: + * `native-cc-binary` + * `native-cc-common` + * `native-cc-debug-package-info` + * `native-cc-fdo-prefetch-hints` + * `native-cc-fdo-profile` + * `native-cc-import` + * `native-cc-info` + * `native-cc-library` + * `native-cc-memprof-profile` + * `native-cc-objc-import` + * `native-cc-objc-library` + * `native-cc-propeller-optimize` + * `native-cc-shared-library` + * `native-cc-shared-library-hint-info` + * `native-cc-shared-library-info` + * `native-cc-test` + * `native-cc-toolchain` + * `native-cc-toolchain-suite` + * Flag in Bazel: [`--incompatible_autoload_externally`](https://github.com/bazelbuild/bazel/issues/23043) * Automatic fix: yes - * [Suppress the warning](#suppress): `# buildifier: disable=native-cc` - -The CC build rules should be loaded from Starlark. + * [Suppress the warning](#suppress): `# buildifier: disable=native-cc-binary`, `# buildifier: disable=native-cc-common`, `# buildifier: disable=native-cc-debug-package-info`, `# buildifier: disable=native-cc-fdo-prefetch-hints`, `# buildifier: disable=native-cc-fdo-profile`, `# buildifier: disable=native-cc-import`, `# buildifier: disable=native-cc-info`, `# buildifier: disable=native-cc-library`, `# buildifier: disable=native-cc-memprof-profile`, `# buildifier: disable=native-cc-objc-import`, `# buildifier: disable=native-cc-objc-library`, `# buildifier: disable=native-cc-propeller-optimize`, `# buildifier: disable=native-cc-shared-library`, `# buildifier: disable=native-cc-shared-library-hint-info`, `# buildifier: disable=native-cc-shared-library-info`, `# buildifier: disable=native-cc-test`, `# buildifier: disable=native-cc-toolchain`, `# buildifier: disable=native-cc-toolchain-suite` -Update: the plans for disabling native rules -[have been postponed](https://groups.google.com/g/bazel-discuss/c/XNvpWcge4AE/m/aJ-aQzszAwAJ), -at the moment it's not required to load Starlark rules. +The C++ build rules should be loaded from @rules_cc. -------------------------------------------------------------------------------- diff --git a/buildifier/config/config_test.go b/buildifier/config/config_test.go index eb8f69240..7554385e5 100644 --- a/buildifier/config/config_test.go +++ b/buildifier/config/config_test.go @@ -78,8 +78,25 @@ func ExampleExample() { // "name-conventions", // "native-android", // "native-build", - // "native-cc", + // "native-cc-binary", + // "native-cc-common", + // "native-cc-debug-package-info", + // "native-cc-fdo-prefetch-hints", + // "native-cc-fdo-profile", + // "native-cc-import", + // "native-cc-info", + // "native-cc-library", + // "native-cc-memprof-profile", + // "native-cc-objc-import", + // "native-cc-objc-library", + // "native-cc-propeller-optimize", // "native-cc-proto", + // "native-cc-shared-library", + // "native-cc-shared-library-hint-info", + // "native-cc-shared-library-info", + // "native-cc-test", + // "native-cc-toolchain", + // "native-cc-toolchain-suite", // "native-java-binary", // "native-java-common", // "native-java-import", @@ -279,8 +296,25 @@ func TestValidate(t *testing.T) { "name-conventions", "native-android", "native-build", - "native-cc", + "native-cc-binary", + "native-cc-common", + "native-cc-debug-package-info", + "native-cc-fdo-prefetch-hints", + "native-cc-fdo-profile", + "native-cc-import", + "native-cc-info", + "native-cc-library", + "native-cc-memprof-profile", + "native-cc-objc-import", + "native-cc-objc-library", + "native-cc-propeller-optimize", "native-cc-proto", + "native-cc-shared-library", + "native-cc-shared-library-hint-info", + "native-cc-shared-library-info", + "native-cc-test", + "native-cc-toolchain", + "native-cc-toolchain-suite", "native-java-binary", "native-java-common", "native-java-import", @@ -361,8 +395,25 @@ func TestValidate(t *testing.T) { "name-conventions", "native-android", "native-build", - "native-cc", + "native-cc-binary", + "native-cc-common", + "native-cc-debug-package-info", + "native-cc-fdo-prefetch-hints", + "native-cc-fdo-profile", + "native-cc-import", + "native-cc-info", + "native-cc-library", + "native-cc-memprof-profile", + "native-cc-objc-import", + "native-cc-objc-library", + "native-cc-propeller-optimize", "native-cc-proto", + "native-cc-shared-library", + "native-cc-shared-library-hint-info", + "native-cc-shared-library-info", + "native-cc-test", + "native-cc-toolchain", + "native-cc-toolchain-suite", "native-java-binary", "native-java-common", "native-java-import", @@ -443,8 +494,25 @@ func TestValidate(t *testing.T) { "name-conventions", "native-android", "native-build", - "native-cc", + "native-cc-binary", + "native-cc-common", + "native-cc-debug-package-info", + "native-cc-fdo-prefetch-hints", + "native-cc-fdo-profile", + "native-cc-import", + "native-cc-info", + "native-cc-library", + "native-cc-memprof-profile", + "native-cc-objc-import", + "native-cc-objc-library", + "native-cc-propeller-optimize", "native-cc-proto", + "native-cc-shared-library", + "native-cc-shared-library-hint-info", + "native-cc-shared-library-info", + "native-cc-test", + "native-cc-toolchain", + "native-cc-toolchain-suite", "native-java-binary", "native-java-common", "native-java-import", @@ -490,7 +558,7 @@ func TestValidate(t *testing.T) { "unused-variable", "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`)}, + "warnings error": {options: "--warnings=native-py,-print,-deprecated-function", wantErr: fmt.Errorf(`warning categories with modifiers ("+" or "-") can't be mixed with raw warning categories`)}, } { t.Run(name, func(t *testing.T) { c := New() diff --git a/buildifier/integration_test.sh b/buildifier/integration_test.sh index 57559b738..e22e8b4bf 100755 --- a/buildifier/integration_test.sh +++ b/buildifier/integration_test.sh @@ -283,8 +283,25 @@ cat > golden/.buildifier.example.json <