blob: b464e234c4261d6246d341d751af8b3e47d94c83 [file] [log] [blame]
# 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(
"//lua:lua_proto_library.bzl",
"lua_proto_library",
)
load(
"//upb/bazel:build_defs.bzl",
"UPB_DEFAULT_COPTS",
"UPB_DEFAULT_CPPOPTS",
)
licenses(["notice"])
cc_library(
name = "lupb",
srcs = [
"def.c",
"msg.c",
"upb.c",
],
hdrs = [
"upb.h",
],
copts = UPB_DEFAULT_COPTS,
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,
visibility = ["//visibility:public"],
deps = [
"//src/google/protobuf",
"//src/google/protobuf/compiler:code_generator",
"//src/google/protobuf/io:printer",
"@com_google_absl//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",
"//third_party/lunit:console.lua",
"//third_party/lunit:lunit.lua",
],
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"],
)