diff --git a/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs b/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
index 8f9da5722b4d..ae96061243bf 100644
--- a/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
+++ b/csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
@@ -27,26 +27,28 @@ static PluginReflection() {
"CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29n",
"bGUucHJvdG9idWYuY29tcGlsZXIaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw",
"dG9yLnByb3RvIkYKB1ZlcnNpb24SDQoFbWFqb3IYASABKAUSDQoFbWlub3IY",
- "AiABKAUSDQoFcGF0Y2gYAyABKAUSDgoGc3VmZml4GAQgASgJIroBChRDb2Rl",
+ "AiABKAUSDQoFcGF0Y2gYAyABKAUSDgoGc3VmZml4GAQgASgJIoECChRDb2Rl",
"R2VuZXJhdG9yUmVxdWVzdBIYChBmaWxlX3RvX2dlbmVyYXRlGAEgAygJEhEK",
"CXBhcmFtZXRlchgCIAEoCRI4Cgpwcm90b19maWxlGA8gAygLMiQuZ29vZ2xl",
- "LnByb3RvYnVmLkZpbGVEZXNjcmlwdG9yUHJvdG8SOwoQY29tcGlsZXJfdmVy",
- "c2lvbhgDIAEoCzIhLmdvb2dsZS5wcm90b2J1Zi5jb21waWxlci5WZXJzaW9u",
- "IsECChVDb2RlR2VuZXJhdG9yUmVzcG9uc2USDQoFZXJyb3IYASABKAkSGgoS",
- "c3VwcG9ydGVkX2ZlYXR1cmVzGAIgASgEEkIKBGZpbGUYDyADKAsyNC5nb29n",
- "bGUucHJvdG9idWYuY29tcGlsZXIuQ29kZUdlbmVyYXRvclJlc3BvbnNlLkZp",
- "bGUafwoERmlsZRIMCgRuYW1lGAEgASgJEhcKD2luc2VydGlvbl9wb2ludBgC",
- "IAEoCRIPCgdjb250ZW50GA8gASgJEj8KE2dlbmVyYXRlZF9jb2RlX2lu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MUGx1Z2luUHJvdG9zWilnb29nbGUu",
+ "Z29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9wbHVnaW5wYqoCGEdvb2dsZS5Q",
+ "cm90b2J1Zi5Db21waWxlcg=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Compiler.Version), global::Google.Protobuf.Compiler.Version.Parser, new[]{ "Major", "Minor", "Patch", "Suffix" }, null, null, null, null),
- new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Compiler.CodeGeneratorRequest), global::Google.Protobuf.Compiler.CodeGeneratorRequest.Parser, new[]{ "FileToGenerate", "Parameter", "ProtoFile", "CompilerVersion" }, null, null, null, null),
+ new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Compiler.CodeGeneratorRequest), global::Google.Protobuf.Compiler.CodeGeneratorRequest.Parser, new[]{ "FileToGenerate", "Parameter", "ProtoFile", "SourceFileDescriptors", "CompilerVersion" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Compiler.CodeGeneratorResponse), global::Google.Protobuf.Compiler.CodeGeneratorResponse.Parser, new[]{ "Error", "SupportedFeatures", "File" }, null, new[]{ typeof(global::Google.Protobuf.Compiler.CodeGeneratorResponse.Types.Feature) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Compiler.CodeGeneratorResponse.Types.File), global::Google.Protobuf.Compiler.CodeGeneratorResponse.Types.File.Parser, new[]{ "Name", "InsertionPoint", "Content", "GeneratedCodeInfo" }, null, null, null, null)})
}));
}
@@ -462,6 +464,7 @@ public CodeGeneratorRequest(CodeGeneratorRequest other) : this() {
fileToGenerate_ = other.fileToGenerate_.Clone();
parameter_ = other.parameter_;
protoFile_ = other.protoFile_.Clone();
+ sourceFileDescriptors_ = other.sourceFileDescriptors_.Clone();
compilerVersion_ = other.compilerVersion_ != null ? other.compilerVersion_.Clone() : null;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@@ -527,6 +530,11 @@ public void ClearParameter() {
/// they import. The files will appear in topological order, so each file
/// appears before any file that imports it.
///
+ /// Note: the files listed in files_to_generate will include runtime-retention
+ /// options only, but all other files will include source-retention options.
+ /// The source_file_descriptors field below is available in case you need
+ /// source-retention options for files_to_generate.
+ ///
/// protoc guarantees that all proto_files will be written after
/// the fields above, even though this is not technically guaranteed by the
/// protobuf wire format. This theoretically could allow a plugin to stream
@@ -544,6 +552,22 @@ public void ClearParameter() {
get { return protoFile_; }
}
+ /// Field number for the "source_file_descriptors" field.
+ public const int SourceFileDescriptorsFieldNumber = 17;
+ private static readonly pb::FieldCodec _repeated_sourceFileDescriptors_codec
+ = pb::FieldCodec.ForMessage(138, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser);
+ private readonly pbc::RepeatedField sourceFileDescriptors_ = new pbc::RepeatedField();
+ ///
+ /// File descriptors with all options, including source-retention options.
+ /// These descriptors are only provided for the files listed in
+ /// files_to_generate.
+ ///
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+ [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+ public pbc::RepeatedField SourceFileDescriptors {
+ get { return sourceFileDescriptors_; }
+ }
+
/// Field number for the "compiler_version" field.
public const int CompilerVersionFieldNumber = 3;
private global::Google.Protobuf.Compiler.Version compilerVersion_;
@@ -577,6 +601,7 @@ public bool Equals(CodeGeneratorRequest other) {
if(!fileToGenerate_.Equals(other.fileToGenerate_)) return false;
if (Parameter != other.Parameter) return false;
if(!protoFile_.Equals(other.protoFile_)) return false;
+ if(!sourceFileDescriptors_.Equals(other.sourceFileDescriptors_)) return false;
if (!object.Equals(CompilerVersion, other.CompilerVersion)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@@ -588,6 +613,7 @@ public override int GetHashCode() {
hash ^= fileToGenerate_.GetHashCode();
if (HasParameter) hash ^= Parameter.GetHashCode();
hash ^= protoFile_.GetHashCode();
+ hash ^= sourceFileDescriptors_.GetHashCode();
if (compilerVersion_ != null) hash ^= CompilerVersion.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
@@ -617,6 +643,7 @@ public void WriteTo(pb::CodedOutputStream output) {
output.WriteMessage(CompilerVersion);
}
protoFile_.WriteTo(output, _repeated_protoFile_codec);
+ sourceFileDescriptors_.WriteTo(output, _repeated_sourceFileDescriptors_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@@ -637,6 +664,7 @@ public void WriteTo(pb::CodedOutputStream output) {
output.WriteMessage(CompilerVersion);
}
protoFile_.WriteTo(ref output, _repeated_protoFile_codec);
+ sourceFileDescriptors_.WriteTo(ref output, _repeated_sourceFileDescriptors_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
@@ -652,6 +680,7 @@ public int CalculateSize() {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Parameter);
}
size += protoFile_.CalculateSize(_repeated_protoFile_codec);
+ size += sourceFileDescriptors_.CalculateSize(_repeated_sourceFileDescriptors_codec);
if (compilerVersion_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(CompilerVersion);
}
@@ -672,6 +701,7 @@ public void MergeFrom(CodeGeneratorRequest other) {
Parameter = other.Parameter;
}
protoFile_.Add(other.protoFile_);
+ sourceFileDescriptors_.Add(other.sourceFileDescriptors_);
if (other.compilerVersion_ != null) {
if (compilerVersion_ == null) {
CompilerVersion = new global::Google.Protobuf.Compiler.Version();
@@ -712,6 +742,10 @@ public void MergeFrom(pb::CodedInputStream input) {
protoFile_.AddEntriesFrom(input, _repeated_protoFile_codec);
break;
}
+ case 138: {
+ sourceFileDescriptors_.AddEntriesFrom(input, _repeated_sourceFileDescriptors_codec);
+ break;
+ }
}
}
#endif
@@ -746,6 +780,10 @@ public void MergeFrom(pb::CodedInputStream input) {
protoFile_.AddEntriesFrom(ref input, _repeated_protoFile_codec);
break;
}
+ case 138: {
+ sourceFileDescriptors_.AddEntriesFrom(ref input, _repeated_sourceFileDescriptors_codec);
+ break;
+ }
}
}
}
diff --git a/src/file_lists.cmake b/src/file_lists.cmake
index ed8e43043500..69b10a3960cf 100644
--- a/src/file_lists.cmake
+++ b/src/file_lists.cmake
@@ -693,6 +693,11 @@ set(protobuf_lite_test_protos_files
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto
)
+# @//src/google/protobuf/compiler:fake_plugin_srcs
+set(fake_plugin_files
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/fake_plugin.cc
+)
+
# @//src/google/protobuf/compiler:test_srcs
set(compiler_test_files
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc