From 0ad4fe554373e91cdefbc4d5166f69a48fb1a736 Mon Sep 17 00:00:00 2001 From: Marcel Hlopko Date: Tue, 26 Oct 2021 08:16:00 +0200 Subject: [PATCH 1/2] Migrate cxx for bazelbuild/rules_rust#591 --- BUILD | 5 ++--- book/src/build/bazel.md | 2 +- demo/BUILD | 2 +- tests/BUILD | 2 +- tools/bazel/third_party.bzl | 2 +- tools/bazel/vendor.bzl | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/BUILD b/BUILD index c2c2edfd7..ce3ed697b 100644 --- a/BUILD +++ b/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") rust_library( name = "cxx", @@ -39,10 +39,9 @@ cc_library( hdrs = ["include/cxx.h"], ) -rust_library( +rust_proc_macro( name = "cxxbridge-macro", srcs = glob(["macro/src/**"]), - crate_type = "proc-macro", deps = [ "//third-party:proc-macro2", "//third-party:quote", diff --git a/book/src/build/bazel.md b/book/src/build/bazel.md index 8f9105504..6a2c82b00 100644 --- a/book/src/build/bazel.md +++ b/book/src/build/bazel.md @@ -70,7 +70,7 @@ def rust_cxx_bridge(name, src, deps = []): # demo/BUILD load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_rust//rust:rust.bzl", "rust_binary") +load("@rules_rust//rust:defs.bzl", "rust_binary") load("//tools/bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge") rust_binary( diff --git a/demo/BUILD b/demo/BUILD index 4ab5ecb7d..0c940d134 100644 --- a/demo/BUILD +++ b/demo/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_rust//rust:rust.bzl", "rust_binary") +load("@rules_rust//rust:defs.bzl", "rust_binary") load("//tools/bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge") rust_binary( diff --git a/tests/BUILD b/tests/BUILD index d4af3afff..4803e13b4 100644 --- a/tests/BUILD +++ b/tests/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_rust//rust:rust.bzl", "rust_library", "rust_test") +load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("//tools/bazel:rust_cxx_bridge.bzl", "rust_cxx_bridge") rust_test( diff --git a/tools/bazel/third_party.bzl b/tools/bazel/third_party.bzl index 7f51c4662..5b2ec3fe7 100644 --- a/tools/bazel/third_party.bzl +++ b/tools/bazel/third_party.bzl @@ -1,5 +1,5 @@ load("@rules_rust//cargo:cargo_build_script.bzl", "cargo_build_script") -load("@rules_rust//rust:rust.bzl", "rust_binary", "rust_library") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") load("@third-party//:vendor.bzl", "vendored") def third_party_glob(include): diff --git a/tools/bazel/vendor.bzl b/tools/bazel/vendor.bzl index 017f82a49..284705e59 100644 --- a/tools/bazel/vendor.bzl +++ b/tools/bazel/vendor.bzl @@ -3,7 +3,7 @@ of a crate in the current workspace. """ load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool") -load("@rules_rust//rust:rust.bzl", "rust_common") +load("@rules_rust//rust:defs.bzl", "rust_common") def _impl(repository_ctx): # Link cxx repository into @third-party. From 2040717efac30cfa2b7c33dff1f09fef59ed5572 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 26 Oct 2021 19:37:29 -0700 Subject: [PATCH 2/2] Fill in missing rust_proc_macro Bazel import --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index ce3ed697b..83815604a 100644 --- a/BUILD +++ b/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") +load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_proc_macro") rust_library( name = "cxx",