diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..42d6e7bfc --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +# See CONTRIBUTING.md for instructions. +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +# Use a slightly older version of node by default +# as the default uses a very new version of GLIBC +default_language_version: + node: 16.18.0 + +repos: + # Check formatting and lint for starlark code + - repo: https://github.com/keith/pre-commit-buildifier + rev: 6.3.3 + hooks: + - id: buildifier + - id: buildifier-lint + args: + - --warnings=-module-docstring,-provider-params,-name-conventions,-unnamed-macro diff --git a/android/jetpack-compose/app/src/main/BUILD.bazel b/android/jetpack-compose/app/src/main/BUILD.bazel index 11e6de0ac..c8410287c 100644 --- a/android/jetpack-compose/app/src/main/BUILD.bazel +++ b/android/jetpack-compose/app/src/main/BUILD.bazel @@ -1,4 +1,4 @@ -load("@build_bazel_rules_android//android:rules.bzl", "android_binary", "android_library") +load("@build_bazel_rules_android//android:rules.bzl", "android_binary") load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") kt_android_library( diff --git a/android/ndk/app/src/main/BUILD.bazel b/android/ndk/app/src/main/BUILD.bazel index 9e5ca1069..c1c6909d2 100644 --- a/android/ndk/app/src/main/BUILD.bazel +++ b/android/ndk/app/src/main/BUILD.bazel @@ -1,5 +1,5 @@ -load("@rules_cc//cc:defs.bzl", "cc_library") load("@build_bazel_rules_android//android:rules.bzl", "android_binary", "android_library") +load("@rules_cc//cc:defs.bzl", "cc_library") android_library( name = "lib", diff --git a/bzlmod/02-override_bazel_module/BUILD b/bzlmod/02-override_bazel_module/BUILD index 7045c6e88..39b7af54a 100644 --- a/bzlmod/02-override_bazel_module/BUILD +++ b/bzlmod/02-override_bazel_module/BUILD @@ -1,11 +1,13 @@ load("@bazel_skylib//:version.bzl", "hello_msg") + +# buildifier: disable=print print(hello_msg) cc_binary( - name = "main", - srcs = ["main.cc"], - deps = [ - "@lib_a//:lib_a", - "@com_github_google_glog//:glog", - ], + name = "main", + srcs = ["main.cc"], + deps = [ + "@com_github_google_glog//:glog", + "@lib_a", + ], ) diff --git a/bzlmod/02-override_bazel_module/MODULE.bazel b/bzlmod/02-override_bazel_module/MODULE.bazel index abb1ace1d..eca6f795b 100644 --- a/bzlmod/02-override_bazel_module/MODULE.bazel +++ b/bzlmod/02-override_bazel_module/MODULE.bazel @@ -4,34 +4,35 @@ module( ) bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog") + # Override glog to a fork version with archive_override. archive_override( module_name = "glog", - urls = ["https://github.com/meteorcloudy/glog/archive/9401faa19e0424791243827b8e95efd3d0d8db23.tar.gz"], integrity = "sha256-EH4o3n+qkfcsEFODkkRzs1/XAH9ej2V77gv05eplB5k=", strip_prefix = "glog-9401faa19e0424791243827b8e95efd3d0d8db23", + urls = ["https://github.com/meteorcloudy/glog/archive/9401faa19e0424791243827b8e95efd3d0d8db23.tar.gz"], ) # Override gflag to a fork version with git_override. # gflag is still an indirect dependency, the override itself doesn't give the root module visibility on gflags. git_override( module_name = "gflags", - remote = "https://github.com/meteorcloudy/gflags.git", commit = "95995169e86f3fedd19696df5b1811d441c462a2", + remote = "https://github.com/meteorcloudy/gflags.git", ) # Patch bazel skylib 1.2.0 with a local patch file. bazel_dep(name = "bazel_skylib", version = "1.2.0") single_version_override( module_name = "bazel_skylib", - version = "1.2.0", - patches = ["//:bazel_skylib.patch"], patch_strip = 1, + patches = ["//:bazel_skylib.patch"], + version = "1.2.0", ) # Depend on module lib_a at a local path. # The bazel_dep statement is necessary because the root module must have visibility on lib_a. -bazel_dep(name = "lib_a", version="") +bazel_dep(name = "lib_a", version = "") local_path_override( module_name = "lib_a", path = "./lib_a", diff --git a/bzlmod/02-override_bazel_module/WORKSPACE b/bzlmod/02-override_bazel_module/WORKSPACE index c07d6d18a..d231f869b 100644 --- a/bzlmod/02-override_bazel_module/WORKSPACE +++ b/bzlmod/02-override_bazel_module/WORKSPACE @@ -1,5 +1,5 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Use a fork version of glog with http_archive. http_archive( @@ -12,17 +12,17 @@ http_archive( # Use a fork version of gflags with git_repository. git_repository( name = "com_github_gflags_gflags", - remote = "https://github.com/meteorcloudy/gflags.git", commit = "95995169e86f3fedd19696df5b1811d441c462a2", + remote = "https://github.com/meteorcloudy/gflags.git", ) # Use a patched version of bazel_skylib http_archive( name = "bazel_skylib", - urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz"], - sha256 = "af87959afe497dc8dfd4c6cb66e1279cb98ccc84284619ebfec27d9c09a903de", - patches = ["//:bazel_skylib.patch"], patch_args = ["-p1"], + patches = ["//:bazel_skylib.patch"], + sha256 = "af87959afe497dc8dfd4c6cb66e1279cb98ccc84284619ebfec27d9c09a903de", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz"], ) # Depend on lib_a at a local path. diff --git a/bzlmod/03-introduce_dependencies_with_module_extension/BUILD b/bzlmod/03-introduce_dependencies_with_module_extension/BUILD index 2bf0ce7bc..f5d01a79d 100644 --- a/bzlmod/03-introduce_dependencies_with_module_extension/BUILD +++ b/bzlmod/03-introduce_dependencies_with_module_extension/BUILD @@ -1,17 +1,17 @@ # Count how many cities are listed in the file genrule( name = "city_count", - cmd = "wc -l < $< > $@", - outs = ["city_number"], srcs = ["@world_cities//file"], + outs = ["city_number"], + cmd = "wc -l < $< > $@", ) # Count how many emojis are listed in the file genrule( name = "emoji_count", - cmd = "wc -l < $< > $@", - outs = ["emoji_number"], # To build without --expiremental_enable_bzlmod, this has to be # srcs = ["@emojis//file"], srcs = ["@com_foo_bar_emojis//file"], + outs = ["emoji_number"], + cmd = "wc -l < $< > $@", ) diff --git a/bzlmod/03-introduce_dependencies_with_module_extension/MODULE.bazel b/bzlmod/03-introduce_dependencies_with_module_extension/MODULE.bazel index 1be862230..bea01e178 100644 --- a/bzlmod/03-introduce_dependencies_with_module_extension/MODULE.bazel +++ b/bzlmod/03-introduce_dependencies_with_module_extension/MODULE.bazel @@ -4,13 +4,15 @@ module( ) data_deps_ext = use_extension("//:deps.bzl", "data_deps_ext") + # The module extension can generate multiple repositories, due to strict deps, you need to declare which ones you need. use_repo(data_deps_ext, "world_cities") # It's fine to declare extension usages before defining module lib_a. data_deps_ext_from_a = use_extension("@lib_a//:deps.bzl", "data_deps_ext") + # The emojis repo will be accessible with the "com_foo_bar_emojis" repo name instead. -use_repo(data_deps_ext_from_a, com_foo_bar_emojis="emojis") +use_repo(data_deps_ext_from_a, com_foo_bar_emojis = "emojis") bazel_dep(name = "lib_a", version = "") local_path_override( diff --git a/bzlmod/03-introduce_dependencies_with_module_extension/WORKSPACE b/bzlmod/03-introduce_dependencies_with_module_extension/WORKSPACE index 343b2c60f..284dbe0c9 100644 --- a/bzlmod/03-introduce_dependencies_with_module_extension/WORKSPACE +++ b/bzlmod/03-introduce_dependencies_with_module_extension/WORKSPACE @@ -1,4 +1,5 @@ load("//:deps.bzl", "world_cities") + world_cities() # Depend on lib_a at a local path. @@ -9,4 +10,5 @@ local_repository( # This has to be defined after defining lib_a. load("@lib_a//:deps.bzl", "emojis") + emojis() diff --git a/bzlmod/03-introduce_dependencies_with_module_extension/deps.bzl b/bzlmod/03-introduce_dependencies_with_module_extension/deps.bzl index 61f141602..0758bbe59 100644 --- a/bzlmod/03-introduce_dependencies_with_module_extension/deps.bzl +++ b/bzlmod/03-introduce_dependencies_with_module_extension/deps.bzl @@ -7,7 +7,7 @@ def world_cities(): sha256 = "4d2469729be61b55fcc758ab16bf590196733ff99f1c80e361623decb34ac35d", ) -def _data_deps_extension_impl(ctx): +def _data_deps_extension_impl(_): world_cities() data_deps_ext = module_extension( diff --git a/bzlmod/03-introduce_dependencies_with_module_extension/lib_a/BUILD b/bzlmod/03-introduce_dependencies_with_module_extension/lib_a/BUILD index d51717fb1..e78f9192a 100644 --- a/bzlmod/03-introduce_dependencies_with_module_extension/lib_a/BUILD +++ b/bzlmod/03-introduce_dependencies_with_module_extension/lib_a/BUILD @@ -1,6 +1,6 @@ genrule( name = "emoji_count", - cmd = "wc -l < $< > $@", - outs = ["emoji_number"], srcs = ["@emojis//file"], + outs = ["emoji_number"], + cmd = "wc -l < $< > $@", ) diff --git a/bzlmod/04-local_config_and_register_toolchains/MODULE.bazel b/bzlmod/04-local_config_and_register_toolchains/MODULE.bazel index 7ae75793c..ac0fc58ad 100644 --- a/bzlmod/04-local_config_and_register_toolchains/MODULE.bazel +++ b/bzlmod/04-local_config_and_register_toolchains/MODULE.bazel @@ -5,4 +5,5 @@ module( sh_config_ext = use_extension("//:local_config_sh.bzl", "my_sh_config_extension") use_repo(sh_config_ext, "my_local_config_sh") + register_toolchains("@my_local_config_sh//:local_sh_toolchain") diff --git a/bzlmod/04-local_config_and_register_toolchains/WORKSPACE b/bzlmod/04-local_config_and_register_toolchains/WORKSPACE index 5149f1c5c..16730d488 100644 --- a/bzlmod/04-local_config_and_register_toolchains/WORKSPACE +++ b/bzlmod/04-local_config_and_register_toolchains/WORKSPACE @@ -1,2 +1,3 @@ load("//:local_config_sh.bzl", "sh_configure") + sh_configure() diff --git a/bzlmod/04-local_config_and_register_toolchains/local_config_sh.bzl b/bzlmod/04-local_config_and_register_toolchains/local_config_sh.bzl index 07f25fb55..671e229b7 100644 --- a/bzlmod/04-local_config_and_register_toolchains/local_config_sh.bzl +++ b/bzlmod/04-local_config_and_register_toolchains/local_config_sh.bzl @@ -4,8 +4,9 @@ def _is_windows(repository_ctx): def _my_sh_config_impl(repository_ctx): """ - Detects the path of the shell interpreter via a env var - and stores it in a sh_toolchain rule. + Detects the path of the shell interpreter via a env var. + + Stores it in a sh_toolchain rule. """ sh_path = repository_ctx.os.environ.get("MY_SHELL_BIN_PATH") if not sh_path: diff --git a/bzlmod/05-integrate_third_party_package_manager/MODULE.bazel b/bzlmod/05-integrate_third_party_package_manager/MODULE.bazel index 783420124..f85a2f7c6 100644 --- a/bzlmod/05-integrate_third_party_package_manager/MODULE.bazel +++ b/bzlmod/05-integrate_third_party_package_manager/MODULE.bazel @@ -27,8 +27,13 @@ local_path_override( ) librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") - -librarian_extension.book(name="the_great_gatsby", edition="1995.12") -librarian_extension.book(name="hamlet", edition="2005.1") +librarian_extension.book( + name = "the_great_gatsby", + edition = "1995.12", +) +librarian_extension.book( + name = "hamlet", + edition = "2005.1", +) use_repo(librarian_extension, "the_great_gatsby") use_repo(librarian_extension, "hamlet") diff --git a/bzlmod/05-integrate_third_party_package_manager/WORKSPACE b/bzlmod/05-integrate_third_party_package_manager/WORKSPACE index 6e27bd2d2..88f60da6e 100644 --- a/bzlmod/05-integrate_third_party_package_manager/WORKSPACE +++ b/bzlmod/05-integrate_third_party_package_manager/WORKSPACE @@ -7,14 +7,15 @@ local_repository( name = "librarian", path = "../utils/librarian", ) + local_repository( name = "lib_a", path = "./lib_a", ) -load("@lib_a//:deps.bzl","fetch_book_for_lib_a") - +load("@lib_a//:deps.bzl", "fetch_book_for_lib_a") load("@librarian//:librarian.bzl", "fetch_book") + fetch_book( name = "the_great_gatsby", edition = "1995.12", @@ -31,7 +32,9 @@ local_repository( name = "lib_b", path = "./lib_b", ) -load("@lib_b//:deps.bzl","fetch_book_for_lib_b") + +load("@lib_b//:deps.bzl", "fetch_book_for_lib_b") + fetch_book_for_lib_b() # Answer: You'll get the_great_gatsby@2003.7 and hamlet@2005.1. diff --git a/bzlmod/05-integrate_third_party_package_manager/lib_a/MODULE.bazel b/bzlmod/05-integrate_third_party_package_manager/lib_a/MODULE.bazel index 1c44431ff..e9701d4d2 100644 --- a/bzlmod/05-integrate_third_party_package_manager/lib_a/MODULE.bazel +++ b/bzlmod/05-integrate_third_party_package_manager/lib_a/MODULE.bazel @@ -6,9 +6,13 @@ module( bazel_dep(name = "librarian", version = "") librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") - -librarian_extension.book(name="the_great_gatsby", edition="2003.7") +librarian_extension.book( + name = "the_great_gatsby", + edition = "2003.7", +) use_repo(librarian_extension, "the_great_gatsby") - -librarian_extension.book(name="hamlet", edition="1800.1") +librarian_extension.book( + name = "hamlet", + edition = "1800.1", +) use_repo(librarian_extension, "hamlet") diff --git a/bzlmod/05-integrate_third_party_package_manager/lib_a/deps.bzl b/bzlmod/05-integrate_third_party_package_manager/lib_a/deps.bzl index 00bdfdf04..64be888c3 100644 --- a/bzlmod/05-integrate_third_party_package_manager/lib_a/deps.bzl +++ b/bzlmod/05-integrate_third_party_package_manager/lib_a/deps.bzl @@ -2,10 +2,10 @@ load("@librarian//:librarian.bzl", "fetch_book") def fetch_book_for_lib_a(): fetch_book( - name="the_great_gatsby", - edition="2003.7", + name = "the_great_gatsby", + edition = "2003.7", ) fetch_book( - name="hamlet", - edition="1800.1", + name = "hamlet", + edition = "1800.1", ) diff --git a/bzlmod/05-integrate_third_party_package_manager/lib_b/MODULE.bazel b/bzlmod/05-integrate_third_party_package_manager/lib_b/MODULE.bazel index cc16a9902..1e1f89819 100644 --- a/bzlmod/05-integrate_third_party_package_manager/lib_b/MODULE.bazel +++ b/bzlmod/05-integrate_third_party_package_manager/lib_b/MODULE.bazel @@ -6,9 +6,13 @@ module( bazel_dep(name = "librarian", version = "") librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") - -librarian_extension.book(name="the_great_gatsby", edition="2020.5") +librarian_extension.book( + name = "the_great_gatsby", + edition = "2020.5", +) use_repo(librarian_extension, "the_great_gatsby") - -librarian_extension.book(name="hamlet", edition="1603.1") +librarian_extension.book( + name = "hamlet", + edition = "1603.1", +) use_repo(librarian_extension, "hamlet") diff --git a/bzlmod/05-integrate_third_party_package_manager/lib_b/deps.bzl b/bzlmod/05-integrate_third_party_package_manager/lib_b/deps.bzl index b2b1b368e..d3161afb0 100644 --- a/bzlmod/05-integrate_third_party_package_manager/lib_b/deps.bzl +++ b/bzlmod/05-integrate_third_party_package_manager/lib_b/deps.bzl @@ -2,10 +2,10 @@ load("@librarian//:librarian.bzl", "fetch_book") def fetch_book_for_lib_b(): fetch_book( - name="the_great_gatsby", - edition="2020.5", + name = "the_great_gatsby", + edition = "2020.5", ) fetch_book( - name="hamlet", - edition="1603.1", + name = "hamlet", + edition = "1603.1", ) diff --git a/bzlmod/06-specify_dev_dependency/BUILD b/bzlmod/06-specify_dev_dependency/BUILD index 7614a82f2..640b9f51f 100644 --- a/bzlmod/06-specify_dev_dependency/BUILD +++ b/bzlmod/06-specify_dev_dependency/BUILD @@ -1,5 +1,6 @@ load("@bazel_skylib//:version.bzl", "version") +# buildifier: disable=print print("Bazel Skylib version:", version) genrule( diff --git a/bzlmod/06-specify_dev_dependency/MODULE.bazel b/bzlmod/06-specify_dev_dependency/MODULE.bazel index 5ba20cc9b..b87f49acc 100644 --- a/bzlmod/06-specify_dev_dependency/MODULE.bazel +++ b/bzlmod/06-specify_dev_dependency/MODULE.bazel @@ -18,7 +18,6 @@ bazel_dep( name = "bazel_skylib", version = "1.1.1", ) - bazel_dep(name = "librarian", version = "") local_path_override( module_name = "librarian", @@ -26,10 +25,15 @@ local_path_override( ) librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") +librarian_extension.book( + name = "the_great_gatsby", + edition = "1995.12", +) -librarian_extension.book(name="the_great_gatsby", edition="1995.12") # The root module will get hamlet@1800.1 because hamlet@2005.1 is only a dev dependency of lib_a. -librarian_extension.book(name="hamlet", edition="1800.1") - +librarian_extension.book( + name = "hamlet", + edition = "1800.1", +) use_repo(librarian_extension, "the_great_gatsby") use_repo(librarian_extension, "hamlet") diff --git a/bzlmod/06-specify_dev_dependency/WORKSPACE b/bzlmod/06-specify_dev_dependency/WORKSPACE index bc30a6b97..81e5e8d70 100644 --- a/bzlmod/06-specify_dev_dependency/WORKSPACE +++ b/bzlmod/06-specify_dev_dependency/WORKSPACE @@ -6,10 +6,12 @@ local_repository( ) load("@librarian//:librarian.bzl", "fetch_book") + fetch_book( name = "the_great_gatsby", edition = "1995.12", ) + fetch_book( name = "hamlet", edition = "1800.1", @@ -19,11 +21,13 @@ local_repository( name = "lib_a", path = "./lib_a", ) + load("@lib_a//:deps.bzl", "deps") + deps() http_archive( name = "bazel_skylib", - urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz"], sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz"], ) diff --git a/bzlmod/06-specify_dev_dependency/lib_a/MODULE.bazel b/bzlmod/06-specify_dev_dependency/lib_a/MODULE.bazel index fda9cf0f0..cd6482296 100644 --- a/bzlmod/06-specify_dev_dependency/lib_a/MODULE.bazel +++ b/bzlmod/06-specify_dev_dependency/lib_a/MODULE.bazel @@ -7,16 +7,22 @@ module( bazel_dep( name = "bazel_skylib", version = "1.2.0", - dev_dependency=True, + dev_dependency = True, ) bazel_dep(name = "librarian", version = "") librarian_extension = use_extension("@librarian//:librarian.bzl", "librarian_extension") -librarian_extension.book(name="the_great_gatsby", edition="2003.7") +librarian_extension.book( + name = "the_great_gatsby", + edition = "2003.7", +) use_repo(librarian_extension, "the_great_gatsby") # All tags belonging to librarian_extension_dev won't take effect if this module is used as a dependency. -librarian_extension_dev = use_extension("@librarian//:librarian.bzl", "librarian_extension", dev_dependency=True) -librarian_extension_dev.book(name="hamlet", edition="2005.1") +librarian_extension_dev = use_extension("@librarian//:librarian.bzl", "librarian_extension", dev_dependency = True) +librarian_extension_dev.book( + name = "hamlet", + edition = "2005.1", +) use_repo(librarian_extension_dev, "hamlet") diff --git a/bzlmod/06-specify_dev_dependency/lib_a/WORKSPACE b/bzlmod/06-specify_dev_dependency/lib_a/WORKSPACE index 072a6a6f3..32015999e 100644 --- a/bzlmod/06-specify_dev_dependency/lib_a/WORKSPACE +++ b/bzlmod/06-specify_dev_dependency/lib_a/WORKSPACE @@ -1,17 +1,20 @@ # Load general dependencies load("//:deps.bzl", "deps") + deps() # Define dev dependencies directly in the WORKSPACE file. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + http_archive( name = "bazel_skylib", - urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz"], sha256 = "af87959afe497dc8dfd4c6cb66e1279cb98ccc84284619ebfec27d9c09a903de", + urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.0/bazel-skylib-1.2.0.tar.gz"], ) load("@librarian//:librarian.bzl", "fetch_book") + fetch_book( - name="hamlet", - edition="2005.1", + name = "hamlet", + edition = "2005.1", ) diff --git a/bzlmod/06-specify_dev_dependency/lib_a/deps.bzl b/bzlmod/06-specify_dev_dependency/lib_a/deps.bzl index 9a6677245..7f196c67f 100644 --- a/bzlmod/06-specify_dev_dependency/lib_a/deps.bzl +++ b/bzlmod/06-specify_dev_dependency/lib_a/deps.bzl @@ -2,6 +2,6 @@ load("@librarian//:librarian.bzl", "fetch_book") def deps(): fetch_book( - name="the_great_gatsby", - edition="2003.7", + name = "the_great_gatsby", + edition = "2003.7", ) diff --git a/bzlmod/utils/librarian/librarian.bzl b/bzlmod/utils/librarian/librarian.bzl index d2e462ac6..8c68913de 100644 --- a/bzlmod/utils/librarian/librarian.bzl +++ b/bzlmod/utils/librarian/librarian.bzl @@ -38,10 +38,9 @@ def _librarian_extension_impl(module_ctx): resolved_book_list = json.decode(module_ctx.read("./booklist.json")) for name in resolved_book_list: edition = resolved_book_list[name] - fetch_book(name=name, edition=edition) + fetch_book(name = name, edition = edition) - -book = tag_class(attrs={ +book = tag_class(attrs = { "name": attr.string(), "edition": attr.string(), }) diff --git a/configurations/WORKSPACE b/configurations/WORKSPACE index 769422e2e..37890ee47 100644 --- a/configurations/WORKSPACE +++ b/configurations/WORKSPACE @@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel_skylib", + sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", ], - sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", ) load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") diff --git a/configurations/attaching_transitions_to_rules/BUILD b/configurations/attaching_transitions_to_rules/BUILD index 060b8c4bd..e3a22e0b5 100644 --- a/configurations/attaching_transitions_to_rules/BUILD +++ b/configurations/attaching_transitions_to_rules/BUILD @@ -5,12 +5,21 @@ # See https://docs.bazel.build/versions/master/skylark/config.html and # https://github.com/bazelbuild/bazel-skylib) for more info. load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load(":defs.bzl", "shirt", "piece") +load(":defs.bzl", "piece", "shirt") # Define a build setting using the skylib pre-defined settings -string_flag(name = "color", build_setting_default = "black") +string_flag( + name = "color", + build_setting_default = "black", +) # Define a rule with two dependencies -shirt(name = "tee", sleeve = ":sleeve", back = ":back") +shirt( + name = "tee", + back = ":back", + sleeve = ":sleeve", +) + piece(name = "sleeve") + piece(name = "back") diff --git a/configurations/attaching_transitions_to_rules/defs.bzl b/configurations/attaching_transitions_to_rules/defs.bzl index 342f1a9b3..6e9d8c493 100644 --- a/configurations/attaching_transitions_to_rules/defs.bzl +++ b/configurations/attaching_transitions_to_rules/defs.bzl @@ -3,9 +3,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") # Define two different transitions that both transition the `color` build setting # we defined in the BUILD. -def _blue_impl(settings, attr): - _ignore = settings, attr - +def _blue_impl(_, _): return {"//attaching_transitions_to_rules:color": "blue"} blue_transition = transition( @@ -14,9 +12,7 @@ blue_transition = transition( outputs = ["//attaching_transitions_to_rules:color"], ) -def _red_impl(settings, attr): - _ignore = settings, attr - +def _red_impl(_, _): return {"//attaching_transitions_to_rules:color": "red"} red_transition = transition( @@ -25,6 +21,7 @@ red_transition = transition( outputs = ["//attaching_transitions_to_rules:color"], ) +# buildifier: disable=print def _impl(ctx): # Access the value of //attaching_transitions_to_rules:color for the target (blue). print("shirt color: " + ctx.attr._color[BuildSettingInfo].value) diff --git a/configurations/basic_build_setting/BUILD b/configurations/basic_build_setting/BUILD index 7ce9f8d93..448afa413 100644 --- a/configurations/basic_build_setting/BUILD +++ b/configurations/basic_build_setting/BUILD @@ -1,9 +1,12 @@ -load(":defs.bzl", "temperature", "breakfast") +load(":defs.bzl", "breakfast", "temperature") # A rule that can read `:coffee-temp`. See its implementation # for details. -breakfast(name = 'today') +breakfast(name = "today") # This is a string-typed build setting. Here we set its # default value to "HOT". -temperature(name = 'coffee-temp', build_setting_default = "HOT") +temperature( + name = "coffee-temp", + build_setting_default = "HOT", +) diff --git a/configurations/basic_build_setting/defs.bzl b/configurations/basic_build_setting/defs.bzl index 196d480d1..07b58ea80 100644 --- a/configurations/basic_build_setting/defs.bzl +++ b/configurations/basic_build_setting/defs.bzl @@ -1,9 +1,9 @@ -TemperatureProvider = provider(fields = ['type']) +TemperatureProvider = provider(fields = ["type"]) temperatures = ["HOT", "LUKEWARM", "ICED"] def _impl(ctx): - # use `ctx.build_setting_value` to access the raw value + # use `ctx.build_setting_value` to access the raw value # of this build setting. This value is either derived from # the default value set on the target or from the setting # being set somewhere on the command line/in a transition, etc. @@ -12,9 +12,9 @@ def _impl(ctx): # Things you can do in a build setting implementation function # include more advanced type checking if raw_temperature not in temperatures: - fail(str(ctx.label) + " build setting allowed to take values {" - + ", ".join(temperatures) + "} but was set to unallowed value " - + raw_temperature) + fail(str(ctx.label) + " build setting allowed to take values {" + + ", ".join(temperatures) + "} but was set to unallowed value " + + raw_temperature) # Returns a provider like a normal rule return TemperatureProvider(type = raw_temperature) @@ -25,9 +25,10 @@ temperature = rule( # the `build_setting` atttribute, you mark this rule as a build setting # including what raw type it is and if it can be used on the command # line or not (if yes, you must set `flag = True`) - build_setting = config.string(flag = True) + build_setting = config.string(flag = True), ) +# buildifier: disable=print def _day_impl(ctx): # This accesses the value of the build setting at the time this # rule implementation is evaluated. This means if there was @@ -36,7 +37,6 @@ def _day_impl(ctx): print(ctx.attr._temperature[TemperatureProvider].type) return [] - breakfast = rule( implementation = _day_impl, # Depending on a build setting will give you access to its @@ -45,6 +45,6 @@ breakfast = rule( # users can't change what piece of configuration you are # reading (https://docs.bazel.build/versions/master/skylark/rules.html#private-attributes-and-implicit-dependencies) attrs = { - "_temperature": attr.label(default = ":coffee-temp") + "_temperature": attr.label(default = ":coffee-temp"), }, ) diff --git a/configurations/cc_binary_selectable_copts/BUILD b/configurations/cc_binary_selectable_copts/BUILD index 4ae1f145f..23cc6fc60 100644 --- a/configurations/cc_binary_selectable_copts/BUILD +++ b/configurations/cc_binary_selectable_copts/BUILD @@ -1,7 +1,7 @@ # This load statement replaces the native cc_binary (which has no "set_features" # attribute) with a macro that strings together the logic to make that work, # then passes everything else back to the native cc_binary. -load(":defs.bzl", "cc_binary", "transition_rule") +load(":defs.bzl", "cc_binary") # To see what this does, try "$ bazel run //:app_with_feature1". cc_binary( diff --git a/configurations/cc_binary_selectable_copts/defs.bzl b/configurations/cc_binary_selectable_copts/defs.bzl index 9169cf31b..ffc60a683 100644 --- a/configurations/cc_binary_selectable_copts/defs.bzl +++ b/configurations/cc_binary_selectable_copts/defs.bzl @@ -1,6 +1,4 @@ -def _copt_transition_impl(settings, attr): - _ignore = settings - +def _copt_transition_impl(_, attr): # settings provides read access to existing flags. But # this transition doesn't need to read any flags. return {"//cc_binary_selectable_copts/custom_settings:mycopts": attr.set_features} diff --git a/configurations/cc_test/BUILD b/configurations/cc_test/BUILD index e587fadf8..dee275f03 100644 --- a/configurations/cc_test/BUILD +++ b/configurations/cc_test/BUILD @@ -1,6 +1,6 @@ load(":defs.bzl", "test_arg_cc_test") test_arg_cc_test( - name = "my-test", - srcs = ["mytest.cc"], + name = "my-test", + srcs = ["mytest.cc"], ) diff --git a/configurations/cc_test/defs.bzl b/configurations/cc_test/defs.bzl index b2f00de04..18a35055d 100644 --- a/configurations/cc_test/defs.bzl +++ b/configurations/cc_test/defs.bzl @@ -2,9 +2,7 @@ # //command_line_option: syntax _BUILD_SETTING = "//command_line_option:test_arg" -def _test_arg_transition_impl(settings, attr): - _ignore = (settings, attr) - +def _test_arg_transition_impl(_, _): return {_BUILD_SETTING: ["new arg"]} _test_arg_transition = transition( diff --git a/configurations/label_typed_build_setting/BUILD b/configurations/label_typed_build_setting/BUILD index ce980ff83..894cd8be1 100644 --- a/configurations/label_typed_build_setting/BUILD +++ b/configurations/label_typed_build_setting/BUILD @@ -1,12 +1,16 @@ load(":defs.bzl", "tool", "toolbox") # Define a label_flag (or setting) using the built-in bazel rules. -# Its default value is the default target this flag should point to. -label_flag(name = 'tool', build_setting_default = ":hammer") +# Its default value is the default target this flag should point to. +label_flag( + name = "tool", + build_setting_default = ":hammer", +) # A target that depends on the label flag. toolbox(name = "my-toolbox") # Some targets that are potential values of the label flag. tool(name = "hammer") + tool(name = "screwdriver") diff --git a/configurations/label_typed_build_setting/defs.bzl b/configurations/label_typed_build_setting/defs.bzl index fd9a398a0..e16d311c6 100644 --- a/configurations/label_typed_build_setting/defs.bzl +++ b/configurations/label_typed_build_setting/defs.bzl @@ -1,5 +1,6 @@ ToolInfo = provider(fields = ["type"]) +# buildifier: disable=print def _toolbox_impl(ctx): # Access the label flag attribute and you can expect the providers # of the value of the label flag. diff --git a/configurations/multi_arch_binary/defs.bzl b/configurations/multi_arch_binary/defs.bzl index 33fb96b77..8c1cab4f0 100644 --- a/configurations/multi_arch_binary/defs.bzl +++ b/configurations/multi_arch_binary/defs.bzl @@ -1,6 +1,4 @@ -def _transition_impl(settings, attr): - _ignore = [settings, attr] - +def _transition_impl(_, _): # Return a dict of dicts. The values are the updates to the configuration. # The keys are arbitrary helpful strings that can be used to access the split # targets in the rule context. @@ -20,6 +18,7 @@ fat_transition = transition( outputs = ["//command_line_option:cpu"], ) +# buildifier: disable=print def _rule_impl(ctx): # Access the split dependencies via `ctx.split_attr.`. # See: https://docs.bazel.build/skylark/lib/ctx.html#split_attr. diff --git a/configurations/read_attr_in_transition/BUILD b/configurations/read_attr_in_transition/BUILD index fe5244856..b8c62a5e7 100644 --- a/configurations/read_attr_in_transition/BUILD +++ b/configurations/read_attr_in_transition/BUILD @@ -12,23 +12,29 @@ string_setting( build_setting_default = "abc", ) -my_rule(name = "dont-do-transition", do_transition = False) -my_rule(name = "do-transition", do_transition = True) +my_rule( + name = "dont-do-transition", + do_transition = False, +) + +my_rule( + name = "do-transition", + do_transition = True, +) # This target will cause an issue because it tries to implement -# a rule transition that reads a configured attribute. +# a rule transition that reads a configured attribute. my_rule( name = "will-break", do_transition = select({ ":true": True, "//conditions:default": False, - }) + }), ) config_setting( name = "true", flag_values = { ":some-string": "abc", - } + }, ) - diff --git a/configurations/read_attr_in_transition/defs.bzl b/configurations/read_attr_in_transition/defs.bzl index 78e20a613..4bf0291f3 100644 --- a/configurations/read_attr_in_transition/defs.bzl +++ b/configurations/read_attr_in_transition/defs.bzl @@ -15,6 +15,7 @@ my_transition = transition( outputs = ["//read_attr_in_transition:some-string"], ) +# buildifier: disable=print def _impl(ctx): print(ctx.attr.do_transition) print("value of some-string: " + ctx.attr._some_string[BuildSettingInfo].value) diff --git a/configurations/select_on_build_setting/BUILD b/configurations/select_on_build_setting/BUILD index 403563575..d8af7ea8a 100644 --- a/configurations/select_on_build_setting/BUILD +++ b/configurations/select_on_build_setting/BUILD @@ -5,16 +5,19 @@ # See https://docs.bazel.build/versions/master/skylark/config.html and # https://github.com/bazelbuild/bazel-skylib) for more info. load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load(":defs.bzl", "harvest", "fruit") +load(":defs.bzl", "fruit", "harvest") -string_flag(name = "season", build_setting_default = "spring") +string_flag( + name = "season", + build_setting_default = "spring", +) harvest( - name = 'harvest', + name = "harvest", fruit = select({ ":summer": ":cherries", ":fall": ":pumpkins", - "//conditions:default": ":apples" + "//conditions:default": ":apples", }), ) @@ -22,16 +25,18 @@ config_setting( name = "summer", flag_values = { ":season": "summer", - } + }, ) config_setting( name = "fall", flag_values = { ":season": "fall", - } + }, ) fruit(name = "cherries") + fruit(name = "apples") + fruit(name = "pumpkins") diff --git a/configurations/select_on_build_setting/defs.bzl b/configurations/select_on_build_setting/defs.bzl index 71bd9578f..e80c215f8 100644 --- a/configurations/select_on_build_setting/defs.bzl +++ b/configurations/select_on_build_setting/defs.bzl @@ -1,5 +1,6 @@ FruitInfo = provider(fields = ["type"]) +# buildifier: disable=print def _impl(ctx): print("We're harvesting " + ctx.attr.fruit[FruitInfo].type + "!") diff --git a/configurations/transition_on_native_flag/BUILD b/configurations/transition_on_native_flag/BUILD index 7d059a94c..032a3b4fd 100644 --- a/configurations/transition_on_native_flag/BUILD +++ b/configurations/transition_on_native_flag/BUILD @@ -2,6 +2,12 @@ load(":defs.bzl", "cpu_rule") cpu_rule(name = "foo") -cpu_rule(name = "bar", cpu = "arm") +cpu_rule( + name = "bar", + cpu = "arm", +) -cpu_rule(name = "baz", cpu = "k8") \ No newline at end of file +cpu_rule( + name = "baz", + cpu = "k8", +) diff --git a/configurations/transition_on_native_flag/defs.bzl b/configurations/transition_on_native_flag/defs.bzl index 6dd347a89..fa9cb48a1 100644 --- a/configurations/transition_on_native_flag/defs.bzl +++ b/configurations/transition_on_native_flag/defs.bzl @@ -1,6 +1,4 @@ -def _transition_impl(settings, attr): - _ignore = settings - +def _transition_impl(_, attr): # Attaching the special prefix "//comand_line_option" to the name of a native # flag makes the flag available to transition on. The result of this transition # is to set --cpu @@ -18,6 +16,7 @@ cpu_transition = transition( outputs = ["//command_line_option:cpu"], ) +# buildifier: disable=print def _impl(ctx): # Print the current cpu using `ctx.var` which contains a # dict of configuration variable diff --git a/configurations/use_skylib_build_setting/BUILD b/configurations/use_skylib_build_setting/BUILD index f688d23e8..07f27e2ec 100644 --- a/configurations/use_skylib_build_setting/BUILD +++ b/configurations/use_skylib_build_setting/BUILD @@ -11,7 +11,10 @@ load(":defs.bzl", "dessert") # This can be set on the command line by setting # //use_skylib_build_setting:flavor=. # We declare here that its default value is "strawberry". -string_flag(name = "flavor", build_setting_default = "strawberry") +string_flag( + name = "flavor", + build_setting_default = "strawberry", +) # A rule that depends on `:flavor`which means it can read its value. dessert(name = "ice-cream") diff --git a/configurations/use_skylib_build_setting/defs.bzl b/configurations/use_skylib_build_setting/defs.bzl index d27bcb4f2..a475e5574 100644 --- a/configurations/use_skylib_build_setting/defs.bzl +++ b/configurations/use_skylib_build_setting/defs.bzl @@ -1,6 +1,7 @@ # Load the provider of the pre-made settings defined in bazel_skylib load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo") +# buildifier: disable=print def _impl(ctx): # Access the value of --//use_skylib_build_setting:flavor for the target. print("flavor: " + ctx.attr._flavor[BuildSettingInfo].value) diff --git a/flags-parsing-tutorial/WORKSPACE b/flags-parsing-tutorial/WORKSPACE index 8c518ca76..0983b903d 100644 --- a/flags-parsing-tutorial/WORKSPACE +++ b/flags-parsing-tutorial/WORKSPACE @@ -1 +1 @@ -workspace(name="flags-parsing-examples") +workspace(name = "flags-parsing-examples") diff --git a/flags-parsing-tutorial/build_defs.bzl b/flags-parsing-tutorial/build_defs.bzl index f8920eed0..0e3f2c017 100644 --- a/flags-parsing-tutorial/build_defs.bzl +++ b/flags-parsing-tutorial/build_defs.bzl @@ -3,6 +3,8 @@ BuildSettingInfo = provider() def _string_imp(ctx): value = ctx.build_setting_value label = ctx.label.name + + # buildifier: disable=print print("evaluated value for " + label + ": " + value) return BuildSettingInfo(value = value) diff --git a/java-tutorial/BUILD b/java-tutorial/BUILD index 36adbe194..a9ce70ca8 100644 --- a/java-tutorial/BUILD +++ b/java-tutorial/BUILD @@ -1,4 +1,5 @@ load("@rules_java//java:defs.bzl", "java_binary") + package(default_visibility = ["//visibility:public"]) java_binary( diff --git a/make-variables/testapp/defs.bzl b/make-variables/testapp/defs.bzl index b4a31d2d4..8a080b57e 100644 --- a/make-variables/testapp/defs.bzl +++ b/make-variables/testapp/defs.bzl @@ -1,12 +1,11 @@ def _var_providing_rule_impl(ctx): - return [ - platform_common.TemplateVariableInfo({ - "FOO": ctx.attr.var_value, - }), - ] + return [ + platform_common.TemplateVariableInfo({ + "FOO": ctx.attr.var_value, + }), + ] var_providing_rule = rule( implementation = _var_providing_rule_impl, - attrs = { "var_value": attr.string() } + attrs = {"var_value": attr.string()}, ) - diff --git a/query-quickstart/src/main/java/com/example/customers/BUILD b/query-quickstart/src/main/java/com/example/customers/BUILD index abddc5111..b58a5e5fa 100644 --- a/query-quickstart/src/main/java/com/example/customers/BUILD +++ b/query-quickstart/src/main/java/com/example/customers/BUILD @@ -1,13 +1,13 @@ java_library( name = "amir", - visibility = ["//visibility:public"], srcs = ["Amir.java"], tags = ["pizza"], + visibility = ["//visibility:public"], ) java_library( name = "jenny", - visibility = ["//visibility:public"], srcs = ["Jenny.java"], tags = ["macAndCheese"], + visibility = ["//visibility:public"], ) diff --git a/query-quickstart/src/main/java/com/example/dishes/BUILD b/query-quickstart/src/main/java/com/example/dishes/BUILD index ec9e65551..ad8d7bf43 100644 --- a/query-quickstart/src/main/java/com/example/dishes/BUILD +++ b/query-quickstart/src/main/java/com/example/dishes/BUILD @@ -1,7 +1,7 @@ java_library( name = "macAndCheese", - visibility = ["//visibility:public"], srcs = ["MacAndCheese.java"], + visibility = ["//visibility:public"], deps = [ "//src/main/java/com/example/ingredients:cheese", "//src/main/java/com/example/ingredients:macaroni", @@ -10,8 +10,8 @@ java_library( java_library( name = "pizza", - visibility = ["//visibility:public"], srcs = ["Pizza.java"], + visibility = ["//visibility:public"], deps = [ "//src/main/java/com/example/ingredients:cheese", "//src/main/java/com/example/ingredients:dough", diff --git a/rules/WORKSPACE b/rules/WORKSPACE index 309625382..a8700fc3e 100644 --- a/rules/WORKSPACE +++ b/rules/WORKSPACE @@ -20,15 +20,15 @@ pip_repositories() # Load Skylib 0.9.0 as instructed at # https://github.com/bazelbuild/bazel-skylib/releases/tag/1.0.2 -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel_skylib", + sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", ], - sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", ) + load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() diff --git a/rules/aspect/file_collector.bzl b/rules/aspect/file_collector.bzl index 9ab70d932..1874a9cdc 100644 --- a/rules/aspect/file_collector.bzl +++ b/rules/aspect/file_collector.bzl @@ -8,7 +8,7 @@ FileCollector = provider( fields = {"files": "collected files"}, ) -def _file_collector_aspect_impl(target, ctx): +def _file_collector_aspect_impl(_, ctx): # This function is executed for each dependency the aspect visits. # Collect files from the srcs diff --git a/rules/attributes/printer.bzl b/rules/attributes/printer.bzl index 1a7abf186..8dc9f52c2 100644 --- a/rules/attributes/printer.bzl +++ b/rules/attributes/printer.bzl @@ -1,5 +1,6 @@ """Example of a rule that accesses its attributes.""" +# buildifier: disable=print def _impl(ctx): # Print debug information about the target. print("Target {} has {} deps".format(ctx.label, len(ctx.attr.deps))) diff --git a/rules/empty/empty.bzl b/rules/empty/empty.bzl index b2f7ba257..d378e5f17 100644 --- a/rules/empty/empty.bzl +++ b/rules/empty/empty.bzl @@ -1,8 +1,9 @@ """Minimalist example of a rule that does nothing.""" -def _empty_impl(ctx): +def _empty_impl(_): # This function is called when the rule is analyzed. # You may use print for debugging. + # buildifier: disable=print print("This rule does nothing") empty = rule(implementation = _empty_impl) diff --git a/rules/features/rule.bzl b/rules/features/rule.bzl index e89b60861..3cb62e2c2 100644 --- a/rules/features/rule.bzl +++ b/rules/features/rule.bzl @@ -1,6 +1,7 @@ """This example shows how to access rule features.""" def _impl(ctx): + # buildifier: disable=print print("in {}, the enabled features are {}".format(ctx.label.name, ctx.features)) myrule = rule( diff --git a/rules/generating_code/BUILD b/rules/generating_code/BUILD index bc128ab25..d2c59ffa7 100644 --- a/rules/generating_code/BUILD +++ b/rules/generating_code/BUILD @@ -2,9 +2,9 @@ load("//generating_code/gen:enum_maker.bzl", "enum_maker") enum_maker( name = "gen_enums", - values_file = "values.txt", - out_py = "values.py", out_h = "values.h", + out_py = "values.py", + values_file = "values.txt", ) py_library( diff --git a/rules/generating_code/gen/enum_maker.bzl b/rules/generating_code/gen/enum_maker.bzl index a004dfee2..edcf1a1dd 100644 --- a/rules/generating_code/gen/enum_maker.bzl +++ b/rules/generating_code/gen/enum_maker.bzl @@ -27,8 +27,8 @@ enum_maker = rule( implementation = _impl, attrs = { "values_file": attr.label( - allow_single_file = True, - mandatory = True, + allow_single_file = True, + mandatory = True, ), "out_py": attr.output(), "out_h": attr.output(), diff --git a/third-party-dependencies/BUILD b/third-party-dependencies/BUILD index 605c56ba5..42adb7711 100644 --- a/third-party-dependencies/BUILD +++ b/third-party-dependencies/BUILD @@ -1,5 +1,5 @@ -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") package(default_visibility = ["//visibility:public"]) diff --git a/third-party-dependencies/third_party/bazel_skylib/direct.bzl b/third-party-dependencies/third_party/bazel_skylib/direct.bzl index 6cd1c0d27..bd2b26c7a 100644 --- a/third-party-dependencies/third_party/bazel_skylib/direct.bzl +++ b/third-party-dependencies/third_party/bazel_skylib/direct.bzl @@ -2,8 +2,8 @@ Dependency to Bazel standard library Skylib """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_bazel_skylib(): maybe( diff --git a/third-party-dependencies/third_party/buildtools/direct.bzl b/third-party-dependencies/third_party/buildtools/direct.bzl index 0efd5891b..9433c2906 100644 --- a/third-party-dependencies/third_party/buildtools/direct.bzl +++ b/third-party-dependencies/third_party/buildtools/direct.bzl @@ -2,8 +2,8 @@ Dependency to bazel buildtools where buildifier is located """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_buildtools(): # It is not clear in Bazel what is the best practice for using http_archive. diff --git a/third-party-dependencies/third_party/catch2/direct.bzl b/third-party-dependencies/third_party/catch2/direct.bzl index 9d89da4e6..7828b8e30 100644 --- a/third-party-dependencies/third_party/catch2/direct.bzl +++ b/third-party-dependencies/third_party/catch2/direct.bzl @@ -2,8 +2,8 @@ Dependency to catch2, a unit test framework for C++ """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_catch2(): # It is not clear in Bazel what is the best practice for using http_archive. diff --git a/third-party-dependencies/third_party/gtest/direct.bzl b/third-party-dependencies/third_party/gtest/direct.bzl index 0ce2cb9f7..ec434695b 100644 --- a/third-party-dependencies/third_party/gtest/direct.bzl +++ b/third-party-dependencies/third_party/gtest/direct.bzl @@ -2,8 +2,8 @@ Dependency to gtest (google test), a unit test framework for C++ """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_gtest(): # It is not clear in Bazel what is the best practice for using http_archive. diff --git a/third-party-dependencies/third_party/protobuf/direct.bzl b/third-party-dependencies/third_party/protobuf/direct.bzl index 77e0180dd..205550c4e 100644 --- a/third-party-dependencies/third_party/protobuf/direct.bzl +++ b/third-party-dependencies/third_party/protobuf/direct.bzl @@ -2,8 +2,8 @@ Dependency to protobuf, Google's data interchange format """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_protobuf(): # It is not clear in Bazel what is the best practice for using http_archive. diff --git a/third-party-dependencies/third_party/rules_go/direct.bzl b/third-party-dependencies/third_party/rules_go/direct.bzl index 3693c711b..86885a1ef 100644 --- a/third-party-dependencies/third_party/rules_go/direct.bzl +++ b/third-party-dependencies/third_party/rules_go/direct.bzl @@ -2,8 +2,8 @@ Dependency to bazel rules for Go language """ -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") def load_rules_go(): # It is not clear in Bazel what is the best practice for using http_archive. diff --git a/third-party-dependencies/third_party/rules_go/transitive.bzl b/third-party-dependencies/third_party/rules_go/transitive.bzl index 12fdb3e66..c61ad7ec1 100644 --- a/third-party-dependencies/third_party/rules_go/transitive.bzl +++ b/third-party-dependencies/third_party/rules_go/transitive.bzl @@ -2,8 +2,8 @@ Transitive dependencies for rules_go """ -load("//third_party/protobuf:transitive.bzl", "load_protobuf_transitive_dependencies") load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") +load("//third_party/protobuf:transitive.bzl", "load_protobuf_transitive_dependencies") def load_rules_go_transitive_dependencies(): load_protobuf_transitive_dependencies() diff --git a/tutorial/BUILD b/tutorial/BUILD index cd012408c..747a316e7 100644 --- a/tutorial/BUILD +++ b/tutorial/BUILD @@ -13,8 +13,8 @@ config_setting( filegroup( name = "all", srcs = [ - "//backend", "//android", + "//backend", ] + select({ ":darwin": ["//ios-app"], ":darwin_x86_64": ["//ios-app"], diff --git a/tutorial/backend/BUILD b/tutorial/backend/BUILD index 570c5c6f1..9781a0bca 100644 --- a/tutorial/backend/BUILD +++ b/tutorial/backend/BUILD @@ -1,5 +1,5 @@ -load("@rules_java//java:defs.bzl", "java_binary") load("@io_bazel_rules_appengine//appengine:appengine.bzl", "appengine_war") +load("@rules_java//java:defs.bzl", "java_binary") package(default_visibility = ["//visibility:public"]) diff --git a/tutorial/ios-app/BUILD b/tutorial/ios-app/BUILD index 541075cb9..5ace72b51 100644 --- a/tutorial/ios-app/BUILD +++ b/tutorial/ios-app/BUILD @@ -1,5 +1,5 @@ -load("@rules_cc//cc:defs.bzl", "objc_library") load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") +load("@rules_cc//cc:defs.bzl", "objc_library") load( "@rules_xcodeproj//xcodeproj:defs.bzl", "top_level_target", @@ -39,7 +39,10 @@ xcodeproj( top_level_targets = [ top_level_target( ":ios-app", - target_environments = ["device", "simulator"], + target_environments = [ + "device", + "simulator", + ], ), ], )