Skip to content

Commit

Permalink
Use buildifier 6.4.0 for improved load sorting (#2500)
Browse files Browse the repository at this point in the history
Followup to/depends on #2499 

Bigger PR than 2499 due to me not including `.bzl` files. I was using a
command from my history that just operated on BUILD/MODULE files. Big
enough it might make upstream merges a little painful? I'll leave that
thought to the maintainers.

**6.3.3:** `out_of_order_load` warning is enabled by default
**6.4.0:** More correct sorting order of load statements

Could bump to 7.1.2 which is latest, but not necessary for auto fixing
of load sorting
  • Loading branch information
erikkerber authored Jul 12, 2024
1 parent 6db5fb0 commit 90ec747
Show file tree
Hide file tree
Showing 130 changed files with 930 additions and 927 deletions.
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ tasks:
- "doc/..."
<<: *common_last_green

buildifier: 6.3.2
buildifier: 6.4.0
16 changes: 8 additions & 8 deletions apple/apple.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,14 @@ load(
_apple_dynamic_framework_import = "apple_dynamic_framework_import",
_apple_static_framework_import = "apple_static_framework_import",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_xcframework_import.bzl",
_apple_dynamic_xcframework_import = "apple_dynamic_xcframework_import",
_apple_static_xcframework_import = "apple_static_xcframework_import",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_universal_binary.bzl",
_apple_universal_binary = "apple_universal_binary",
)
load(
"@build_bazel_rules_apple//apple/internal:xcframework_rules.bzl",
_apple_static_xcframework = "apple_static_xcframework",
_apple_xcframework = "apple_xcframework",
"@build_bazel_rules_apple//apple/internal:apple_xcframework_import.bzl",
_apple_dynamic_xcframework_import = "apple_dynamic_xcframework_import",
_apple_static_xcframework_import = "apple_static_xcframework_import",
)
load(
"@build_bazel_rules_apple//apple/internal:experimental_mixed_language_library.bzl",
Expand All @@ -47,6 +42,11 @@ load(
_provisioning_profile_repository = "provisioning_profile_repository",
_provisioning_profile_repository_extension = "provisioning_profile_repository_extension",
)
load(
"@build_bazel_rules_apple//apple/internal:xcframework_rules.bzl",
_apple_static_xcframework = "apple_static_xcframework",
_apple_xcframework = "apple_xcframework",
)

apple_dynamic_framework_import = _apple_dynamic_framework_import
apple_dynamic_xcframework_import = _apple_dynamic_xcframework_import
Expand Down
8 changes: 4 additions & 4 deletions apple/apple_static_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

"""apple_static_library Starlark implementation"""

load(
"@build_bazel_rules_apple//apple:providers.bzl",
"ApplePlatformInfo",
)
load(
"@build_bazel_rules_apple//apple/internal:linking_support.bzl",
"linking_support",
Expand All @@ -34,10 +38,6 @@ load(
"@build_bazel_rules_apple//apple/internal:transition_support.bzl",
"transition_support",
)
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"ApplePlatformInfo",
)

def _apple_static_library_impl(ctx):
if ctx.attr.platform_type == "visionos":
Expand Down
4 changes: 2 additions & 2 deletions apple/cc_toolchain_forwarder.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
A rule for handling the cc_toolchains and their constraints for a potential "fat" Mach-O binary.
"""

load("//apple/internal:providers.bzl", "new_appleplatforminfo")
load("//apple:providers.bzl", "ApplePlatformInfo")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
load("//apple:providers.bzl", "ApplePlatformInfo")
load("//apple/internal:providers.bzl", "new_appleplatforminfo")

def _target_os_from_rule_ctx(ctx):
"""Returns a `String` representing the selected Apple OS."""
Expand Down
16 changes: 8 additions & 8 deletions apple/dtrace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

"""# Bazel rules for working with dtrace."""

load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:bundle_paths.bzl",
"bundle_paths",
)
load(
"@bazel_skylib//lib:dicts.bzl",
"dicts",
Expand All @@ -30,6 +22,14 @@ load(
"@bazel_skylib//lib:paths.bzl",
"paths",
)
load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:bundle_paths.bzl",
"bundle_paths",
)

def _dtrace_compile_impl(ctx):
"""Implementation for dtrace_compile."""
Expand Down
30 changes: 15 additions & 15 deletions apple/internal/apple_framework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ load(
"@bazel_skylib//lib:sets.bzl",
"sets",
)
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleFrameworkImportInfo",
)
load(
"@build_bazel_rules_apple//apple/internal/providers:framework_import_bundle_info.bzl",
"AppleFrameworkImportBundleInfo",
"@build_bazel_rules_apple//apple:utils.bzl",
"group_files_by_directory",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_toolchains.bzl",
Expand All @@ -46,37 +47,36 @@ load(
"@build_bazel_rules_apple//apple/internal:cc_toolchain_info_support.bzl",
"cc_toolchain_info_support",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:bundle_paths.bzl",
"bundle_paths",
)
load(
"@build_bazel_rules_apple//apple/internal:experimental.bzl",
"is_experimental_tree_artifact_enabled",
)
load(
"@build_bazel_rules_apple//apple/internal/aspects:swift_usage_aspect.bzl",
"SwiftUsageInfo",
"@build_bazel_rules_apple//apple/internal:framework_import_support.bzl",
"framework_import_support",
)
load(
"@build_bazel_rules_apple//apple/internal:rule_attrs.bzl",
"rule_attrs",
)
load(
"@build_bazel_rules_apple//apple:utils.bzl",
"group_files_by_directory",
"@build_bazel_rules_apple//apple/internal/aspects:swift_usage_aspect.bzl",
"SwiftUsageInfo",
)
load(
"@build_bazel_rules_apple//apple/internal/providers:framework_import_bundle_info.bzl",
"AppleFrameworkImportBundleInfo",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:bundle_paths.bzl",
"bundle_paths",
)
load(
"@build_bazel_rules_swift//swift:swift.bzl",
"SwiftToolchainInfo",
"swift_clang_module_aspect",
"swift_common",
)
load(
"@build_bazel_rules_apple//apple/internal:framework_import_support.bzl",
"framework_import_support",
)
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")

def _swiftmodule_for_cpu(swiftmodule_files, cpu):
"""Select the cpu specific swiftmodule."""
Expand Down
16 changes: 8 additions & 8 deletions apple/internal/apple_universal_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

"""Implementation for apple universal binary rules."""

load(
"@build_bazel_rules_apple//apple/internal:rule_attrs.bzl",
"rule_attrs",
)
load(
"@build_bazel_rules_apple//apple/internal:rule_factory.bzl",
"rule_factory",
)
load(
"@build_bazel_rules_apple//apple/internal:linking_support.bzl",
"linking_support",
Expand All @@ -30,6 +22,14 @@ load(
"@build_bazel_rules_apple//apple/internal:providers.bzl",
"new_applebinaryinfo",
)
load(
"@build_bazel_rules_apple//apple/internal:rule_attrs.bzl",
"rule_attrs",
)
load(
"@build_bazel_rules_apple//apple/internal:rule_factory.bzl",
"rule_factory",
)
load(
"@build_bazel_rules_apple//apple/internal:transition_support.bzl",
"transition_support",
Expand Down
12 changes: 6 additions & 6 deletions apple/internal/apple_xcframework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

"""Implementation of XCFramework import rules."""

load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
load("@build_bazel_apple_support//lib:apple_support.bzl", "apple_support")
load(
"@build_bazel_rules_apple//apple/internal:apple_toolchains.bzl",
Expand All @@ -32,21 +35,18 @@ load(
"@build_bazel_rules_apple//apple/internal:framework_import_support.bzl",
"framework_import_support",
)
load("//apple/internal:intermediates.bzl", "intermediates")
load("//apple/internal:rule_attrs.bzl", "rule_attrs")
load(
"@build_bazel_rules_apple//apple/internal/aspects:swift_usage_aspect.bzl",
"SwiftUsageInfo",
)
load("//apple:providers.bzl", "AppleFrameworkImportInfo")
load(
"@build_bazel_rules_apple//apple/internal/providers:framework_import_bundle_info.bzl",
"AppleFrameworkImportBundleInfo",
)
load("@build_bazel_rules_swift//swift:swift.bzl", "SwiftToolchainInfo", "swift_clang_module_aspect", "swift_common")
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
load("//apple:providers.bzl", "AppleFrameworkImportInfo")
load("//apple/internal:intermediates.bzl", "intermediates")
load("//apple/internal:rule_attrs.bzl", "rule_attrs")

# Currently, XCFramework bundles can contain Apple frameworks or libraries.
# This defines an _enum_ to identify an imported XCFramework bundle type.
Expand Down
10 changes: 5 additions & 5 deletions apple/internal/aspects/app_intents_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load("//apple/internal:cc_info_support.bzl", "cc_info_support")
load(
"//apple/internal/providers:app_intents_info.bzl",
"AppIntentsInfo",
)
load(
"@build_bazel_rules_swift//swift:module_name.bzl",
"derive_swift_module_name",
Expand All @@ -35,6 +30,11 @@ load(
"@build_bazel_rules_swift//swift:swift.bzl",
"SwiftInfo",
)
load("//apple/internal:cc_info_support.bzl", "cc_info_support")
load(
"//apple/internal/providers:app_intents_info.bzl",
"AppIntentsInfo",
)

def _app_intents_aspect_impl(target, ctx):
"""Implementation of the swift source files propation aspect."""
Expand Down
28 changes: 14 additions & 14 deletions apple/internal/aspects/resource_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@

"""Implementation of the resource propagation aspect."""

load(
"@bazel_skylib//lib:dicts.bzl",
"dicts",
)
load(
"@bazel_skylib//lib:partial.bzl",
"partial",
)
load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal/providers:apple_debug_info.bzl",
"AppleDebugInfo",
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleDsymBundleInfo",
"AppleFrameworkBundleInfo",
"AppleResourceInfo",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_toolchains.bzl",
Expand Down Expand Up @@ -49,10 +59,8 @@ load(
"swift_support",
)
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleDsymBundleInfo",
"AppleFrameworkBundleInfo",
"AppleResourceInfo",
"@build_bazel_rules_apple//apple/internal/providers:apple_debug_info.bzl",
"AppleDebugInfo",
)
load(
"@build_bazel_rules_apple//apple/internal/providers:framework_import_bundle_info.bzl",
Expand All @@ -62,14 +70,6 @@ load(
"@build_bazel_rules_swift//swift:swift.bzl",
"SwiftInfo",
)
load(
"@bazel_skylib//lib:dicts.bzl",
"dicts",
)
load(
"@bazel_skylib//lib:partial.bzl",
"partial",
)

def _platform_prerequisites_for_aspect(target, aspect_ctx):
"""Return the set of platform prerequisites that can be determined from this aspect."""
Expand Down
20 changes: 10 additions & 10 deletions apple/internal/codesigning_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@
"""Actions related to codesigning."""

load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
"@bazel_skylib//lib:paths.bzl",
"paths",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:defines.bzl",
"defines",
"@bazel_skylib//lib:shell.bzl",
"shell",
)
load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal:intermediates.bzl",
Expand All @@ -31,12 +35,8 @@ load(
"rule_support",
)
load(
"@bazel_skylib//lib:paths.bzl",
"paths",
)
load(
"@bazel_skylib//lib:shell.bzl",
"shell",
"@build_bazel_rules_apple//apple/internal/utils:defines.bzl",
"defines",
)

# The adhoc signature used as an identity, partially documented at https://developer.apple.com/documentation/security/seccodesignatureflags/1397793-adhoc
Expand Down
8 changes: 4 additions & 4 deletions apple/internal/docc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

"""Defines rules for building Apple DocC targets."""

load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@bazel_skylib//lib:dicts.bzl",
"dicts",
)
load(
"@build_bazel_apple_support//lib:apple_support.bzl",
"apple_support",
)
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"DocCBundleInfo",
Expand Down
8 changes: 4 additions & 4 deletions apple/internal/entitlements_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ load(
"apple_support",
)
load(
"@build_bazel_rules_apple//apple/internal/utils:defines.bzl",
"defines",
"@build_bazel_rules_apple//apple:common.bzl",
"entitlements_validation_mode",
)
load(
"@build_bazel_rules_apple//apple/internal:apple_product_type.bzl",
Expand All @@ -35,8 +35,8 @@ load(
"resource_actions",
)
load(
"@build_bazel_rules_apple//apple:common.bzl",
"entitlements_validation_mode",
"@build_bazel_rules_apple//apple/internal/utils:defines.bzl",
"defines",
)

def _tool_validation_mode(*, is_device, rules_mode):
Expand Down
Loading

0 comments on commit 90ec747

Please sign in to comment.