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.
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")
package(
default_applicable_licenses = ["//third_party/protobuf:license"],
default_visibility = ["//src/google/protobuf:__subpackages__"],
)

@ -9,7 +9,7 @@ load("@rules_rust//rust/private:providers.bzl", "CrateInfo", "DepInfo", "DepVari
# buildifier: disable=bzl-visibility
load("@rules_rust//rust/private:rustc.bzl", "rustc_compile_action")
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

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

@ -3,7 +3,7 @@
Disclaimer: This project is experimental, under heavy development, and should not
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(
"//rust:aspects.bzl",
"RustProtoInfo",

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

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

@ -1,5 +1,3 @@
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")

@ -3,7 +3,7 @@
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load(":defs.bzl", "ActionsInfo", "attach_cc_aspect", "attach_upb_aspect")
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):
action = [a for a in actions if a.mnemonic == mnemonic]

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

@ -1,30 +1,34 @@
/*
* Copyright (c) 2009-2021, Google LLC
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Google LLC nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT 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.
*/
// Protocol Buffers - Google's data interchange format
// Copyright 2023 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// 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
#include "third_party/upb/upb/mem/arena.h" // IWYU pragma: keep
#include "upb/mem/arena.h" // IWYU pragma: keep

Loading…
Cancel
Save