Fix build errors in Protobuf Rust

PiperOrigin-RevId: 518619271
pull/12315/head
Jakob Buchgraber 2 years ago committed by Copybara-Service
parent 9a76b96cc4
commit 7802b93442
  1. 3
      rust/BUILD
  2. 2
      rust/aspects.bzl
  3. 7
      rust/cpp_kernel/BUILD
  4. 2
      rust/defs.bzl
  5. 6
      rust/test/BUILD
  6. 5
      rust/test/child.proto
  7. 2
      rust/test/rust_proto_library_unit_test/BUILD
  8. 2
      rust/test/rust_proto_library_unit_test/rust_proto_library_unit_test.bzl
  9. 4
      rust/upb_kernel/BUILD
  10. 58
      rust/upb_kernel/upb_api.c

@ -1,12 +1,11 @@
# Protobuf Rust runtime packages. # Protobuf Rust runtime packages.
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
load("//third_party/bazel_skylib/rules:common_settings.bzl", "string_flag") load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain") load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
package( package(
default_applicable_licenses = ["//third_party/protobuf:license"],
default_visibility = ["//src/google/protobuf:__subpackages__"], default_visibility = ["//src/google/protobuf:__subpackages__"],
) )

@ -9,7 +9,7 @@ load("@rules_rust//rust/private:providers.bzl", "CrateInfo", "DepInfo", "DepVari
# buildifier: disable=bzl-visibility # buildifier: disable=bzl-visibility
load("@rules_rust//rust/private:rustc.bzl", "rustc_compile_action") load("@rules_rust//rust/private:rustc.bzl", "rustc_compile_action")
load("@rules_rust//rust:defs.bzl", "rust_common") load("@rules_rust//rust:defs.bzl", "rust_common")
load("//third_party/upb/bazel:upb_proto_library.bzl", "UpbWrappedCcInfo", "upb_proto_library_aspect") load("@upb//bazel:upb_proto_library.bzl", "UpbWrappedCcInfo", "upb_proto_library_aspect")
proto_common = proto_common_do_not_use proto_common = proto_common_do_not_use

@ -2,12 +2,13 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
package(default_applicable_licenses = ["//third_party/protobuf:license"])
rust_library( rust_library(
name = "cpp", name = "cpp",
srcs = ["cpp.rs"], srcs = ["cpp.rs"],
visibility = ["//src/google/protobuf:__subpackages__"], visibility = [
"//src/google/protobuf:__subpackages__",
"//rust:__subpackages__",
],
) )
rust_test( rust_test(

@ -3,7 +3,7 @@
Disclaimer: This project is experimental, under heavy development, and should not Disclaimer: This project is experimental, under heavy development, and should not
be used yet.""" be used yet."""
load("//tools/build_defs/proto/cpp:cc_proto_library.bzl", "cc_proto_library") load("@rules_cc//cc:defs.bzl", "cc_proto_library")
load( load(
"//rust:aspects.bzl", "//rust:aspects.bzl",
"RustProtoInfo", "RustProtoInfo",

@ -1,12 +1,12 @@
load("//rust:defs.bzl", "rust_proto_library") load("//rust:defs.bzl", "rust_proto_library")
load("@rules_rust//rust:defs.bzl", "rust_test") load("@rules_rust//rust:defs.bzl", "rust_test")
package(default_applicable_licenses = ["//third_party/protobuf:license"])
rust_proto_library( rust_proto_library(
name = "unittest_rust_proto", name = "unittest_rust_proto",
testonly = True, testonly = True,
deps = ["//third_party/protobuf:unittest_proto"], deps = [
"//src/google/protobuf:test_protos",
],
) )
rust_test( rust_test(

@ -32,9 +32,6 @@ syntax = "proto2";
package third_party_protobuf_rust_test; package third_party_protobuf_rust_test;
// copybara:strip_begin(Replace import path for Bazel) import public "rust/test/parent.proto";
import public "google/protobuf/rust/test/parent.proto";
// copybara:strip_end_and_replace import public "rust/test/parent.proto";
message Child {} message Child {}

@ -1,5 +1,3 @@
load(":rust_proto_library_unit_test.bzl", "rust_proto_library_unit_test") load(":rust_proto_library_unit_test.bzl", "rust_proto_library_unit_test")
package(default_applicable_licenses = ["//third_party/protobuf:license"])
rust_proto_library_unit_test(name = "rust_proto_library_unit_test") rust_proto_library_unit_test(name = "rust_proto_library_unit_test")

@ -3,7 +3,7 @@
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts") load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load(":defs.bzl", "ActionsInfo", "attach_cc_aspect", "attach_upb_aspect") load(":defs.bzl", "ActionsInfo", "attach_cc_aspect", "attach_upb_aspect")
load("//rust:aspects.bzl", "RustProtoInfo") load("//rust:aspects.bzl", "RustProtoInfo")
load("//tools/build_defs/proto/cpp:cc_proto_library.bzl", "cc_proto_library") load("@rules_cc//cc:defs.bzl", "cc_proto_library")
def _find_action_with_mnemonic(actions, mnemonic): def _find_action_with_mnemonic(actions, mnemonic):
action = [a for a in actions if a.mnemonic == mnemonic] action = [a for a in actions if a.mnemonic == mnemonic]

@ -2,8 +2,6 @@
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test") load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
package(default_applicable_licenses = ["//third_party/protobuf:license"])
rust_library( rust_library(
name = "upb", name = "upb",
srcs = ["upb.rs"], srcs = ["upb.rs"],
@ -24,6 +22,6 @@ cc_library(
name = "upb_c_api", name = "upb_c_api",
srcs = ["upb_api.c"], srcs = ["upb_api.c"],
deps = [ deps = [
"//third_party/upb", "@upb//:upb",
], ],
) )

@ -1,30 +1,34 @@
/* // Protocol Buffers - Google's data interchange format
* Copyright (c) 2009-2021, Google LLC // Copyright 2023 Google Inc. All rights reserved.
* All rights reserved. // https://developers.google.com/protocol-buffers/
* //
* Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: // modification, are permitted provided that the following conditions are
* * Redistributions of source code must retain the above copyright // met:
* notice, this list of conditions and the following disclaimer. //
* * Redistributions in binary form must reproduce the above copyright // * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer in the // notice, this list of conditions and the following disclaimer.
* documentation and/or other materials provided with the distribution. // * Redistributions in binary form must reproduce the above
* * Neither the name of Google LLC nor the // copyright notice, this list of conditions and the following disclaimer
* names of its contributors may be used to endorse or promote products // in the documentation and/or other materials provided with the
* derived from this software without specific prior written permission. // distribution.
* // * Neither the name of Google Inc. nor the names of its
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // contributors may be used to endorse or promote products derived from
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // this software without specific prior written permission.
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE //
* ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT, // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
*/ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#define UPB_BUILD_API #define UPB_BUILD_API
#include "third_party/upb/upb/mem/arena.h" // IWYU pragma: keep #include "upb/mem/arena.h" // IWYU pragma: keep

Loading…
Cancel
Save