Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
03872044
Commit
03872044
authored
Mar 16, 2019
by
ObsidianMinor
Committed by
Sydney Acksman
Aug 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make extension container classes public and modify conformance to test proto2 messages
parent
05712c67
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
8 deletions
+17
-8
generate_protos.sh
csharp/generate_protos.sh
+2
-1
Program.cs
csharp/src/Google.Protobuf.Conformance/Program.cs
+11
-3
TestMessagesProto2.cs
...src/Google.Protobuf.Test/TestProtos/TestMessagesProto2.cs
+0
-0
UnittestCustomOptionsProto3.cs
...e.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
+2
-2
csharp_message.cc
src/google/protobuf/compiler/csharp/csharp_message.cc
+1
-1
csharp_reflection_class.cc
...oogle/protobuf/compiler/csharp/csharp_reflection_class.cc
+1
-1
No files found.
csharp/generate_protos.sh
View file @
03872044
...
...
@@ -53,7 +53,8 @@ $PROTOC -Isrc -Icsharp/protos \
csharp/protos/unittest_import_proto3.proto
\
csharp/protos/unittest_import_public_proto3.proto
\
src/google/protobuf/unittest_well_known_types.proto
\
src/google/protobuf/test_messages_proto3.proto
src/google/protobuf/test_messages_proto3.proto
\
src/google/protobuf/test_messages_proto2.proto
# AddressBook sample protos
$PROTOC
-Iexamples
-Isrc
--csharp_out
=
csharp/src/AddressBook
\
...
...
csharp/src/Google.Protobuf.Conformance/Program.cs
View file @
03872044
...
...
@@ -48,7 +48,9 @@ namespace Google.Protobuf.Conformance
// This way we get the binary streams instead of readers/writers.
var
input
=
new
BinaryReader
(
Console
.
OpenStandardInput
());
var
output
=
new
BinaryWriter
(
Console
.
OpenStandardOutput
());
var
typeRegistry
=
TypeRegistry
.
FromMessages
(
ProtobufTestMessages
.
Proto3
.
TestAllTypesProto3
.
Descriptor
);
var
typeRegistry
=
TypeRegistry
.
FromMessages
(
ProtobufTestMessages
.
Proto3
.
TestAllTypesProto3
.
Descriptor
,
ProtobufTestMessages
.
Proto2
.
TestAllTypesProto2
.
Descriptor
);
int
count
=
0
;
while
(
RunTest
(
input
,
output
,
typeRegistry
))
...
...
@@ -81,7 +83,7 @@ namespace Google.Protobuf.Conformance
private
static
ConformanceResponse
PerformRequest
(
ConformanceRequest
request
,
TypeRegistry
typeRegistry
)
{
ProtobufTestMessages
.
Proto3
.
TestAllTypesProto3
message
;
IMessage
message
;
try
{
switch
(
request
.
PayloadCase
)
...
...
@@ -101,7 +103,13 @@ namespace Google.Protobuf.Conformance
}
else
if
(
request
.
MessageType
.
Equals
(
"protobuf_test_messages.proto2.TestAllTypesProto2"
))
{
return
new
ConformanceResponse
{
Skipped
=
"CSharp doesn't support proto2"
};
ExtensionRegistry
registry
=
new
ExtensionRegistry
()
{
ProtobufTestMessages
.
Proto2
.
TestMessagesProto2Extensions
.
ExtensionInt32
,
ProtobufTestMessages
.
Proto2
.
TestAllTypesProto2
.
Types
.
MessageSetCorrectExtension1
.
Extensions
.
MessageSetExtension
,
ProtobufTestMessages
.
Proto2
.
TestAllTypesProto2
.
Types
.
MessageSetCorrectExtension2
.
Extensions
.
MessageSetExtension
};
message
=
ProtobufTestMessages
.
Proto2
.
TestAllTypesProto2
.
Parser
.
WithExtensionRegistry
(
registry
).
ParseFrom
(
request
.
ProtobufPayload
);
}
else
{
...
...
csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto2.cs
0 → 100644
View file @
03872044
This source diff could not be displayed because it is too large. You can
view the blob
instead.
csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
View file @
03872044
...
...
@@ -165,7 +165,7 @@ namespace UnitTest.Issues.TestProtos {
}
/// <summary>Holder for extension identifiers generated from the top level of unittest_custom_options_proto3.proto</summary>
internal
static
partial
class
UnittestCustomOptionsProto3Extensions
{
public
static
partial
class
UnittestCustomOptionsProto3Extensions
{
public
static
readonly
pb
::
Extension
<
global
::
Google
.
Protobuf
.
Reflection
.
FileOptions
,
ulong
>
FileOpt1
=
new
pb
::
Extension
<
global
::
Google
.
Protobuf
.
Reflection
.
FileOptions
,
ulong
>(
7736974
,
pb
::
FieldCodec
.
ForUInt64
(
61895792
,
0U
L
));
public
static
readonly
pb
::
Extension
<
global
::
Google
.
Protobuf
.
Reflection
.
MessageOptions
,
int
>
MessageOpt1
=
...
...
@@ -2138,7 +2138,7 @@ namespace UnitTest.Issues.TestProtos {
#
region
Extensions
/// <summary>Container for extensions for other messages declared in the ComplexOptionType4 message type.</summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
internal
static
partial
class
Extensions
{
public
static
partial
class
Extensions
{
public
static
readonly
pb
::
Extension
<
global
::
Google
.
Protobuf
.
Reflection
.
MessageOptions
,
global
::
UnitTest
.
Issues
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
>
ComplexOpt4
=
new
pb
::
Extension
<
global
::
Google
.
Protobuf
.
Reflection
.
MessageOptions
,
global
::
UnitTest
.
Issues
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
>(
7633546
,
pb
::
FieldCodec
.
ForMessage
(
61068370
,
global
::
UnitTest
.
Issues
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
.
Parser
));
}
...
...
src/google/protobuf/compiler/csharp/csharp_message.cc
View file @
03872044
...
...
@@ -320,7 +320,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
"#region Extensions
\n
"
"/// <summary>Container for extensions for other messages declared in the $class_name$ message type.</summary>
\n
"
);
WriteGeneratedCodeAttributes
(
printer
);
printer
->
Print
(
"
internal
static partial class Extensions {
\n
"
);
printer
->
Print
(
"
public
static partial class Extensions {
\n
"
);
printer
->
Indent
();
for
(
int
i
=
0
;
i
<
descriptor_
->
extension_count
();
i
++
)
{
std
::
unique_ptr
<
FieldGeneratorBase
>
generator
(
...
...
src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
View file @
03872044
...
...
@@ -74,7 +74,7 @@ void ReflectionClassGenerator::Generate(io::Printer* printer) {
if
(
file_
->
extension_count
()
>
0
)
{
printer
->
Print
(
"/// <summary>Holder for extension identifiers generated from the top level of $file_name$</summary>
\n
"
"
internal
static partial class $class_name$ {
\n
"
,
"
$access_level$
static partial class $class_name$ {
\n
"
,
"access_level"
,
class_access_level
(),
"class_name"
,
extensionClassname_
,
"file_name"
,
file_
->
name
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment