diff --git a/.bazelrc b/.bazelrc index 47a211d4..afcad33b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,6 +2,7 @@ common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig common --@aspect_rules_ts//ts:default_to_tsc_transpiler common --noincompatible_check_sharding_support +common --incompatible_disable_autoloads_in_main_repo # Remove once proto toolchainization becomes the default # - https://bazel.build/reference/command-line-reference#flag--incompatible_enable_proto_toolchain_resolution diff --git a/MODULE.bazel b/MODULE.bazel index 795f1e76..e5d50b76 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -174,3 +174,5 @@ scala_protoc = use_extension( dev_dependency = True, ) use_repo(scala_protoc, "rules_scala_protoc_toolchains") + +bazel_dep(name = "rules_shell", version = "0.4.1") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 7fd1d992..b69de704 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -307,7 +307,8 @@ "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", "https://bcr.bazel.build/modules/rules_shell/0.4.0/MODULE.bazel": "0f8f11bb3cd11755f0b48c1de0bbcf62b4b34421023aa41a2fc74ef68d9584f0", - "https://bcr.bazel.build/modules/rules_shell/0.4.0/source.json": "1d7fa7f941cd41dc2704ba5b4edc2e2230eea1cc600d80bd2b65838204c50b95", + "https://bcr.bazel.build/modules/rules_shell/0.4.1/MODULE.bazel": "00e501db01bbf4e3e1dd1595959092c2fadf2087b2852d3f553b5370f5633592", + "https://bcr.bazel.build/modules/rules_shell/0.4.1/source.json": "4757bd277fe1567763991c4425b483477bb82e35e777a56fd846eb5cceda324a", "https://bcr.bazel.build/modules/rules_swift/1.16.0/MODULE.bazel": "4a09f199545a60d09895e8281362b1ff3bb08bbde69c6fc87aff5b92fcc916ca", "https://bcr.bazel.build/modules/rules_swift/1.18.0/MODULE.bazel": "a6aba73625d0dc64c7b4a1e831549b6e375fbddb9d2dde9d80c9de6ec45b24c9", "https://bcr.bazel.build/modules/rules_swift/2.1.1/MODULE.bazel": "494900a80f944fc7aa61500c2073d9729dff0b764f0e89b824eb746959bc1046", diff --git a/buck2/cpp/platforms/defs.bzl b/buck2/cpp/platforms/defs.bzl index 830d53fb..fb39e319 100644 --- a/buck2/cpp/platforms/defs.bzl +++ b/buck2/cpp/platforms/defs.bzl @@ -61,14 +61,14 @@ platforms = rule( attrs = { "cpu_configuration": attrs.dep(providers = [ConfigurationInfo]), "os_configuration": attrs.dep(providers = [ConfigurationInfo]), - }, - impl = _platforms + }, + impl = _platforms, ) action_keys = rule( - attrs = { + attrs = { "cell": attrs.string(), "mode": attrs.string(), - }, - impl = _action_keys + }, + impl = _action_keys, ) diff --git a/buck2/golang/platforms/defs.bzl b/buck2/golang/platforms/defs.bzl index 59fee93d..d0afeb35 100644 --- a/buck2/golang/platforms/defs.bzl +++ b/buck2/golang/platforms/defs.bzl @@ -58,13 +58,13 @@ def _action_keys(ctx): platforms = rule( attrs = {}, - impl = _platforms + impl = _platforms, ) action_keys = rule( - attrs = { + attrs = { "cell": attrs.string(), "mode": attrs.string(), - }, - impl = _action_keys + }, + impl = _action_keys, ) diff --git a/buck2/golang/toolchains/defs.bzl b/buck2/golang/toolchains/defs.bzl index f6dd2190..468ea18a 100644 --- a/buck2/golang/toolchains/defs.bzl +++ b/buck2/golang/toolchains/defs.bzl @@ -17,7 +17,7 @@ load("@prelude//go_bootstrap:go_bootstrap.bzl", "GoBootstrapToolchainInfo") load("@prelude//utils:cmd_script.bzl", "ScriptOs", "cmd_script") def _remote_go_bootstrap_toolchain_impl(ctx): - go_arch = "amd64" + go_arch = "amd64" go_os = "linux" script_os = ScriptOs("unix") @@ -47,7 +47,7 @@ remote_go_bootstrap_toolchain = rule( ) def _remote_go_toolchain_impl(ctx): - go_arch = "amd64" + go_arch = "amd64" go_os = "linux" script_os = ScriptOs("unix") @@ -76,7 +76,6 @@ def _remote_go_toolchain_impl(ctx): compiler_flags = [], ), ] - remote_go_toolchain = rule( impl = _remote_go_toolchain_impl, diff --git a/buck2/python/platforms/defs.bzl b/buck2/python/platforms/defs.bzl index ffc1429a..d93a8bd7 100644 --- a/buck2/python/platforms/defs.bzl +++ b/buck2/python/platforms/defs.bzl @@ -56,13 +56,13 @@ def _action_keys(ctx): platforms = rule( attrs = {}, - impl = _platforms + impl = _platforms, ) action_keys = rule( - attrs = { + attrs = { "cell": attrs.string(), "mode": attrs.string(), - }, - impl = _action_keys + }, + impl = _action_keys, ) diff --git a/buck2/python/toolchains/defs.bzl b/buck2/python/toolchains/defs.bzl index c64656de..003595f5 100644 --- a/buck2/python/toolchains/defs.bzl +++ b/buck2/python/toolchains/defs.bzl @@ -59,7 +59,6 @@ remote_python_toolchain = rule( "_make_source_db": attrs.default_only(attrs.dep(providers = [RunInfo], default = "prelude//python/tools:make_source_db")), "_make_source_db_no_deps": attrs.default_only(attrs.dep(providers = [RunInfo], default = "prelude//python/tools:make_source_db_no_deps")), "_runtime_library": attrs.default_only(attrs.dep(providers = [ArtifactGroupInfo], default = "prelude//python/runtime:bootstrap_files")), - }, is_toolchain_rule = True, ) diff --git a/buck2/rust/platforms/defs.bzl b/buck2/rust/platforms/defs.bzl index 3e52d51b..f49a4283 100644 --- a/buck2/rust/platforms/defs.bzl +++ b/buck2/rust/platforms/defs.bzl @@ -62,14 +62,14 @@ platforms = rule( attrs = { "cpu_configuration": attrs.dep(providers = [ConfigurationInfo]), "os_configuration": attrs.dep(providers = [ConfigurationInfo]), - }, - impl = _platforms + }, + impl = _platforms, ) action_keys = rule( - attrs = { + attrs = { "cell": attrs.string(), "mode": attrs.string(), - }, - impl = _action_keys + }, + impl = _action_keys, ) diff --git a/buck2/rust/toolchains/defs.bzl b/buck2/rust/toolchains/defs.bzl index e6b2a8f3..0ad01b2b 100644 --- a/buck2/rust/toolchains/defs.bzl +++ b/buck2/rust/toolchains/defs.bzl @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@prelude//cxx:cxx_toolchain_types.bzl", "LinkerType") load("@prelude//rust:rust_toolchain.bzl", "PanicRuntime", "RustToolchainInfo") load("@prelude//rust/tools:attrs.bzl", "internal_tool_attrs") -load("@prelude//cxx:cxx_toolchain_types.bzl", "LinkerType") load("@prelude//toolchains:cxx.bzl", "CxxToolsInfo") # This def is similar to the one in https://github.com/facebook/buck2/blob/804d62242214455d51787f7c8c96a1e12c75ec32/prelude/toolchains/cxx/clang/tools.bzl @@ -42,7 +42,7 @@ path_clang_tools = rule( attrs = {}, ) -def _remote_rust_toolchain_impl(ctx): +def _remote_rust_toolchain_impl(ctx): return [ DefaultInfo(), RustToolchainInfo( diff --git a/bzlmod/canonical-repo-name-injection/BUILD b/bzlmod/canonical-repo-name-injection/BUILD index 4f267caa..6021a863 100644 --- a/bzlmod/canonical-repo-name-injection/BUILD +++ b/bzlmod/canonical-repo-name-injection/BUILD @@ -12,16 +12,16 @@ # License for the specific language governing permissions and limitations under # the License. +load("@bazel_skylib//rules:common_settings.bzl", "string_flag") +load("@rules_js//js:defs.bzl", "js_binary") load( "//:repo-names.bzl", "canonical_repo", - "workspace_root", - "repo_name_variable", - "repo_dir_variable", "gen_js_constants", + "repo_dir_variable", + "repo_name_variable", + "workspace_root", ) -load("@bazel_skylib//rules:common_settings.bzl", "string_flag") -load("@rules_js//js:defs.bzl", "js_binary") # This value propagates through the rules below. # Try it with other targets of your choosing! @@ -37,8 +37,10 @@ genrule( name = "repo-macros", outs = ["repo-macros.txt"], cmd = "printf '%s\n canonical_name: %s\n workspace_root: %s\n' >$@" % ( - repo_target, canonical_repo(repo_target), workspace_root(repo_target) - ) + repo_target, + canonical_repo(repo_target), + workspace_root(repo_target), + ), ) # Demonstrates the custom Make variable-based approach. Depends on the @@ -54,7 +56,7 @@ genrule( toolchains = [ ":repo-name", ":repo-dir", - ] + ], ) # This alias demonstrates how the rules from `repo-names.bzl` work with resolved @@ -97,22 +99,22 @@ repo_dir_variable( # - where the repo dir is found when running under `bazel run` vs `node` js_binary( name = "repo-dir-check", - entry_point = "repo-dir-check.mjs", data = [ - ":constants-impl", - repo_target, + ":constants-impl", + repo_target, ], + entry_point = "repo-dir-check.mjs", ) # Determines which rule generates the `constants.js` module used by # `:repo-dir-check`, based on the value of the `--//:constants` flag. genrule( name = "constants-impl", - outs = ["constants.js"], srcs = select({ - ":genrule": [":genrule-constants"], + ":genrule": [":genrule-constants"], ":custom-rule": [":custom-rule-constants"], }), + outs = ["constants.js"], cmd = "cp $< $@", ) @@ -120,11 +122,11 @@ genrule( # selects `:genrule-constants` or `:custom-rule-constants` as input. string_flag( name = "constants", + build_setting_default = "genrule", values = [ "genrule", "custom-rule", ], - build_setting_default = "genrule", ) config_setting( @@ -152,7 +154,7 @@ genrule( name = "genrule-constants", srcs = [":repo-target"], outs = ["genrule-constants.js"], - cmd = r"""printf 'module.exports.%%s;\n' \ + cmd = r"""printf 'module.exports.%%s;\n' \ 'ruleName = "genrule-constants"' \ 'target = "%s"' \ 'binDir = "$(BINDIR)"' \ @@ -161,10 +163,10 @@ genrule( 'macroDir = "%s"' \ 'repoName = "$(repo-name)"' \ 'repoDir = "$(repo-dir)"' >$@""" % ( - repo_target, - canonical_repo(repo_target), - workspace_root(repo_target) - ), + repo_target, + canonical_repo(repo_target), + workspace_root(repo_target), + ), toolchains = [ ":repo-name", ":repo-dir", @@ -191,14 +193,14 @@ genrule( # Replacing `repo_target` with the string ":repo-target" in the macros below # will produce the empty string, since the macros won't see the resolved alias. gen_js_constants( - name = "custom-rule-constants", - deps = [":repo-target"], - vars = { - "target": repo_target, - "location": "$(rlocationpaths :repo-target)", + name = "custom-rule-constants", + repo_dirs = {":repo-target": "repoDir"}, + repo_names = {":repo-target": "repoName"}, + vars = { + "target": repo_target, + "location": "$(rlocationpaths :repo-target)", "macroName": canonical_repo(repo_target), - "macroDir": workspace_root(repo_target), + "macroDir": workspace_root(repo_target), }, - repo_names = {":repo-target": "repoName"}, - repo_dirs = {":repo-target": "repoDir"}, + deps = [":repo-target"], ) diff --git a/bzlmod/canonical-repo-name-injection/MODULE.bazel b/bzlmod/canonical-repo-name-injection/MODULE.bazel index 1c1544fc..43f4b952 100644 --- a/bzlmod/canonical-repo-name-injection/MODULE.bazel +++ b/bzlmod/canonical-repo-name-injection/MODULE.bazel @@ -15,7 +15,10 @@ """Example module for canonical repo name injection""" # Main module -module(name = "frobozz", version = "1.2.3") +module( + name = "frobozz", + version = "1.2.3", +) # aspect_rules_js bazel_dep(name = "aspect_rules_js", version = "2.0.1", repo_name = "rules_js") diff --git a/bzlmod/canonical-repo-name-injection/repo-names.bzl b/bzlmod/canonical-repo-name-injection/repo-names.bzl index ad7b0c92..d83a0fcf 100644 --- a/bzlmod/canonical-repo-name-injection/repo-names.bzl +++ b/bzlmod/canonical-repo-name-injection/repo-names.bzl @@ -37,7 +37,8 @@ def _variable_info(ctx, value): repo_name_variable = rule( implementation = lambda ctx: _variable_info( - ctx, ctx.attr.dep.label.repo_name + ctx, + ctx.attr.dep.label.repo_name, ), doc = "Defines a custom variable for its dependency's repository name", attrs = { @@ -50,7 +51,8 @@ repo_name_variable = rule( repo_dir_variable = rule( implementation = lambda ctx: _variable_info( - ctx, ctx.attr.dep.label.workspace_root + ctx, + ctx.attr.dep.label.workspace_root, ), doc = "Defines a custom variable for its dependency's repository dir", attrs = { @@ -96,7 +98,7 @@ def _runfiles(ctx, sources, deps): def _gen_js_constants_impl(ctx): """Generate a JavaScript module exporting specified constants.""" - items = {"ruleName": ctx.attr.name, "binDir": ctx.bin_dir.path} + items = {"ruleName": ctx.attr.name, "binDir": ctx.bin_dir.path} items |= {k: ctx.expand_location(v) for k, v in ctx.attr.vars.items()} items |= {v: k.label.repo_name for k, v in ctx.attr.repo_names.items()} items |= {v: k.label.workspace_root for k, v in ctx.attr.repo_dirs.items()} @@ -108,8 +110,8 @@ def _gen_js_constants_impl(ctx): sources = depset([outfile]) deps = ctx.attr.deps + \ - ctx.attr.repo_names.keys() + \ - ctx.attr.repo_dirs.keys() + ctx.attr.repo_names.keys() + \ + ctx.attr.repo_dirs.keys() return [ _js_info(ctx.label, sources, deps), diff --git a/cpp/BUILD b/cpp/BUILD index 34cabf1b..eab1ab18 100644 --- a/cpp/BUILD +++ b/cpp/BUILD @@ -1,3 +1,7 @@ +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("@rules_cc//cc:cc_test.bzl", "cc_test") + cc_binary( name = "cpp", srcs = ["main.cc"], @@ -14,7 +18,7 @@ cc_library( cc_test( name = "cpp_test", + size = "small", srcs = ["hello_test.cc"], deps = [":cpp_lib"], - size = "small", ) diff --git a/docker/network/BUILD b/docker/network/BUILD index d7eecc69..520957a0 100644 --- a/docker/network/BUILD +++ b/docker/network/BUILD @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_java//java:java_test.bzl", "java_test") +load("@rules_java//java/toolchains:java_runtime.bzl", "java_runtime") + # Built from "Dockerfile" # TODO: edit this value to match your Docker registry, image name, and digest DOCKER_JDK_PSQL = "docker://gcr.io/YOUR-IMAGE-NAME@sha256:b6ed8f68abd6e23409ee7a500c2c50a8064cea11071ac447a59b88e6afa4c220" diff --git a/docker/sandbox/BUILD b/docker/sandbox/BUILD index 3ffe0fa1..167df89f 100644 --- a/docker/sandbox/BUILD +++ b/docker/sandbox/BUILD @@ -1,3 +1,6 @@ +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_java//java:java_binary.bzl", "java_binary") + genrule( name = "hello", srcs = ["dep%d" % i for i in range(3)], diff --git a/docker/sysbox/dind_test/BUILD b/docker/sysbox/dind_test/BUILD index a3fdb46b..076ea9c4 100644 --- a/docker/sysbox/dind_test/BUILD +++ b/docker/sysbox/dind_test/BUILD @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_shell//shell:sh_test.bzl", "sh_test") + sh_test( name = "check_docker", srcs = ["check_docker.sh"], @@ -19,7 +21,7 @@ sh_test( # Replace the container-image below to use the one you created. "container-image": "docker://645088952840.dkr.ecr.eu-west-1.amazonaws.com/engflow-ci/debian12-dind-x64@sha256:e9715893e041427c283808db96760634b47b276d35bef4fc2af3990553f94262", "dockerRuntime": "sysbox-runc", - "Pool": "ci_sysbox_x64", # this can change depending on what pool has sysbox enabled + "Pool": "ci_sysbox_x64", # this can change depending on what pool has sysbox enabled "dockerNetwork": "standard", # DO NOT ENABLE!!! "dockerSiblingContainers": "True", # it will cause the worker to mount /var/run/docker.sock @@ -28,5 +30,5 @@ sh_test( # DO NOT ENABLE!!! "dockerPrivileged": "True", # sysbox containers will refuse to start }, - tags = ["manual"] + tags = ["manual"], ) diff --git a/infra/msvc_filter_showincludes/BUILD b/infra/msvc_filter_showincludes/BUILD index 7f47c2eb..20847520 100644 --- a/infra/msvc_filter_showincludes/BUILD +++ b/infra/msvc_filter_showincludes/BUILD @@ -20,8 +20,8 @@ go_binary( go_test( name = "msvc_filter_showincludes_test", + size = "small", srcs = ["msvc_filter_showincludes_test.go"], embed = [":msvc_filter_showincludes_lib"], deps = ["@com_github_google_go_cmp//cmp"], - size = "small", ) diff --git a/java/com/engflow/binaryinput/BUILD b/java/com/engflow/binaryinput/BUILD index 8252be0e..44a15c24 100644 --- a/java/com/engflow/binaryinput/BUILD +++ b/java/com/engflow/binaryinput/BUILD @@ -9,24 +9,37 @@ NUM_FILES = 100 name = "Hello" + str(x), outs = ["Hello" + str(x) + ".java"], cmd_bash = "echo 'package com.engflow.binaryinput;" + "\n" + - "public class Hello" + str(x) + - " { public static void greetNum() { System.out.println(\"Hello " + str(x) + "\"); } }' > $@", -) for x in range(1,NUM_FILES+1)] + "public class Hello" + str(x) + + " { public static void greetNum() { System.out.println(\"Hello " + str(x) + "\"); } }' > $@", +) for x in range( + 1, + NUM_FILES + 1, +)] # Generates a java library that contains all the generated java files [java_library( name = "genbinary" + str(x), - srcs = [":Hello" + str(x) + ".java" for x in range(1,NUM_FILES+1)], + srcs = [":Hello" + str(x) + ".java" for x in range( + 1, + NUM_FILES + 1, + )], visibility = ["//visibility:public"], -) for x in range(1,NUM_FILES+1)] +) for x in range( + 1, + NUM_FILES + 1, +)] # Main class java_binary( name = "main", srcs = ["Main.java"], + args = [str(NUM_FILES)], main_class = "com.engflow.binaryinput.Main", deps = [ - ":genbinary" + str(x) for x in range(1,NUM_FILES+1) + ":genbinary" + str(x) + for x in range( + 1, + NUM_FILES + 1, + ) ], - args = [str(NUM_FILES)], -) \ No newline at end of file +) diff --git a/java/com/engflow/example/BUILD b/java/com/engflow/example/BUILD index ffb354e1..396b5a09 100644 --- a/java/com/engflow/example/BUILD +++ b/java/com/engflow/example/BUILD @@ -1,3 +1,6 @@ +load("@rules_java//java:java_library.bzl", "java_library") +load("@rules_java//java:java_test.bzl", "java_test") + package(default_visibility = ["//visibility:public"]) java_library( @@ -7,7 +10,7 @@ java_library( java_test( name = "ExampleTest", + size = "small", srcs = ["ExampleTest.java"], deps = [":example"], - size = "small", ) diff --git a/java/com/engflow/notificationqueue/BUILD b/java/com/engflow/notificationqueue/BUILD index a7b15da8..e9b5586f 100644 --- a/java/com/engflow/notificationqueue/BUILD +++ b/java/com/engflow/notificationqueue/BUILD @@ -1,6 +1,7 @@ -package(default_visibility = ["//visibility:public"]) - load("@grpc-java//:java_grpc_library.bzl", "java_grpc_library") +load("@rules_java//java:java_binary.bzl", "java_binary") + +package(default_visibility = ["//visibility:public"]) java_binary( name = "client", @@ -13,8 +14,6 @@ java_binary( "//java/com/engflow/notificationqueue/demoserver:server_java_grpc_proto", "//java/com/engflow/notificationqueue/demoserver:server_java_proto", "//java/com/engflow/notificationqueue/demoserver:server_proto", - "@protobuf//:any_proto", - "@protobuf//java/core", "@engflowapis-java//engflow/eventstore/v1", "@engflowapis-java//engflow/notification/v1", "@grpc-java//api", @@ -25,5 +24,7 @@ java_binary( "@maven//:com_google_guava_guava", "@maven//:commons_cli_commons_cli", "@maven//:io_netty_netty_handler", + "@protobuf//:any_proto", + "@protobuf//java/core", ], ) diff --git a/java/com/engflow/notificationqueue/demoserver/BUILD b/java/com/engflow/notificationqueue/demoserver/BUILD index 95e482e8..3d51a2ef 100644 --- a/java/com/engflow/notificationqueue/demoserver/BUILD +++ b/java/com/engflow/notificationqueue/demoserver/BUILD @@ -1,6 +1,9 @@ -package(default_visibility = ["//visibility:public"]) - load("@grpc-java//:java_grpc_library.bzl", "java_grpc_library") +load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library") +load("@protobuf//bazel:proto_library.bzl", "proto_library") +load("@rules_java//java:java_binary.bzl", "java_binary") + +package(default_visibility = ["//visibility:public"]) proto_library( name = "server_proto", diff --git a/platform/linux_x64/BUILD b/platform/linux_x64/BUILD index d8805818..75fefa47 100644 --- a/platform/linux_x64/BUILD +++ b/platform/linux_x64/BUILD @@ -1,5 +1,5 @@ -load(":cc_toolchain_config.bzl", "cc_toolchain_config") load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite") +load(":cc_toolchain_config.bzl", "cc_toolchain_config") package(default_visibility = ["//visibility:public"]) @@ -33,13 +33,13 @@ toolchain( cc_toolchain_suite( name = "toolchain", + target_compatible_with = [ + "@platforms//os:linux", + ], toolchains = { "k8|clang": ":cc-compiler-k8", "k8": ":cc-compiler-k8", }, - target_compatible_with = [ - "@platforms//os:linux", - ], ) cc_toolchain( diff --git a/platform/linux_x64/cc_toolchain_config.bzl b/platform/linux_x64/cc_toolchain_config.bzl index 26119141..399eceb8 100644 --- a/platform/linux_x64/cc_toolchain_config.bzl +++ b/platform/linux_x64/cc_toolchain_config.bzl @@ -14,6 +14,7 @@ """A Starlark cc_toolchain configuration rule""" +load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") load( "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "action_config", @@ -26,7 +27,7 @@ load( "variable_with_value", "with_feature_set", ) -load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") +load("@rules_cc//cc/common:cc_common.bzl", "cc_common") def layering_check_features(compiler): if compiler != "clang": diff --git a/platform/windows_x64/BUILD b/platform/windows_x64/BUILD index d52c1a56..a7f66424 100644 --- a/platform/windows_x64/BUILD +++ b/platform/windows_x64/BUILD @@ -1,5 +1,5 @@ -load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config") load("@rules_cc//cc:defs.bzl", "cc_toolchain", "cc_toolchain_suite") +load(":windows_cc_toolchain_config.bzl", "cc_toolchain_config") package(default_visibility = ["//visibility:public"]) @@ -35,13 +35,13 @@ toolchain( cc_toolchain_suite( name = "toolchain", + target_compatible_with = [ + "@platforms//os:windows", + ], toolchains = { "x64_windows|msvc": ":msvc_cc_toolchain", "x64_windows": ":msvc_cc_toolchain", }, - target_compatible_with = [ - "@platforms//os:windows", - ], ) cc_toolchain( diff --git a/platform/windows_x64/windows_cc_toolchain_config.bzl b/platform/windows_x64/windows_cc_toolchain_config.bzl index 2f8e2b37..d5750de0 100644 --- a/platform/windows_x64/windows_cc_toolchain_config.bzl +++ b/platform/windows_x64/windows_cc_toolchain_config.bzl @@ -14,6 +14,7 @@ """A Starlark cc_toolchain configuration rule for Windows""" +load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") load( "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "action_config", @@ -28,7 +29,7 @@ load( "variable_with_value", "with_feature_set", ) -load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES") +load("@rules_cc//cc/common:cc_common.bzl", "cc_common") all_compile_actions = [ ACTION_NAMES.c_compile, diff --git a/python/BUILD b/python/BUILD index 767a4e14..2903d1b3 100644 --- a/python/BUILD +++ b/python/BUILD @@ -19,13 +19,13 @@ py_binary( # `--test_filter` values are as in https://docs.python.org/3/library/unittest.html#cmdoption-unittest-k py_test( name = "hello_absl_test", + size = "small", srcs = ["hello_absl_test.py"], shard_count = 2, deps = [ ":hello", "@io_abseil_py//absl/testing:absltest", ], - size = "small", ) # This wrapper supports sharding, fast-failing and test filtering: try @@ -33,18 +33,18 @@ py_test( # This corresponds to Pytest's `-k` flag: see https://docs.pytest.org/en/latest/reference/reference.html#command-line-flags pytest_test( name = "hello_pytest_test", + size = "small", srcs = ["hello_pytest_test.py"], shard_count = 2, tags = ["todo-pe1188-remote-incompatible"], deps = [":hello"], - size = "small", ) py_test( name = "hello_unittest_test", + size = "small", srcs = ["hello_unittest_test.py"], deps = [":hello"], - size = "small", ) # Utility to help re-generate requirements lock. diff --git a/python/pytest/BUILD b/python/pytest/BUILD index ae95420b..d9df9b69 100644 --- a/python/pytest/BUILD +++ b/python/pytest/BUILD @@ -1,4 +1,5 @@ load("@pip//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_library") py_library( name = "pytest_runner", diff --git a/python/pytest/pytest.bzl b/python/pytest/pytest.bzl index 61af0120..a189c8a1 100644 --- a/python/pytest/pytest.bzl +++ b/python/pytest/pytest.bzl @@ -14,7 +14,8 @@ def pytest_test(name, srcs = [], deps = [], args = [], **kwargs): # Avoid collecting tests automatically; use what's in `srcs`. "--ignore=.", ] + [ - "$(location %s)" % src for src in srcs + "$(location %s)" % src + for src in srcs ] + args py_test( diff --git a/runfiles/engflow/BUILD b/runfiles/engflow/BUILD index 72b28673..b1993637 100644 --- a/runfiles/engflow/BUILD +++ b/runfiles/engflow/BUILD @@ -1,21 +1,23 @@ +load("@rules_python//python:defs.bzl", "py_binary") + py_binary( name = "runfiles_demo", srcs = ["runfiles_demo.py"], - deps = ["@rules_python//python/runfiles"], - data = [ - "//data", - "@frobozz//:files", - ], # Demonstrate using rlocationpaths in "args". If you prefer, you can put # all of these in "env". args = [ "$(rlocationpaths //data)", ], + data = [ + "//data", + "@frobozz//:files", + ], # Demonstrate using rlocationpaths in "env". If you prefer, you can put # all of these in "args". env = { "RUNFILE_PATHS": "$(rlocationpaths @frobozz//:files)", }, + deps = ["@rules_python//python/runfiles"], ) genrule( diff --git a/runfiles/engflow/MODULE.bazel b/runfiles/engflow/MODULE.bazel index fa22d92a..5202dbc9 100644 --- a/runfiles/engflow/MODULE.bazel +++ b/runfiles/engflow/MODULE.bazel @@ -1,8 +1,14 @@ # Note: Not our actual MODULE.bazel -module(name = "engflow", version = "0.0.0") +module( + name = "engflow", + version = "0.0.0", +) bazel_dep(name = "frobozz") -local_path_override(module_name = "frobozz", path = "../frobozz") +local_path_override( + module_name = "frobozz", + path = "../frobozz", +) bazel_dep(name = "rules_python", version = "0.34.0") diff --git a/runfiles/engflow/data/BUILD b/runfiles/engflow/data/BUILD index 65175863..067e47e1 100644 --- a/runfiles/engflow/data/BUILD +++ b/runfiles/engflow/data/BUILD @@ -1,10 +1,10 @@ filegroup( - name = "data", - srcs = glob(["*.txt"]), - visibility = ["//visibility:public"], + name = "data", + srcs = glob(["*.txt"]), + visibility = ["//visibility:public"], ) exports_files( - ["0-foo.txt"], - visibility = ["//visibility:public"], + ["0-foo.txt"], + visibility = ["//visibility:public"], ) diff --git a/runfiles/frobozz/BUILD b/runfiles/frobozz/BUILD index b95b673a..239fb3ca 100644 --- a/runfiles/frobozz/BUILD +++ b/runfiles/frobozz/BUILD @@ -1,10 +1,10 @@ filegroup( - name = "files", - srcs = glob(["*.txt"]), - visibility = ["//visibility:public"], + name = "files", + srcs = glob(["*.txt"]), + visibility = ["//visibility:public"], ) exports_files( - ["1-gue.txt"], - visibility = ["//visibility:public"], + ["1-gue.txt"], + visibility = ["//visibility:public"], ) diff --git a/runfiles/frobozz/MODULE.bazel b/runfiles/frobozz/MODULE.bazel index c650b327..7ac08b7a 100644 --- a/runfiles/frobozz/MODULE.bazel +++ b/runfiles/frobozz/MODULE.bazel @@ -1 +1,4 @@ -module(name = "frobozz", version = "1.0.0") +module( + name = "frobozz", + version = "1.0.0", +) diff --git a/scala/com/engflow/example/BUILD b/scala/com/engflow/example/BUILD index 45e9cd45..4ea27993 100644 --- a/scala/com/engflow/example/BUILD +++ b/scala/com/engflow/example/BUILD @@ -7,7 +7,7 @@ scala_library( scala_test( name = "exampleScalaTest", + size = "small", srcs = ["ScalaExampleTest.scala"], deps = [":exampleScala"], - size = "small", ) diff --git a/swift/BUILD b/swift/BUILD index 45aa9c27..c5d89e1c 100644 --- a/swift/BUILD +++ b/swift/BUILD @@ -2,10 +2,10 @@ load("@rules_swift//swift:swift.bzl", "swift_test") swift_test( name = "tests", + size = "small", srcs = [ "example.swift", "main.swift", ], - size = "small", tags = ["manual"], )