Adjust based on review feedback
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 35ce28c..86b9014 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -44,7 +44,7 @@
# Note that this deliberately does *not* include old_extensions1.proto
# and old_extensions2.proto, which are generated with an older version
# of protoc.
-$PROTOC -Isrc -Icsharp/protos -Icsharp/protos/extensions \
+$PROTOC -Isrc -Icsharp/protos \
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
--include_source_info \
@@ -58,9 +58,9 @@
unittest.proto \
unittest_import.proto \
unittest_import_public.proto \
- extensions_a.proto \
- extensions_b.proto \
- extensions_c.proto \
+ extensions_issue6936_a.proto \
+ extensions_issue6936_b.proto \
+ extensions_issue6936_c.proto \
google/protobuf/unittest_well_known_types.proto \
google/protobuf/test_messages_proto3.proto \
google/protobuf/test_messages_proto2.proto
diff --git a/csharp/protos/extensions/extensions_a.proto b/csharp/protos/extensions/extensions_a.proto
deleted file mode 100644
index e967ded..0000000
--- a/csharp/protos/extensions/extensions_a.proto
+++ /dev/null
@@ -1,12 +0,0 @@
-syntax = "proto3";
-
-option csharp_namespace = "Google.Protobuf.TestProtos.Extensions";
-
-// This file is used as part of a unit test for issue 6936
-// We don't need to use it, we just have to import it in both b and c
-
-import "google/protobuf/descriptor.proto";
-
-extend google.protobuf.MessageOptions {
- string opt = 50000;
-}
\ No newline at end of file
diff --git a/csharp/protos/extensions/extensions_b.proto b/csharp/protos/extensions/extensions_b.proto
deleted file mode 100644
index c19e988..0000000
--- a/csharp/protos/extensions/extensions_b.proto
+++ /dev/null
@@ -1,12 +0,0 @@
-syntax = "proto3";
-
-import "extensions_a.proto";
-
-option csharp_namespace = "Google.Protobuf.TestProtos.Extensions";
-
-// This file is used as part of a unit test for issue 6936
-// We don't need to use it, we just have to import it in c
-
-message Foo {
- option (opt) = "bar";
-}
\ No newline at end of file
diff --git a/csharp/protos/extensions/extensions_c.proto b/csharp/protos/extensions/extensions_c.proto
deleted file mode 100644
index 3a32da9..0000000
--- a/csharp/protos/extensions/extensions_c.proto
+++ /dev/null
@@ -1,14 +0,0 @@
-syntax = "proto3";
-
-import "extensions_a.proto";
-import "extensions_b.proto";
-
-option csharp_namespace = "Google.Protobuf.TestProtos.Extensions";
-
-// This file is used as part of a unit test for issue 6936
-// We don't need to use it, we just have to load it at runtime
-
-message Bar {
- option (opt) = "foo";
- Foo foo = 1;
-}
\ No newline at end of file
diff --git a/csharp/protos/extensions_issue6936_a.proto b/csharp/protos/extensions_issue6936_a.proto
new file mode 100644
index 0000000..097d083
--- /dev/null
+++ b/csharp/protos/extensions_issue6936_a.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+
+package unittest_issues;
+
+option csharp_namespace = "UnitTest.Issues.TestProtos";
+
+// This file is used as part of a unit test for issue 6936
+// We don't need to use it, we just have to import it in both
+// "extensions_issue6936_b.proto" and "extensions_issue6936_c.proto"
+
+import "google/protobuf/descriptor.proto";
+
+extend google.protobuf.MessageOptions {
+ string opt = 50000;
+}
\ No newline at end of file
diff --git a/csharp/protos/extensions_issue6936_b.proto b/csharp/protos/extensions_issue6936_b.proto
new file mode 100644
index 0000000..2027b7b
--- /dev/null
+++ b/csharp/protos/extensions_issue6936_b.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+
+import "extensions_issue6936_a.proto";
+
+package unittest_issues;
+
+option csharp_namespace = "UnitTest.Issues.TestProtos";
+
+// This file is used as part of a unit test for issue 6936
+// We don't need to use it, we just have to import it in "extensions_issue6936_c.proto"
+
+message Foo {
+ option (opt) = "foo";
+}
\ No newline at end of file
diff --git a/csharp/protos/extensions_issue6936_c.proto b/csharp/protos/extensions_issue6936_c.proto
new file mode 100644
index 0000000..d33794d
--- /dev/null
+++ b/csharp/protos/extensions_issue6936_c.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+
+import "extensions_issue6936_a.proto";
+import "extensions_issue6936_b.proto";
+
+package unittest_issues;
+
+option csharp_namespace = "UnitTest.Issues.TestProtos";
+
+// This file is used as part of a unit test for issue 6936
+// We don't need to use it, we just have to load it at runtime
+
+message Bar {
+ option (opt) = "bar";
+ Foo foo = 1;
+}
\ No newline at end of file
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs
similarity index 62%
rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs
rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs
index f2f66ff..95a746b 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsA.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936A.cs
@@ -1,6 +1,6 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: extensions_a.proto
+// source: extensions_issue6936_a.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,34 +9,34 @@
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos.Extensions {
+namespace UnitTest.Issues.TestProtos {
- /// <summary>Holder for reflection information generated from extensions_a.proto</summary>
- public static partial class ExtensionsAReflection {
+ /// <summary>Holder for reflection information generated from extensions_issue6936_a.proto</summary>
+ public static partial class ExtensionsIssue6936AReflection {
#region Descriptor
- /// <summary>File descriptor for extensions_a.proto</summary>
+ /// <summary>File descriptor for extensions_issue6936_a.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static ExtensionsAReflection() {
+ static ExtensionsIssue6936AReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChJleHRlbnNpb25zX2EucHJvdG8aIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw",
- "dG9yLnByb3RvOi4KA29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0",
- "aW9ucxjQhgMgASgJQiiqAiVHb29nbGUuUHJvdG9idWYuVGVzdFByb3Rvcy5F",
- "eHRlbnNpb25zYgZwcm90bzM="));
+ "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9hLnByb3RvEg91bml0dGVzdF9pc3N1",
+ "ZXMaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnByb3RvOi4KA29wdBIf",
+ "Lmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjQhgMgASgJQh2qAhpV",
+ "bml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, },
- new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsAExtensions.Opt }, null));
+ new pbr::GeneratedClrTypeInfo(null, new pb::Extension[] { ExtensionsIssue6936AExtensions.Opt }, null));
}
#endregion
}
- /// <summary>Holder for extension identifiers generated from the top level of extensions_a.proto</summary>
- public static partial class ExtensionsAExtensions {
+ /// <summary>Holder for extension identifiers generated from the top level of extensions_issue6936_a.proto</summary>
+ public static partial class ExtensionsIssue6936AExtensions {
public static readonly pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string> Opt =
new pb::Extension<global::Google.Protobuf.Reflection.MessageOptions, string>(50000, pb::FieldCodec.ForString(400002, ""));
}
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs
similarity index 80%
rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs
rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs
index a67688f..2404906 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsB.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936B.cs
@@ -1,6 +1,6 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: extensions_b.proto
+// source: extensions_issue6936_b.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,28 +9,28 @@
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos.Extensions {
+namespace UnitTest.Issues.TestProtos {
- /// <summary>Holder for reflection information generated from extensions_b.proto</summary>
- public static partial class ExtensionsBReflection {
+ /// <summary>Holder for reflection information generated from extensions_issue6936_b.proto</summary>
+ public static partial class ExtensionsIssue6936BReflection {
#region Descriptor
- /// <summary>File descriptor for extensions_b.proto</summary>
+ /// <summary>File descriptor for extensions_issue6936_b.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static ExtensionsBReflection() {
+ static ExtensionsIssue6936BReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChJleHRlbnNpb25zX2IucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90byIOCgNG",
- "b286B4K1GANiYXJCKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4",
- "dGVuc2lvbnNiBnByb3RvMw=="));
+ "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9iLnByb3RvEg91bml0dGVzdF9pc3N1",
+ "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8iDgoDRm9vOgeCtRgD",
+ "Zm9vQh2qAhpVbml0VGVzdC5Jc3N1ZXMuVGVzdFByb3Rvc2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, },
+ new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Foo), global::Google.Protobuf.TestProtos.Extensions.Foo.Parser, null, null, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Foo), global::UnitTest.Issues.TestProtos.Foo.Parser, null, null, null, null, null)
}));
}
#endregion
@@ -45,7 +45,7 @@
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
- get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor.MessageTypes[0]; }
+ get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs
similarity index 77%
rename from csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs
rename to csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs
index d8387c1..aeffcc1 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsC.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/ExtensionsIssue6936C.cs
@@ -1,6 +1,6 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: extensions_c.proto
+// source: extensions_issue6936_c.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,29 +9,30 @@
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
-namespace Google.Protobuf.TestProtos.Extensions {
+namespace UnitTest.Issues.TestProtos {
- /// <summary>Holder for reflection information generated from extensions_c.proto</summary>
- public static partial class ExtensionsCReflection {
+ /// <summary>Holder for reflection information generated from extensions_issue6936_c.proto</summary>
+ public static partial class ExtensionsIssue6936CReflection {
#region Descriptor
- /// <summary>File descriptor for extensions_c.proto</summary>
+ /// <summary>File descriptor for extensions_issue6936_c.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static ExtensionsCReflection() {
+ static ExtensionsIssue6936CReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChJleHRlbnNpb25zX2MucHJvdG8aEmV4dGVuc2lvbnNfYS5wcm90bxoSZXh0",
- "ZW5zaW9uc19iLnByb3RvIiEKA0JhchIRCgNmb28YASABKAsyBC5Gb286B4K1",
- "GANmb29CKKoCJUdvb2dsZS5Qcm90b2J1Zi5UZXN0UHJvdG9zLkV4dGVuc2lv",
- "bnNiBnByb3RvMw=="));
+ "ChxleHRlbnNpb25zX2lzc3VlNjkzNl9jLnByb3RvEg91bml0dGVzdF9pc3N1",
+ "ZXMaHGV4dGVuc2lvbnNfaXNzdWU2OTM2X2EucHJvdG8aHGV4dGVuc2lvbnNf",
+ "aXNzdWU2OTM2X2IucHJvdG8iMQoDQmFyEiEKA2ZvbxgBIAEoCzIULnVuaXR0",
+ "ZXN0X2lzc3Vlcy5Gb286B4K1GANiYXJCHaoCGlVuaXRUZXN0Lklzc3Vlcy5U",
+ "ZXN0UHJvdG9zYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
- new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.Extensions.ExtensionsAReflection.Descriptor, global::Google.Protobuf.TestProtos.Extensions.ExtensionsBReflection.Descriptor, },
+ new pbr::FileDescriptor[] { global::UnitTest.Issues.TestProtos.ExtensionsIssue6936AReflection.Descriptor, global::UnitTest.Issues.TestProtos.ExtensionsIssue6936BReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.Extensions.Bar), global::Google.Protobuf.TestProtos.Extensions.Bar.Parser, new[]{ "Foo" }, null, null, null, null)
+ new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Bar), global::UnitTest.Issues.TestProtos.Bar.Parser, new[]{ "Foo" }, null, null, null, null)
}));
}
#endregion
@@ -46,7 +47,7 @@
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
- get { return global::Google.Protobuf.TestProtos.Extensions.ExtensionsCReflection.Descriptor.MessageTypes[0]; }
+ get { return global::UnitTest.Issues.TestProtos.ExtensionsIssue6936CReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -74,9 +75,9 @@
/// <summary>Field number for the "foo" field.</summary>
public const int FooFieldNumber = 1;
- private global::Google.Protobuf.TestProtos.Extensions.Foo foo_;
+ private global::UnitTest.Issues.TestProtos.Foo foo_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
- public global::Google.Protobuf.TestProtos.Extensions.Foo Foo {
+ public global::UnitTest.Issues.TestProtos.Foo Foo {
get { return foo_; }
set {
foo_ = value;
@@ -145,7 +146,7 @@
}
if (other.foo_ != null) {
if (foo_ == null) {
- Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo();
+ Foo = new global::UnitTest.Issues.TestProtos.Foo();
}
Foo.MergeFrom(other.Foo);
}
@@ -162,7 +163,7 @@
break;
case 10: {
if (foo_ == null) {
- Foo = new global::Google.Protobuf.TestProtos.Extensions.Foo();
+ Foo = new global::UnitTest.Issues.TestProtos.Foo();
}
input.ReadMessage(Foo);
break;
diff --git a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
index efbc48a..bf5f5ad 100644
--- a/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs
@@ -42,7 +42,6 @@
using static UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Extensions;
using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types;
using Google.Protobuf.TestProtos;
-using Google.Protobuf.TestProtos.Extensions;
#pragma warning disable CS0618
@@ -197,11 +196,11 @@
[Test]
public void MultipleImportOfSameFileWithExtension()
{
- var descriptor = ExtensionsCReflection.Descriptor;
+ var descriptor = ExtensionsIssue6936CReflection.Descriptor;
var foo = Foo.Descriptor;
var bar = Bar.Descriptor;
- AssertOption("bar", foo.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, foo.GetOption);
- AssertOption("foo", bar.CustomOptions.TryGetString, ExtensionsAExtensions.Opt, bar.GetOption);
+ AssertOption("foo", foo.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, foo.GetOption);
+ AssertOption("bar", bar.CustomOptions.TryGetString, ExtensionsIssue6936AExtensions.Opt, bar.GetOption);
}
private void AssertOption<T, D>(T expected, OptionFetcher<T> fetcher, Extension<D, T> extension, Func<Extension<D, T>, T> descriptorOptionFetcher) where D : IExtendableMessage<D>
diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
index b1c6650..7f2e310 100644
--- a/csharp/src/Google.Protobuf.Test/testprotos.pb
+++ b/csharp/src/Google.Protobuf.Test/testprotos.pb
Binary files differ