From 77063f4f354991714008d7d1380222bdfaabd285 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 11 Nov 2024 21:59:01 -0800 Subject: [PATCH] Add rustversion dependency to bazel build --- BUILD.bazel | 3 + MODULE.bazel.lock | 20 ++- third-party/bazel/BUILD.bazel | 6 + .../bazel/BUILD.rustversion-1.0.18.bazel | 141 ++++++++++++++++++ third-party/bazel/defs.bzl | 14 ++ 5 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 third-party/bazel/BUILD.rustversion-1.0.18.bazel diff --git a/BUILD.bazel b/BUILD.bazel index 11280773f..863e41209 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -54,6 +54,9 @@ rust_proc_macro( name = "cxxbridge-macro", srcs = glob(["macro/src/**/*.rs"]), edition = "2021", + proc_macro_deps = [ + "@crates.io//:rustversion", + ], deps = [ "@crates.io//:proc-macro2", "@crates.io//:quote", diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 5ebf5301d..09aa6f070 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -102,7 +102,7 @@ "moduleExtensions": { "//tools/bazel:extension.bzl%crate_repositories": { "general": { - "bzlTransitiveDigest": "g2+zc9joN4R1YJzduOoW6DhWo6XGIrHZrrpkx0tSUBA=", + "bzlTransitiveDigest": "ZnV4P9VqkJTp/wlYQKCyUkeyFG6O4xoCRDveR7pLjIk=", "usagesDigest": "asGxJIEmfRVxm6+g7CFSxl5zD/l9sk/bUAPWuK0xF7M=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -212,6 +212,19 @@ "build_file": "@@//third-party/bazel:BUILD.quote-1.0.37.bazel" } }, + "vendor__rustversion-1.0.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustversion/1.0.18/download" + ], + "strip_prefix": "rustversion-1.0.18", + "build_file": "@@//third-party/bazel:BUILD.rustversion-1.0.18.bazel" + } + }, "vendor__scratch-1.0.7": { "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", "ruleClassName": "http_archive", @@ -477,6 +490,11 @@ "vendor__quote-1.0.37", "vendor__quote-1.0.37" ], + [ + "", + "vendor__rustversion-1.0.18", + "vendor__rustversion-1.0.18" + ], [ "", "vendor__scratch-1.0.7", diff --git a/third-party/bazel/BUILD.bazel b/third-party/bazel/BUILD.bazel index de2416680..bc895b14a 100644 --- a/third-party/bazel/BUILD.bazel +++ b/third-party/bazel/BUILD.bazel @@ -61,6 +61,12 @@ alias( tags = ["manual"], ) +alias( + name = "rustversion", + actual = "@vendor__rustversion-1.0.18//:rustversion", + tags = ["manual"], +) + alias( name = "scratch", actual = "@vendor__scratch-1.0.7//:scratch", diff --git a/third-party/bazel/BUILD.rustversion-1.0.18.bazel b/third-party/bazel/BUILD.rustversion-1.0.18.bazel new file mode 100644 index 000000000..71bf846ac --- /dev/null +++ b/third-party/bazel/BUILD.rustversion-1.0.18.bazel @@ -0,0 +1,141 @@ +############################################################################### +# @generated +# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To +# regenerate this file, run the following: +# +# bazel run @@//third-party:vendor +############################################################################### + +load("@rules_rust//cargo:defs.bzl", "cargo_build_script") +load("@rules_rust//rust:defs.bzl", "rust_proc_macro") + +package(default_visibility = ["//visibility:public"]) + +rust_proc_macro( + name = "rustversion", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rustversion", + "manual", + "noclippy", + "norustfmt", + ], + target_compatible_with = select({ + "@rules_rust//rust/platform:aarch64-apple-darwin": [], + "@rules_rust//rust/platform:aarch64-apple-ios": [], + "@rules_rust//rust/platform:aarch64-apple-ios-sim": [], + "@rules_rust//rust/platform:aarch64-linux-android": [], + "@rules_rust//rust/platform:aarch64-pc-windows-msvc": [], + "@rules_rust//rust/platform:aarch64-unknown-fuchsia": [], + "@rules_rust//rust/platform:aarch64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:aarch64-unknown-nto-qnx710": [], + "@rules_rust//rust/platform:arm-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:armv7-linux-androideabi": [], + "@rules_rust//rust/platform:armv7-unknown-linux-gnueabi": [], + "@rules_rust//rust/platform:i686-apple-darwin": [], + "@rules_rust//rust/platform:i686-linux-android": [], + "@rules_rust//rust/platform:i686-pc-windows-msvc": [], + "@rules_rust//rust/platform:i686-unknown-freebsd": [], + "@rules_rust//rust/platform:i686-unknown-linux-gnu": [], + "@rules_rust//rust/platform:powerpc-unknown-linux-gnu": [], + "@rules_rust//rust/platform:riscv32imc-unknown-none-elf": [], + "@rules_rust//rust/platform:riscv64gc-unknown-none-elf": [], + "@rules_rust//rust/platform:s390x-unknown-linux-gnu": [], + "@rules_rust//rust/platform:thumbv7em-none-eabi": [], + "@rules_rust//rust/platform:thumbv8m.main-none-eabi": [], + "@rules_rust//rust/platform:wasm32-unknown-unknown": [], + "@rules_rust//rust/platform:wasm32-wasi": [], + "@rules_rust//rust/platform:wasm32-wasip1": [], + "@rules_rust//rust/platform:x86_64-apple-darwin": [], + "@rules_rust//rust/platform:x86_64-apple-ios": [], + "@rules_rust//rust/platform:x86_64-linux-android": [], + "@rules_rust//rust/platform:x86_64-pc-windows-msvc": [], + "@rules_rust//rust/platform:x86_64-unknown-freebsd": [], + "@rules_rust//rust/platform:x86_64-unknown-fuchsia": [], + "@rules_rust//rust/platform:x86_64-unknown-linux-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-nixos-gnu": [], + "@rules_rust//rust/platform:x86_64-unknown-none": [], + "//conditions:default": ["@platforms//:incompatible"], + }), + version = "1.0.18", + deps = [ + "@vendor__rustversion-1.0.18//:build_script_build", + ], +) + +cargo_build_script( + name = "_bs", + srcs = glob( + include = ["**/*.rs"], + allow_empty = True, + ), + compile_data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + "**/*.rs", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + crate_name = "build_script_build", + crate_root = "build/build.rs", + data = glob( + include = ["**"], + allow_empty = True, + exclude = [ + "**/* *", + ".tmp_git_root/**/*", + "BUILD", + "BUILD.bazel", + "WORKSPACE", + "WORKSPACE.bazel", + ], + ), + edition = "2018", + pkg_name = "rustversion", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-bazel", + "crate-name=rustversion", + "manual", + "noclippy", + "norustfmt", + ], + version = "1.0.18", + visibility = ["//visibility:private"], +) + +alias( + name = "build_script_build", + actual = ":_bs", + tags = ["manual"], +) diff --git a/third-party/bazel/defs.bzl b/third-party/bazel/defs.bzl index 9473d9159..f1af199eb 100644 --- a/third-party/bazel/defs.bzl +++ b/third-party/bazel/defs.bzl @@ -325,6 +325,9 @@ _NORMAL_DEV_ALIASES = { _PROC_MACRO_DEPENDENCIES = { "third-party": { + _COMMON_CONDITION: { + "rustversion": Label("@vendor__rustversion-1.0.18//:rustversion"), + }, }, } @@ -498,6 +501,16 @@ def crate_repositories(): build_file = Label("//third-party/bazel:BUILD.quote-1.0.37.bazel"), ) + maybe( + http_archive, + name = "vendor__rustversion-1.0.18", + sha256 = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248", + type = "tar.gz", + urls = ["https://static.crates.io/crates/rustversion/1.0.18/download"], + strip_prefix = "rustversion-1.0.18", + build_file = Label("//third-party/bazel:BUILD.rustversion-1.0.18.bazel"), + ) + maybe( http_archive, name = "vendor__scratch-1.0.7", @@ -674,6 +687,7 @@ def crate_repositories(): struct(repo = "vendor__codespan-reporting-0.11.1", is_dev_dep = False), struct(repo = "vendor__proc-macro2-1.0.89", is_dev_dep = False), struct(repo = "vendor__quote-1.0.37", is_dev_dep = False), + struct(repo = "vendor__rustversion-1.0.18", is_dev_dep = False), struct(repo = "vendor__scratch-1.0.7", is_dev_dep = False), struct(repo = "vendor__syn-2.0.85", is_dev_dep = False), ]