diff options
Diffstat (limited to 'BUILD')
-rw-r--r-- | BUILD | 178 |
1 files changed, 61 insertions, 117 deletions
@@ -8,6 +8,7 @@ load( "make_shell_script", "upb_amalgamation", "upb_proto_library", + "upb_proto_reflection_library", ) # C/C++ rules ################################################################## @@ -27,7 +28,6 @@ cc_library( "upb/port_undef.inc", "upb/refcounted.c", "upb/sink.c", - "upb/structdefs.int.h", "upb/structs.int.h", "upb/table.c", "upb/table.int.h", @@ -38,6 +38,7 @@ cc_library( "upb/decode.h", "upb/def.h", "upb/encode.h", + "upb/generated_util.h", "upb/handlers.h", "upb/msg.h", "upb/msgfactory.h", @@ -54,31 +55,12 @@ cc_library( ) cc_library( - name = "upb_descriptor", - srcs = [ - "upb/descriptor/descriptor.upbdefs.c", - "upb/descriptor/reader.c", - ], - hdrs = [ - "upb/descriptor/descriptor.upbdefs.h", - "upb/descriptor/reader.h", - ], - copts = [ - "-std=c89", - "-pedantic", - "-Wno-long-long", - ], - deps = [":upb"], -) - -cc_library( name = "upb_pb", srcs = [ "upb/pb/compile_decoder.c", "upb/pb/decoder.c", "upb/pb/decoder.int.h", "upb/pb/encoder.c", - "upb/pb/glue.c", "upb/pb/textprinter.c", "upb/pb/varint.c", "upb/pb/varint.int.h", @@ -86,7 +68,6 @@ cc_library( hdrs = [ "upb/pb/decoder.h", "upb/pb/encoder.h", - "upb/pb/glue.h", "upb/pb/textprinter.h", ], copts = [ @@ -96,7 +77,6 @@ cc_library( ], deps = [ ":upb", - ":upb_descriptor", ], ) @@ -145,7 +125,6 @@ upb_amalgamation( amalgamator = ":amalgamate", libs = [ ":upb", - ":upb_descriptor", ":upb_pb", ":upb_json", ], @@ -180,28 +159,40 @@ cc_test( ], ) -cc_test( - name = "test_def", - srcs = ["tests/test_def.c"], - deps = [ - ":upb_pb", - ":upb_test", - ], +upb_proto_reflection_library( + name = "descriptor_upbproto", + deps = ["descriptor_proto"], + upbc = ":protoc-gen-upb", ) cc_test( name = "test_handlers", srcs = ["tests/test_handlers.c"], deps = [ + ":descriptor_upbproto", ":upb_pb", ":upb_test", ], ) +proto_library( + name = "test_decoder_proto", + srcs = [ + "tests/pb/test_decoder.proto" + ] +) + +upb_proto_reflection_library( + name = "test_decoder_upbproto", + deps = ["test_decoder_proto"], + upbc = ":protoc-gen-upb", +) + cc_test( name = "test_decoder", srcs = ["tests/pb/test_decoder.cc"], deps = [ + ":test_decoder_upbproto", ":upb_pb", ":upb_test", ], @@ -210,7 +201,7 @@ cc_test( cc_test( name = "test_encoder", srcs = ["tests/pb/test_encoder.cc"], - data = ["upb/descriptor/descriptor.pb"], + data = ["google/protobuf/descriptor.pb"], deps = [ ":upb_cc_bindings", ":upb_pb", @@ -218,12 +209,25 @@ cc_test( ], ) +proto_library( + name = "test_cpp_proto", + srcs = [ + "tests/test_cpp.proto" + ] +) + +upb_proto_reflection_library( + name = "test_cpp_upbproto", + deps = ["test_cpp_proto"], + upbc = ":protoc-gen-upb", +) + cc_test( name = "test_cpp", srcs = ["tests/test_cpp.cc"], deps = [ + ":test_cpp_upbproto", ":upb", - ":upb_descriptor", ":upb_pb", ":upb_test", ], @@ -238,14 +242,24 @@ cc_test( ], ) +proto_library( + name = "test_json_proto", + srcs = ["tests/json/test.proto"], +) + +upb_proto_reflection_library( + name = "test_json_upbproto", + deps = ["test_json_proto"], + upbc = ":protoc-gen-upb", +) + cc_test( name = "test_json", srcs = [ - "tests/json/test.upbdefs.c", - "tests/json/test.upbdefs.h", "tests/json/test_json.cc", ], deps = [ + ":test_json_upbproto", ":upb_json", ":upb_test", ], @@ -315,23 +329,6 @@ lua_library( ) lua_cclibrary( - name = "lua/upb/table_c", - srcs = ["upb/bindings/lua/upb/table.c"], - luadeps = ["lua/upb_c"], - deps = ["upb"], -) - -lua_library( - name = "lua/upb/table", - srcs = ["upb/bindings/lua/upb/table.lua"], - luadeps = [ - "lua/upb", - "lua/upb/table_c", - ], - strip_prefix = "upb/bindings/lua", -) - -lua_cclibrary( name = "lua/upb/pb_c", srcs = ["upb/bindings/lua/upb/pb.c"], luadeps = ["lua/upb_c"], @@ -348,18 +345,6 @@ lua_library( strip_prefix = "upb/bindings/lua", ) -lua_library( - name = "lua/upbc_lib", - srcs = [ - "tools/dump_cinit.lua", - ], - luadeps = [ - "lua/upb", - "lua/upb/table", - ], - strip_prefix = "tools", -) - # Lua tests. ################################################################### lua_test( @@ -376,14 +361,6 @@ lua_test( # upb compiler ################################################################# -lua_binary( - name = "lua_upbc", - luadeps = [ - "lua/upbc_lib", - ], - luamain = "tools/upbc.lua", -) - cc_library( name = "upbc_generator", hdrs = ["upbc/generator.h"], @@ -449,42 +426,31 @@ genrule( tools = ["@lua"], ) -proto_library( - name = "upb_descriptor_proto", - srcs = [ - "upb/descriptor/descriptor.proto", - ], -) - py_binary( name = "make_cmakelists", srcs = ["tools/make_cmakelists.py"], ) -genrule( - name = "gen_cmakelists", - outs = ["generated/CMakeLists.txt"], - srcs = ["BUILD", "WORKSPACE"], - tools = [":make_cmakelists"], - cmd = "$(location :make_cmakelists) $@" +proto_library( + name = "descriptor_proto", + srcs = [ + "google/protobuf/descriptor.proto", + ], ) genrule( name = "copy_upb_descriptor_pb", - srcs = [":upb_descriptor_proto"], - outs = ["generated/upb/descriptor/descriptor.pb"], + srcs = [":descriptor_proto"], + outs = ["generated/google/protobuf/descriptor.pb"], cmd = "cp $< $@", ) genrule( - name = "generate_old_upbdefs", - srcs = ["generated/upb/descriptor/descriptor.pb"], - outs = [ - "generated/upb/descriptor/descriptor.upbdefs.h", - "generated/upb/descriptor/descriptor.upbdefs.c", - ], - cmd = "UPBC=$$PWD/$(location :lua_upbc); INFILE=$$PWD/$<; cd $(GENDIR)/generated && $$UPBC --generate-upbdefs $$INFILE", - tools = [":lua_upbc"], + name = "gen_cmakelists", + outs = ["generated/CMakeLists.txt"], + srcs = ["BUILD", "WORKSPACE"], + tools = [":make_cmakelists"], + cmd = "$(location :make_cmakelists) $@" ) proto_library( @@ -495,13 +461,6 @@ proto_library( ) genrule( - name = "copy_google_descriptor_pb", - srcs = [":google_descriptor_proto"], - outs = ["generated/google/protobuf/descriptor.pb"], - cmd = "cp $< $@", -) - -genrule( name = "generate_descriptor_c", srcs = ["google/protobuf/descriptor.proto"], outs = [ @@ -528,17 +487,6 @@ genrule( ) genrule( - name = "generated_json_test_proto_upbdefs", - srcs = ["generated/tests/json/test.proto.pb"], - outs = [ - "generated/tests/json/test.upbdefs.h", - "generated/tests/json/test.upbdefs.c", - ], - cmd = "UPBC=$$PWD/$(location :lua_upbc); INFILE=$$PWD/$<; cd $(GENDIR)/generated && $$UPBC --generate-upbdefs $$INFILE", - tools = [":lua_upbc"], -) - -genrule( name = "generate_json_ragel", srcs = ["upb/json/parser.rl"], outs = ["generated/upb/json/parser.c"], @@ -550,14 +498,10 @@ generated_file_staleness_test( name = "test_generated_files", outs = [ "CMakeLists.txt", + "google/protobuf/descriptor.pb", "google/protobuf/descriptor.upb.c", "google/protobuf/descriptor.upb.h", "tests/json/test.proto.pb", - "tests/json/test.upbdefs.c", - "tests/json/test.upbdefs.h", - "upb/descriptor/descriptor.pb", - "upb/descriptor/descriptor.upbdefs.c", - "upb/descriptor/descriptor.upbdefs.h", "upb/json/parser.c", "upb/pb/compile_decoder_x64.h", ], |