1# Copyright (c) 2009-2021, Google LLC 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are met: 6# * Redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer. 8# * Redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the 10# documentation and/or other materials provided with the distribution. 11# * Neither the name of Google LLC nor the 12# names of its contributors may be used to endorse or promote products 13# derived from this software without specific prior written permission. 14# 15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY 19# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 26load( 27 "//bazel:build_defs.bzl", 28 "UPB_DEFAULT_CPPOPTS", 29) 30load( 31 "//protos/bazel:upb_cc_proto_library.bzl", 32 "upb_cc_proto_library_copts", 33) 34 35licenses(["notice"]) 36 37cc_library( 38 name = "protos", 39 srcs = ["protos.cc"], 40 hdrs = ["protos.h"], 41 copts = UPB_DEFAULT_CPPOPTS, 42 visibility = ["//visibility:public"], 43 deps = [ 44 "//:mini_table", 45 "//:upb", 46 "@com_google_absl//absl/status", 47 "@com_google_absl//absl/status:statusor", 48 "@com_google_absl//absl/strings:str_format", 49 ], 50) 51 52cc_library( 53 name = "protos_internal", 54 hdrs = ["protos_internal.h"], 55 copts = UPB_DEFAULT_CPPOPTS, 56 visibility = ["//visibility:public"], 57 deps = [ 58 ":protos", 59 "//:mini_table", 60 "//:upb", 61 "@com_google_absl//absl/status", 62 "@com_google_absl//absl/status:statusor", 63 "@com_google_absl//absl/strings:str_format", 64 ], 65) 66 67# Common support code for C++ generated code. 68cc_library( 69 name = "generated_protos_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me", 70 hdrs = [ 71 "protos_internal.h", 72 ], 73 copts = UPB_DEFAULT_CPPOPTS, 74 visibility = ["//visibility:public"], 75 deps = [ 76 ":protos", 77 ":protos_internal", 78 ], 79) 80 81cc_test( 82 name = "protos_internal_test", 83 srcs = ["protos_internal_test.cc"], 84 copts = UPB_DEFAULT_CPPOPTS, 85 deps = [ 86 ":protos_internal", 87 "//:upb", 88 "//protos_generator/tests:test_model_upb_cc_proto", 89 "//protos_generator/tests:test_model_upb_proto", 90 "@com_google_googletest//:gtest_main", 91 ], 92) 93 94upb_cc_proto_library_copts( 95 name = "upb_cc_proto_library_copts__for_generated_code_only_do_not_use", 96 copts = UPB_DEFAULT_CPPOPTS, 97 visibility = ["//visibility:public"], 98) 99