• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2009-2021, Google LLC
2# All rights reserved.
3#
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file or at
6# https://developers.google.com/open-source/licenses/bsd
7
8load(
9    "//lua:lua_proto_library.bzl",
10    "lua_proto_library",
11)
12load(
13    "//upb/bazel:build_defs.bzl",
14    "UPB_DEFAULT_COPTS",
15    "UPB_DEFAULT_CPPOPTS",
16)
17
18licenses(["notice"])
19
20cc_library(
21    name = "lupb",
22    srcs = [
23        "def.c",
24        "msg.c",
25        "upb.c",
26    ],
27    hdrs = [
28        "upb.h",
29    ],
30    copts = UPB_DEFAULT_COPTS,
31    visibility = ["//visibility:public"],
32    deps = [
33        "//upb:json",
34        "//upb:message",
35        "//upb:port",
36        "//upb:reflection",
37        "//upb:text",
38        "@lua//:liblua",
39    ],
40)
41
42cc_binary(
43    name = "protoc-gen-lua",
44    srcs = ["upbc.cc"],
45    copts = UPB_DEFAULT_CPPOPTS,
46    visibility = ["//visibility:public"],
47    deps = [
48        "//src/google/protobuf",
49        "//src/google/protobuf/compiler:code_generator",
50        "//src/google/protobuf/io:printer",
51        "@com_google_absl//absl/strings",
52    ],
53)
54
55exports_files(["upb.lua"])
56
57cc_test(
58    name = "test_lua",
59    srcs = ["main.c"],
60    args = ["$(location :test_upb.lua)"],
61    copts = UPB_DEFAULT_COPTS,
62    data = [
63        "test_upb.lua",
64        "upb.lua",
65        ":descriptor_proto_lua",
66        ":empty_proto_lua",
67        ":test_messages_proto2_proto_lua",
68        ":test_messages_proto3_proto_lua",
69        ":test_proto_lua",
70        "//:descriptor_proto",
71        "//conformance:conformance_proto",
72        "//third_party/lunit:console.lua",
73        "//third_party/lunit:lunit.lua",
74    ],
75    linkstatic = 1,
76    deps = [
77        ":lupb",
78        "@lua//:liblua",
79    ],
80)
81
82proto_library(
83    name = "test_proto",
84    testonly = 1,
85    srcs = ["test.proto"],
86    deps = ["//:timestamp_proto"],
87)
88
89lua_proto_library(
90    name = "test_proto_lua",
91    testonly = 1,
92    deps = [":test_proto"],
93)
94
95lua_proto_library(
96    name = "descriptor_proto_lua",
97    deps = ["//:descriptor_proto"],
98)
99
100lua_proto_library(
101    name = "empty_proto_lua",
102    deps = ["//:empty_proto"],
103)
104
105lua_proto_library(
106    name = "test_messages_proto3_proto_lua",
107    testonly = 1,
108    deps = ["//src/google/protobuf:test_messages_proto3_proto"],
109)
110
111lua_proto_library(
112    name = "test_messages_proto2_proto_lua",
113    testonly = 1,
114    deps = ["//src/google/protobuf:test_messages_proto2_proto"],
115)
116