blob: a4b752ed628c32350756e52688f931a10e79cabc [file]
# Protocol Buffers - Google's data interchange format
# Copyright 2026 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
# Protobuf Rust crate packaging for release.
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
pkg_files(
name = "license",
srcs = ["//:LICENSE"],
visibility = ["//rust/release_crates:__subpackages__"],
)
pkg_tar(
name = "workspace",
srcs = [
":Cargo.toml",
"//rust/release_crates/google_protobuf:google_protobuf_crate",
"//rust/release_crates/google_protobuf_codegen:google_protobuf_codegen_crate",
"//rust/release_crates/google_protobuf_example:google_protobuf_example_crate",
"//rust/release_crates/google_protobuf_macros:google_protobuf_macros_crate",
"//rust/release_crates/google_protobuf_well_known_types:google_protobuf_well_known_types_crate",
"//rust/release_crates/protobuf:protobuf_crate",
"//rust/release_crates/protobuf_codegen:protobuf_codegen_crate",
"//rust/release_crates/protobuf_example:protobuf_example_crate",
"//rust/release_crates/protobuf_macros:protobuf_macros_crate",
"//rust/release_crates/protobuf_tests:protobuf_tests_crate",
"//rust/release_crates/protobuf_well_known_types:protobuf_well_known_types_crate",
],
visibility = ["//rust:__pkg__"],
)
# Run the cargo test with only a bundled linux-x86_64 protoc.
sh_binary(
name = "cargo_test",
srcs = ["cargo_test.sh"],
data = [
":workspace",
"//:protoc",
"@rules_rust//rust/toolchain:current_cargo_files",
"@rules_rust//rust/toolchain:current_rust_toolchain",
],
env = {
"CARGO_RLOCATION": "$(rlocationpath @rules_rust//rust/toolchain:current_cargo_files)",
},
tags = ["manual"],
deps = ["@bazel_tools//tools/bash/runfiles"],
)