Skip to content

Commit 19cf9d1

Browse files
committedJul 16, 2015
Merge pull request protocolbuffers#606 from jtattermusch/csharp-experimental-merged
Update csharp-experimental with changes from upstream/master
2 parents 385baaa + 11002e7 commit 19cf9d1

39 files changed

+761
-430
lines changed
 

‎BUILD

+131-93
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
licenses(["notice"])
44

5+
################################################################################
6+
# Protobuf Runtime Library
7+
################################################################################
8+
59
COPTS = [
610
"-DHAVE_PTHREAD",
711
"-Wall",
@@ -109,6 +113,34 @@ cc_library(
109113
deps = [":protobuf_lite"],
110114
)
111115

116+
objc_library(
117+
name = "protobuf_objc",
118+
hdrs = ["objectivec/GPBProtocolBuffers.h"],
119+
includes = ["objectivec"],
120+
non_arc_srcs = ["objectivec/GPBProtocolBuffers.m"],
121+
visibility = ["//visibility:public"],
122+
)
123+
124+
WELL_KNOWN_PROTOS = [
125+
# AUTOGEN(well_known_protos)
126+
"google/protobuf/any.proto",
127+
"google/protobuf/api.proto",
128+
"google/protobuf/compiler/plugin.proto",
129+
"google/protobuf/descriptor.proto",
130+
"google/protobuf/duration.proto",
131+
"google/protobuf/empty.proto",
132+
"google/protobuf/field_mask.proto",
133+
"google/protobuf/source_context.proto",
134+
"google/protobuf/struct.proto",
135+
"google/protobuf/timestamp.proto",
136+
"google/protobuf/type.proto",
137+
"google/protobuf/wrappers.proto",
138+
]
139+
140+
################################################################################
141+
# Protocol Buffers Compiler
142+
################################################################################
143+
112144
cc_library(
113145
name = "protoc_lib",
114146
srcs = [
@@ -216,22 +248,6 @@ cc_binary(
216248
deps = [":protoc_lib"],
217249
)
218250

219-
WELL_KNOWN_PROTOS = [
220-
# AUTOGEN(well_known_protos)
221-
"google/protobuf/any.proto",
222-
"google/protobuf/api.proto",
223-
"google/protobuf/compiler/plugin.proto",
224-
"google/protobuf/descriptor.proto",
225-
"google/protobuf/duration.proto",
226-
"google/protobuf/empty.proto",
227-
"google/protobuf/field_mask.proto",
228-
"google/protobuf/source_context.proto",
229-
"google/protobuf/struct.proto",
230-
"google/protobuf/timestamp.proto",
231-
"google/protobuf/type.proto",
232-
"google/protobuf/wrappers.proto",
233-
]
234-
235251
################################################################################
236252
# Tests
237253
################################################################################
@@ -286,11 +302,13 @@ PROTOS = LITE_TEST_PROTOS + TEST_PROTOS
286302

287303
INPUTS = PROTOS + WELL_KNOWN_PROTOS
288304

305+
OUTPUTS = ["src/" + x[:-5] + "pb.h" for x in PROTOS] + \
306+
["src/" + x[:-5] + "pb.cc" for x in PROTOS]
307+
289308
genrule(
290309
name = "gen_test_protos",
291310
srcs = ["src/" + x for x in INPUTS],
292-
outs = ["src/" + x[:-5] + "pb.h" for x in PROTOS] +
293-
["src/" + x[:-5] + "pb.cc" for x in PROTOS],
311+
outs = OUTPUTS,
294312
cmd =
295313
"$(location :protoc) --cpp_out=$(@D)/src" +
296314
"".join([" -I" + x + "=$(location src/" + x + ")" for x in INPUTS]) +
@@ -307,78 +325,98 @@ COMMON_TEST_SRCS = [
307325
"src/google/protobuf/testing/googletest.cc",
308326
]
309327

310-
# TODO(liujisi): Add gtest dependency and enable tests.
311-
# cc_test(
312-
# name = "protobuf_test",
313-
# srcs = OUTPUTS + COMMON_TEST_SRCS + [
314-
# "src/google/protobuf/any_test.cc",
315-
# "src/google/protobuf/arena_unittest.cc",
316-
# "src/google/protobuf/arenastring_unittest.cc",
317-
# "src/google/protobuf/compiler/command_line_interface_unittest.cc",
318-
# "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
319-
# "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
320-
# "src/google/protobuf/compiler/cpp/cpp_unittest.cc",
321-
# "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
322-
# "src/google/protobuf/compiler/importer_unittest.cc",
323-
# "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
324-
# "src/google/protobuf/compiler/java/java_plugin_unittest.cc",
325-
# "src/google/protobuf/compiler/mock_code_generator.cc",
326-
# "src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
327-
# "src/google/protobuf/compiler/parser_unittest.cc",
328-
# "src/google/protobuf/compiler/python/python_plugin_unittest.cc",
329-
# "src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
330-
# "src/google/protobuf/descriptor_database_unittest.cc",
331-
# "src/google/protobuf/descriptor_unittest.cc",
332-
# "src/google/protobuf/drop_unknown_fields_test.cc",
333-
# "src/google/protobuf/dynamic_message_unittest.cc",
334-
# "src/google/protobuf/extension_set_unittest.cc",
335-
# "src/google/protobuf/generated_message_reflection_unittest.cc",
336-
# "src/google/protobuf/io/coded_stream_unittest.cc",
337-
# "src/google/protobuf/io/printer_unittest.cc",
338-
# "src/google/protobuf/io/tokenizer_unittest.cc",
339-
# "src/google/protobuf/io/zero_copy_stream_unittest.cc",
340-
# "src/google/protobuf/map_field_test.cc",
341-
# "src/google/protobuf/map_test.cc",
342-
# "src/google/protobuf/message_unittest.cc",
343-
# "src/google/protobuf/no_field_presence_test.cc",
344-
# "src/google/protobuf/preserve_unknown_enum_test.cc",
345-
# "src/google/protobuf/proto3_arena_unittest.cc",
346-
# "src/google/protobuf/reflection_ops_unittest.cc",
347-
# "src/google/protobuf/repeated_field_reflection_unittest.cc",
348-
# "src/google/protobuf/repeated_field_unittest.cc",
349-
# "src/google/protobuf/stubs/bytestream_unittest.cc",
350-
# "src/google/protobuf/stubs/common_unittest.cc",
351-
# "src/google/protobuf/stubs/once_unittest.cc",
352-
# "src/google/protobuf/stubs/status_test.cc",
353-
# "src/google/protobuf/stubs/statusor_test.cc",
354-
# "src/google/protobuf/stubs/stringpiece_unittest.cc",
355-
# "src/google/protobuf/stubs/stringprintf_unittest.cc",
356-
# "src/google/protobuf/stubs/structurally_valid_unittest.cc",
357-
# "src/google/protobuf/stubs/strutil_unittest.cc",
358-
# "src/google/protobuf/stubs/template_util_unittest.cc",
359-
# "src/google/protobuf/stubs/time_test.cc",
360-
# "src/google/protobuf/stubs/type_traits_unittest.cc",
361-
# "src/google/protobuf/text_format_unittest.cc",
362-
# "src/google/protobuf/unknown_field_set_unittest.cc",
363-
# "src/google/protobuf/util/field_comparator_test.cc",
364-
# "src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
365-
# "src/google/protobuf/util/internal/json_objectwriter_test.cc",
366-
# "src/google/protobuf/util/internal/json_stream_parser_test.cc",
367-
# "src/google/protobuf/util/internal/protostream_objectsource_test.cc",
368-
# "src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
369-
# "src/google/protobuf/util/internal/type_info_test_helper.cc",
370-
# "src/google/protobuf/util/json_util_test.cc",
371-
# "src/google/protobuf/util/type_resolver_util_test.cc",
372-
# "src/google/protobuf/well_known_types_unittest.cc",
373-
# "src/google/protobuf/wire_format_unittest.cc",
374-
# ],
375-
# copts = COPTS,
376-
# includes = [
377-
# "src/",
378-
# ],
379-
# linkopts = LINK_OPTS,
380-
# deps = [
381-
# ":protobuf",
382-
# ":protoc_lib",
383-
# ],
384-
# )
328+
cc_binary(
329+
name = "test_plugin",
330+
srcs = [
331+
# AUTOGEN(test_plugin_srcs)
332+
"src/google/protobuf/compiler/mock_code_generator.cc",
333+
"src/google/protobuf/compiler/test_plugin.cc",
334+
"src/google/protobuf/testing/file.cc",
335+
],
336+
deps = [
337+
":protobuf",
338+
":protoc_lib",
339+
"//external:gtest",
340+
],
341+
)
342+
343+
cc_test(
344+
name = "protobuf_test",
345+
srcs = OUTPUTS + COMMON_TEST_SRCS + [
346+
# AUTOGEN(test_srcs)
347+
"src/google/protobuf/any_test.cc",
348+
"src/google/protobuf/arena_unittest.cc",
349+
"src/google/protobuf/arenastring_unittest.cc",
350+
"src/google/protobuf/compiler/command_line_interface_unittest.cc",
351+
"src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
352+
"src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
353+
"src/google/protobuf/compiler/cpp/cpp_unittest.cc",
354+
"src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc",
355+
"src/google/protobuf/compiler/importer_unittest.cc",
356+
"src/google/protobuf/compiler/java/java_doc_comment_unittest.cc",
357+
"src/google/protobuf/compiler/java/java_plugin_unittest.cc",
358+
"src/google/protobuf/compiler/mock_code_generator.cc",
359+
"src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc",
360+
"src/google/protobuf/compiler/parser_unittest.cc",
361+
"src/google/protobuf/compiler/python/python_plugin_unittest.cc",
362+
"src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc",
363+
"src/google/protobuf/descriptor_database_unittest.cc",
364+
"src/google/protobuf/descriptor_unittest.cc",
365+
"src/google/protobuf/drop_unknown_fields_test.cc",
366+
"src/google/protobuf/dynamic_message_unittest.cc",
367+
"src/google/protobuf/extension_set_unittest.cc",
368+
"src/google/protobuf/generated_message_reflection_unittest.cc",
369+
"src/google/protobuf/io/coded_stream_unittest.cc",
370+
"src/google/protobuf/io/printer_unittest.cc",
371+
"src/google/protobuf/io/tokenizer_unittest.cc",
372+
"src/google/protobuf/io/zero_copy_stream_unittest.cc",
373+
"src/google/protobuf/map_field_test.cc",
374+
"src/google/protobuf/map_test.cc",
375+
"src/google/protobuf/message_unittest.cc",
376+
"src/google/protobuf/no_field_presence_test.cc",
377+
"src/google/protobuf/preserve_unknown_enum_test.cc",
378+
"src/google/protobuf/proto3_arena_unittest.cc",
379+
"src/google/protobuf/reflection_ops_unittest.cc",
380+
"src/google/protobuf/repeated_field_reflection_unittest.cc",
381+
"src/google/protobuf/repeated_field_unittest.cc",
382+
"src/google/protobuf/stubs/bytestream_unittest.cc",
383+
"src/google/protobuf/stubs/common_unittest.cc",
384+
"src/google/protobuf/stubs/once_unittest.cc",
385+
"src/google/protobuf/stubs/status_test.cc",
386+
"src/google/protobuf/stubs/statusor_test.cc",
387+
"src/google/protobuf/stubs/stringpiece_unittest.cc",
388+
"src/google/protobuf/stubs/stringprintf_unittest.cc",
389+
"src/google/protobuf/stubs/structurally_valid_unittest.cc",
390+
"src/google/protobuf/stubs/strutil_unittest.cc",
391+
"src/google/protobuf/stubs/template_util_unittest.cc",
392+
"src/google/protobuf/stubs/time_test.cc",
393+
"src/google/protobuf/stubs/type_traits_unittest.cc",
394+
"src/google/protobuf/text_format_unittest.cc",
395+
"src/google/protobuf/unknown_field_set_unittest.cc",
396+
"src/google/protobuf/util/field_comparator_test.cc",
397+
"src/google/protobuf/util/internal/default_value_objectwriter_test.cc",
398+
"src/google/protobuf/util/internal/json_objectwriter_test.cc",
399+
"src/google/protobuf/util/internal/json_stream_parser_test.cc",
400+
"src/google/protobuf/util/internal/protostream_objectsource_test.cc",
401+
"src/google/protobuf/util/internal/protostream_objectwriter_test.cc",
402+
"src/google/protobuf/util/internal/type_info_test_helper.cc",
403+
"src/google/protobuf/util/json_util_test.cc",
404+
"src/google/protobuf/util/type_resolver_util_test.cc",
405+
"src/google/protobuf/well_known_types_unittest.cc",
406+
"src/google/protobuf/wire_format_unittest.cc",
407+
],
408+
copts = COPTS,
409+
data = [
410+
":test_plugin",
411+
],
412+
includes = [
413+
"src/",
414+
],
415+
linkopts = LINK_OPTS,
416+
deps = [
417+
":protobuf",
418+
":protoc_lib",
419+
"//external:gtest_main",
420+
],
421+
)
422+

‎Protobuf.podspec

+5-19
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,11 @@ Pod::Spec.new do |s|
1111
s.license = 'New BSD'
1212
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
1313

14-
s.source_files = 'objectivec/*.{h,m}',
15-
'objectivec/google/protobuf/Any.pbobjc.{h,m}',
16-
'objectivec/google/protobuf/Api.pbobjc.{h,m}',
17-
'objectivec/google/protobuf/Descriptor.pbobjc.{h,m}',
18-
'objectivec/google/protobuf/Duration.pbobjc.h',
19-
'objectivec/google/protobuf/Empty.pbobjc.{h,m}',
20-
'objectivec/google/protobuf/FieldMask.pbobjc.{h,m}',
21-
'objectivec/google/protobuf/SourceContext.pbobjc.{h,m}',
22-
'objectivec/google/protobuf/Struct.pbobjc.{h,m}',
23-
'objectivec/google/protobuf/Timestamp.pbobjc.h',
24-
'objectivec/google/protobuf/Type.pbobjc.{h,m}'
25-
'objectivec/google/protobuf/Wrappers.pbobjc.{h,m}'
26-
# Timestamp.pbobjc.m and Duration.pbobjc.m are #imported by GPBWellKnownTypes.m. So we can't
27-
# compile them (duplicate symbols), but we need them available for the importing:
28-
s.preserve_paths = 'objectivec/google/protobuf/Duration.pbobjc.m',
29-
'objectivec/google/protobuf/Timestamp.pbobjc.m'
30-
# The following would cause duplicate symbol definitions. GPBProtocolBuffers is expected to be
31-
# left out, as it's an umbrella implementation file.
32-
s.exclude_files = 'objectivec/GPBProtocolBuffers.m'
14+
s.source_files = 'objectivec/GPBProtocolBuffers.{h,m}'
15+
# GPBProtocolBuffers.{h,m} are umbrella files. We need Cocoapods to preserve the files imported by
16+
# them.
17+
s.preserve_paths = 'objectivec/*.{h,m}',
18+
'objectivec/google/protobuf/*.pbobjc.{h,m}'
3319
s.header_mappings_dir = 'objectivec'
3420

3521
s.ios.deployment_target = '6.0'

‎WORKSPACE

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
new_http_archive(
2+
name = "gmock_archive",
3+
url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip",
4+
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
5+
build_file = "gmock.BUILD",
6+
)
7+
8+
bind(
9+
name = "gtest",
10+
actual = "@gmock_archive//:gtest",
11+
)
12+
13+
bind(
14+
name = "gtest_main",
15+
actual = "@gmock_archive//:gtest_main",
16+
)

‎cmake/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Compiling and Installing
3232
If you don't have gmock, skip the build of tests by turning off the
3333
BUILD_TESTING option:
3434

35-
$ cmake -G "Visutal Studio 9 2008" -DBUILD_TESTING=OFF ..
35+
$ cmake -G "Visual Studio 9 2008" -DBUILD_TESTING=OFF ..
3636

3737
3. Open the generated protobuf.sln file in Microsoft Visual Studio.
3838
4. Choose "Debug" or "Release" configuration as desired.

‎cmake/extract_includes.bat.in

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h include
8989
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h include\google\protobuf\stubs\fastmem.h
9090
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h include\google\protobuf\stubs\hash.h
9191
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h
92-
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\pbconfig.h include\google\protobuf\stubs\pbconfig.h
9392
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h include\google\protobuf\stubs\platform_macros.h
9493
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h include\google\protobuf\stubs\shared_ptr.h
9594
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h include\google\protobuf\stubs\singleton.h

‎conformance/ConformanceJava.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest re
5454
break;
5555
}
5656
case JSON_PAYLOAD: {
57-
return Conformance.ConformanceResponse.newBuilder().setRuntimeError("JSON not yet supported.").build();
57+
return Conformance.ConformanceResponse.newBuilder().setSkipped("JSON not yet supported.").build();
5858
}
5959
case PAYLOAD_NOT_SET: {
6060
throw new RuntimeException("Request didn't have payload.");
@@ -65,15 +65,15 @@ private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest re
6565
}
6666
}
6767

68-
switch (request.getRequestedOutput()) {
68+
switch (request.getRequestedOutputFormat()) {
6969
case UNSPECIFIED:
7070
throw new RuntimeException("Unspecified output format.");
7171

7272
case PROTOBUF:
7373
return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build();
7474

7575
case JSON:
76-
return Conformance.ConformanceResponse.newBuilder().setRuntimeError("JSON not yet supported.").build();
76+
return Conformance.ConformanceResponse.newBuilder().setSkipped("JSON not yet supported.").build();
7777

7878
default: {
7979
throw new RuntimeException("Unexpected request output.");

‎conformance/conformance.proto

+11-7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ option java_package = "com.google.protobuf.conformance";
5151
// - running as a sub-process may be more tricky in unusual environments like
5252
// iOS apps, where fork/stdin/stdout are not available.
5353

54+
enum WireFormat {
55+
UNSPECIFIED = 0;
56+
PROTOBUF = 1;
57+
JSON = 2;
58+
}
59+
5460
// Represents a single test case's input. The testee should:
5561
//
5662
// 1. parse this proto (which should always succeed)
@@ -64,14 +70,8 @@ message ConformanceRequest {
6470
string json_payload = 2;
6571
}
6672

67-
enum RequestedOutput {
68-
UNSPECIFIED = 0;
69-
PROTOBUF = 1;
70-
JSON = 2;
71-
}
72-
7373
// Which format should the testee serialize its message to?
74-
RequestedOutput requested_output = 3;
74+
WireFormat requested_output_format = 3;
7575
}
7676

7777
// Represents a single test case's output.
@@ -96,6 +96,10 @@ message ConformanceResponse {
9696
// If the input was successfully parsed and the requested output was JSON,
9797
// serialize to JSON and set it in this field.
9898
string json_payload = 4;
99+
100+
// For when the testee skipped the test, likely because a certain feature
101+
// wasn't supported, like JSON input/output.
102+
string skipped = 5;
99103
}
100104
}
101105

0 commit comments

Comments
 (0)
Please sign in to comment.