| # Copyright (c) 2009-2021, Google LLC | |
| # All rights reserved. | |
| # | |
| # 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 | |
| load("@rules_cc//cc:cc_binary.bzl", "cc_binary") | |
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | |
| load("@rules_cc//cc:cc_test.bzl", "cc_test") | |
| load("//bazel:proto_library.bzl", "proto_library") | |
| load( | |
| "//lua:lua_proto_library.bzl", | |
| "lua_proto_library", | |
| ) | |
| load( | |
| "//upb/bazel:copts.bzl", | |
| "UPB_DEFAULT_COPTS", | |
| "UPB_DEFAULT_CPPOPTS", | |
| "UPB_DEFAULT_FEATURES", | |
| ) | |
| licenses(["notice"]) | |
| cc_library( | |
| name = "lupb", | |
| srcs = [ | |
| "def.c", | |
| "msg.c", | |
| "upb.c", | |
| ], | |
| hdrs = [ | |
| "upb.h", | |
| ], | |
| copts = UPB_DEFAULT_COPTS + ["-Wno-tautological-constant-out-of-range-compare"], | |
| features = UPB_DEFAULT_FEATURES, | |
| visibility = ["//visibility:public"], | |
| deps = [ | |
| "//upb/json", | |
| "//upb/message", | |
| "//upb/port", | |
| "//upb/reflection", | |
| "//upb/text", | |
| "@lua//:liblua", | |
| ], | |
| ) | |
| cc_binary( | |
| name = "protoc-gen-lua", | |
| srcs = ["upbc.cc"], | |
| copts = UPB_DEFAULT_CPPOPTS, | |
| features = UPB_DEFAULT_FEATURES, | |
| visibility = ["//visibility:public"], | |
| deps = [ | |
| "//src/google/protobuf", | |
| "//src/google/protobuf/compiler:code_generator", | |
| "//src/google/protobuf/io:printer", | |
| "@abseil-cpp//absl/strings", | |
| ], | |
| ) | |
| exports_files(["upb.lua"]) | |
| cc_test( | |
| name = "test_lua", | |
| srcs = ["main.c"], | |
| args = ["$(location :test_upb.lua)"], | |
| copts = UPB_DEFAULT_COPTS, | |
| data = [ | |
| "test_upb.lua", | |
| "upb.lua", | |
| ":descriptor_proto_lua", | |
| ":empty_proto_lua", | |
| ":test_messages_proto2_proto_lua", | |
| ":test_messages_proto3_proto_lua", | |
| ":test_proto_lua", | |
| "//:descriptor_proto", | |
| "//conformance:conformance_proto", | |
| ], | |
| features = UPB_DEFAULT_FEATURES, | |
| linkstatic = 1, | |
| deps = [ | |
| ":lupb", | |
| "@lua//:liblua", | |
| ], | |
| ) | |
| proto_library( | |
| name = "test_proto", | |
| testonly = 1, | |
| srcs = ["test.proto"], | |
| deps = ["//:timestamp_proto"], | |
| ) | |
| lua_proto_library( | |
| name = "test_proto_lua", | |
| testonly = 1, | |
| deps = [":test_proto"], | |
| ) | |
| lua_proto_library( | |
| name = "descriptor_proto_lua", | |
| deps = ["//:descriptor_proto"], | |
| ) | |
| lua_proto_library( | |
| name = "empty_proto_lua", | |
| deps = ["//:empty_proto"], | |
| ) | |
| lua_proto_library( | |
| name = "test_messages_proto3_proto_lua", | |
| testonly = 1, | |
| deps = ["//src/google/protobuf:test_messages_proto3_proto"], | |
| ) | |
| lua_proto_library( | |
| name = "test_messages_proto2_proto_lua", | |
| testonly = 1, | |
| deps = ["//src/google/protobuf:test_messages_proto2_proto"], | |
| ) |