From 5cf777daada01ab8c846165fc1e3b69b7adc60bf Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Fri, 1 Nov 2019 17:30:09 +0100 Subject: [PATCH 1/3] Add rules_cc, rules_python, rules_proto And run buildifier -lint=fix -warnings=native-cc,native-python,native-proto **/BUILD https://github.com/bazelbuild/bazel/issues/9006 https://github.com/bazelbuild/bazel/issues/8922 https://github.com/bazelbuild/bazel/issues/8743 --- examples/ffi/c_calling_rust/BUILD | 1 + examples/ffi/rust_calling_c/c/BUILD | 2 ++ examples/ffi/rust_calling_c/simple/BUILD | 1 + examples/proto/BUILD | 2 ++ examples/proto/helloworld/BUILD | 1 + proto/BUILD | 2 ++ test/proto/BUILD | 1 + 7 files changed, 10 insertions(+) diff --git a/examples/ffi/c_calling_rust/BUILD b/examples/ffi/c_calling_rust/BUILD index 312a3e55b5..5b967a2e44 100644 --- a/examples/ffi/c_calling_rust/BUILD +++ b/examples/ffi/c_calling_rust/BUILD @@ -1,3 +1,4 @@ +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test") rust_library( diff --git a/examples/ffi/rust_calling_c/c/BUILD b/examples/ffi/rust_calling_c/c/BUILD index 71fd21047e..b2c3ce6952 100644 --- a/examples/ffi/rust_calling_c/c/BUILD +++ b/examples/ffi/rust_calling_c/c/BUILD @@ -1,3 +1,5 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") + package(default_visibility = ["//ffi/rust_calling_c:__subpackages__"]) cc_library( diff --git a/examples/ffi/rust_calling_c/simple/BUILD b/examples/ffi/rust_calling_c/simple/BUILD index b304a24043..091357c4a8 100644 --- a/examples/ffi/rust_calling_c/simple/BUILD +++ b/examples/ffi/rust_calling_c/simple/BUILD @@ -1,3 +1,4 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_doc", "rust_library", "rust_test") load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") diff --git a/examples/proto/BUILD b/examples/proto/BUILD index df78b89e8a..9ddf0e33f2 100644 --- a/examples/proto/BUILD +++ b/examples/proto/BUILD @@ -1,3 +1,5 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") + package(default_visibility = ["//proto:__subpackages__"]) proto_library( diff --git a/examples/proto/helloworld/BUILD b/examples/proto/helloworld/BUILD index 0421c1b4c9..f326a00af6 100644 --- a/examples/proto/helloworld/BUILD +++ b/examples/proto/helloworld/BUILD @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_rust//proto:proto.bzl", "rust_grpc_library") load("@io_bazel_rules_rust//rust:rust.bzl", "rust_test") diff --git a/proto/BUILD b/proto/BUILD index 99feff92b8..3b0207a427 100644 --- a/proto/BUILD +++ b/proto/BUILD @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_binary") + package(default_visibility = ["//visibility:public"]) load("@bazel_skylib//:bzl_library.bzl", "bzl_library") diff --git a/test/proto/BUILD b/test/proto/BUILD index 7217e55c47..faae5c0dae 100644 --- a/test/proto/BUILD +++ b/test/proto/BUILD @@ -1,3 +1,4 @@ +load("@rules_proto//proto:defs.bzl", "proto_library") load("@io_bazel_rules_rust//proto:proto.bzl", "rust_proto_library") proto_library( From 2785ab35b0c05d9ec82e5e94e81b3aa4710751de Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Fri, 1 Nov 2019 17:36:25 +0100 Subject: [PATCH 2/3] Run buildifier -lint=fix all --- examples/ffi/c_calling_rust/BUILD | 2 +- examples/ffi/rust_calling_c/BUILD | 2 +- examples/ffi/rust_calling_c/simple/BUILD | 2 +- examples/hello_runfiles/BUILD | 2 -- examples/hello_world/BUILD | 1 - proto/proto.bzl | 2 ++ test/BUILD | 6 ------ wasm_bindgen/wasm_bindgen.bzl | 6 ++---- 8 files changed, 7 insertions(+), 16 deletions(-) diff --git a/examples/ffi/c_calling_rust/BUILD b/examples/ffi/c_calling_rust/BUILD index 5b967a2e44..e0c644ae9e 100644 --- a/examples/ffi/c_calling_rust/BUILD +++ b/examples/ffi/c_calling_rust/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") -load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_library", "rust_test") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") rust_library( name = "rusty", diff --git a/examples/ffi/rust_calling_c/BUILD b/examples/ffi/rust_calling_c/BUILD index c9b0964e9e..80dba6cc34 100644 --- a/examples/ffi/rust_calling_c/BUILD +++ b/examples/ffi/rust_calling_c/BUILD @@ -1,6 +1,6 @@ package(default_visibility = ["//ffi/rust_calling_c:__subpackages__"]) -load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_doc", "rust_library", "rust_test") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_doc", "rust_library", "rust_test") rust_library( name = "matrix", diff --git a/examples/ffi/rust_calling_c/simple/BUILD b/examples/ffi/rust_calling_c/simple/BUILD index 091357c4a8..c7cb865365 100644 --- a/examples/ffi/rust_calling_c/simple/BUILD +++ b/examples/ffi/rust_calling_c/simple/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_doc", "rust_library", "rust_test") +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_test") load("@io_bazel_rules_rust//bindgen:bindgen.bzl", "rust_bindgen_library") cc_library( diff --git a/examples/hello_runfiles/BUILD b/examples/hello_runfiles/BUILD index 82a22c4d93..01df6f597b 100644 --- a/examples/hello_runfiles/BUILD +++ b/examples/hello_runfiles/BUILD @@ -3,8 +3,6 @@ package(default_visibility = ["//visibility:public"]) load( "@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", - "rust_library", - "rust_test", ) rust_binary( diff --git a/examples/hello_world/BUILD b/examples/hello_world/BUILD index 509985cc48..40b793048d 100644 --- a/examples/hello_world/BUILD +++ b/examples/hello_world/BUILD @@ -4,7 +4,6 @@ load( "@io_bazel_rules_rust//rust:rust.bzl", "rust_binary", "rust_doc", - "rust_doc_test", ) rust_binary( diff --git a/proto/proto.bzl b/proto/proto.bzl index 8f4c04b965..15f1354342 100644 --- a/proto/proto.bzl +++ b/proto/proto.bzl @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("@rules_proto//proto:defs.bzl", "ProtoInfo") + """Rust Protobuf Rules These build rules are used for building [protobufs][protobuf]/[gRPC][grpc] in [Rust][rust] with Bazel. diff --git a/test/BUILD b/test/BUILD index 4aaab03fa8..fb5c838cba 100644 --- a/test/BUILD +++ b/test/BUILD @@ -1,9 +1,3 @@ -load( - "//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) load( "@bazel_tools//tools/build_rules:test_rules.bzl", "rule_test", diff --git a/wasm_bindgen/wasm_bindgen.bzl b/wasm_bindgen/wasm_bindgen.bzl index e4cbc17257..dc9d8f4565 100644 --- a/wasm_bindgen/wasm_bindgen.bzl +++ b/wasm_bindgen/wasm_bindgen.bzl @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") -load("@io_bazel_rules_rust//rust:private/legacy_cc_starlark_api_shim.bzl", "get_libs_for_static_executable") load("@io_bazel_rules_rust//rust:private/transitions.bzl", "wasm_bindgen_transition") def _rust_wasm_bindgen_impl(ctx): @@ -59,8 +57,8 @@ def _rust_wasm_bindgen_impl(ctx): type_blacklisted_declarations = depset(), es5_sources = depset([ctx.outputs.javascript_bindings]), es6_sources = depset([ctx.outputs.javascript_bindings]), - transitive_es5_sources = depset(depset([ctx.outputs.javascript_bindings])), - transitive_es6_sources = depset(depset([ctx.outputs.javascript_bindings])), + transitive_es5_sources = depset(depset([ctx.outputs.javascript_bindings]).to_list()), + transitive_es6_sources = depset(depset([ctx.outputs.javascript_bindings]).to_list()), ), ) From 7b31eb3540072f2c4df92b9621582a2e67142060 Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Fri, 1 Nov 2019 18:39:38 +0100 Subject: [PATCH 3/3] Run fix native-cc on *.BUILD --- bindgen/clang.BUILD | 2 ++ bindgen/raze/libloading.BUILD | 2 ++ wasm_bindgen/raze/overrides/backtrace-sys-0.1.29.BUILD | 2 ++ 3 files changed, 6 insertions(+) diff --git a/bindgen/clang.BUILD b/bindgen/clang.BUILD index 46e4eebf0b..3a4a15880d 100644 --- a/bindgen/clang.BUILD +++ b/bindgen/clang.BUILD @@ -1,3 +1,5 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + package(default_visibility = ["//visibility:public"]) sh_binary( diff --git a/bindgen/raze/libloading.BUILD b/bindgen/raze/libloading.BUILD index 81be67070a..9a17cfcaba 100644 --- a/bindgen/raze/libloading.BUILD +++ b/bindgen/raze/libloading.BUILD @@ -5,6 +5,8 @@ cargo-raze crate build file. - Libloading has a CC dep that needs to be built. """ +load("@rules_cc//cc:defs.bzl", "cc_library") + licenses([ "notice", # "ISC" ]) diff --git a/wasm_bindgen/raze/overrides/backtrace-sys-0.1.29.BUILD b/wasm_bindgen/raze/overrides/backtrace-sys-0.1.29.BUILD index 6ab0d5f672..3e2709a7ae 100644 --- a/wasm_bindgen/raze/overrides/backtrace-sys-0.1.29.BUILD +++ b/wasm_bindgen/raze/overrides/backtrace-sys-0.1.29.BUILD @@ -1,3 +1,5 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + package(default_visibility = ["//ext/public/rust/cargo:__subpackages__"]) licenses([