Commit b76b76ba authored by Paul Yang's avatar Paul Yang

Merge pull request #645 from zsurocking/master

Down integrate. Generate a package name suffix ".nano" for nano messages
parents 914e6ace 9fd0f152
......@@ -40,10 +40,10 @@ import com.google.protobuf.nano.UnittestRecursiveNano.RecursiveMessageNano;
import com.google.protobuf.nano.NanoReferenceTypesCompat;
import com.google.protobuf.nano.UnittestSimpleNano.SimpleMessageNano;
import com.google.protobuf.nano.UnittestSingleNano.SingleMessageNano;
import com.google.protobuf.nano.testext.Extensions;
import com.google.protobuf.nano.testext.Extensions.AnotherMessage;
import com.google.protobuf.nano.testext.Extensions.MessageWithGroup;
import com.google.protobuf.nano.testimport.UnittestImportNano;
import com.google.protobuf.nano.testext.nano.Extensions;
import com.google.protobuf.nano.testext.nano.Extensions.AnotherMessage;
import com.google.protobuf.nano.testext.nano.Extensions.MessageWithGroup;
import com.google.protobuf.nano.testimport.nano.UnittestImportNano;
import junit.framework.TestCase;
......
......@@ -32,7 +32,7 @@ syntax = "proto3";
package map_test;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "MapTestProto";
message TestMap {
......
......@@ -32,7 +32,7 @@
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "NanoAccessorsOuterClass";
message TestNanoAccessors {
......
......@@ -32,7 +32,7 @@
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_multiple_files = true;
enum FileScopeEnumMultiple {
......
......@@ -32,7 +32,7 @@
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "EnumClassNanos";
enum FileScopeEnum {
......
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "EnumValidity";
enum E {
......
syntax = "proto2";
option java_multiple_files = true;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
import "google/protobuf/nano/unittest_extension_nano.proto";
......
syntax = "proto2";
option java_multiple_files = true;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
import "google/protobuf/nano/unittest_extension_nano.proto";
......
syntax = "proto2";
option java_multiple_files = true;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
import "google/protobuf/nano/unittest_extension_nano.proto";
......
......@@ -32,7 +32,7 @@
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "NanoHasOuterClass";
message TestAllTypesNanoHas {
......
......@@ -32,7 +32,7 @@
package protobuf_unittest_import;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "MultipleNameClashNano";
option java_multiple_files = true;
......
......@@ -34,7 +34,7 @@ package protobuf_unittest_import;
import "google/protobuf/nano/unittest_import_nano.proto";
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_multiple_files = true;
enum FileScopeEnum {
......
......@@ -34,7 +34,7 @@ package protobuf_unittest;
import "google/protobuf/nano/unittest_import_nano.proto";
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "NanoOuterClass";
// Same as TestAllTypes but with the nano runtime.
......
......@@ -33,7 +33,7 @@
package protobuf_unittest_import;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
// Explicit outer classname to suppress legacy info.
option java_outer_classname = "UnittestRecursiveNano";
......
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "NanoReferenceTypes";
message TestAllTypesNano {
......
......@@ -34,7 +34,7 @@ package protobuf_unittest;
import "google/protobuf/nano/unittest_nano.proto";
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_multiple_files = true;
// A container message for testing the merging of repeated fields at a
......
......@@ -32,7 +32,7 @@
package protobuf_unittest;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
option java_outer_classname = "NanoRepeatedPackables";
enum Enum {
......
......@@ -33,7 +33,7 @@
package protobuf_unittest_import;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
// Explicit outer classname to suppress legacy info.
option java_outer_classname = "UnittestSimpleNano";
......
......@@ -32,7 +32,7 @@
package protobuf_unittest_import;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
message SingleMessageNano {
}
......@@ -33,7 +33,7 @@
package protobuf_unittest_import;
option java_package = "com.google.protobuf.nano";
option java_package = "com.google.protobuf";
// Explicit outer classname to suppress legacy info.
option java_outer_classname = "UnittestStringutf8Nano";
......
......@@ -82,8 +82,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fany_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\031google/protobuf/any.proto\022\017google.prot"
"obuf\"&\n\003Any\022\020\n\010type_url\030\001 \001(\t\022\r\n\005value\030\002"
" \001(\014B<\n\023com.google.protobufB\010AnyProtoP\001\240"
"\001\001\242\002\003GPB\252\002\017Google.Protobufb\006proto3", 154);
" \001(\014BK\n\023com.google.protobufB\010AnyProtoP\001\240"
"\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownType"
"sb\006proto3", 169);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/any.proto", &protobuf_RegisterTypes);
Any::default_instance_ = new Any();
......
......@@ -123,8 +123,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fapi_2eproto() {
"quest_type_url\030\002 \001(\t\022\031\n\021request_streamin"
"g\030\003 \001(\010\022\031\n\021response_type_url\030\004 \001(\t\022\032\n\022re"
"sponse_streaming\030\005 \001(\010\022(\n\007options\030\006 \003(\0132"
"\027.google.protobuf.OptionB\'\n\023com.google.p"
"rotobufB\010ApiProtoP\001\242\002\003GPBb\006proto3", 513);
"\027.google.protobuf.OptionBH\n\023com.google.p"
"rotobufB\010ApiProtoP\001\242\002\003GPB\252\002\036Google.Proto"
"buf.WellKnownTypesb\006proto3", 546);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/api.proto", &protobuf_RegisterTypes);
Api::default_instance_ = new Api();
......
......@@ -67,8 +67,15 @@ void UpdateParamsRecursively(Params& params,
file->name(), file->options().java_outer_classname());
}
if (file->options().has_java_package()) {
string result = file->options().java_package();
if (!file->options().javanano_use_deprecated_package()) {
if (!result.empty()) {
result += ".";
}
result += "nano";
}
params.set_java_package(
file->name(), file->options().java_package());
file->name(), result);
}
if (file->options().has_java_multiple_files()) {
params.set_java_multiple_files(
......
......@@ -200,6 +200,14 @@ string FileJavaPackage(const Params& params, const FileDescriptor* file) {
if (!result.empty()) result += '.';
result += file->package();
}
if (!file->options().javanano_use_deprecated_package()) {
if (!result.empty()) {
result += ".";
}
result += "nano";
}
return result;
}
}
......
This diff is collapsed.
......@@ -2000,6 +2000,13 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
::std::string* release_csharp_namespace();
void set_allocated_csharp_namespace(::std::string* csharp_namespace);
// optional bool javanano_use_deprecated_package = 38;
bool has_javanano_use_deprecated_package() const;
void clear_javanano_use_deprecated_package();
static const int kJavananoUseDeprecatedPackageFieldNumber = 38;
bool javanano_use_deprecated_package() const;
void set_javanano_use_deprecated_package(bool value);
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
int uninterpreted_option_size() const;
void clear_uninterpreted_option();
......@@ -2043,6 +2050,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
inline void clear_has_objc_class_prefix();
inline void set_has_csharp_namespace();
inline void clear_has_csharp_namespace();
inline void set_has_javanano_use_deprecated_package();
inline void clear_has_javanano_use_deprecated_package();
::google::protobuf::internal::ExtensionSet _extensions_;
......@@ -2057,13 +2066,14 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
bool cc_generic_services_;
int optimize_for_;
::google::protobuf::internal::ArenaStringPtr go_package_;
::google::protobuf::internal::ArenaStringPtr objc_class_prefix_;
::google::protobuf::internal::ArenaStringPtr csharp_namespace_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
bool java_generic_services_;
bool py_generic_services_;
bool deprecated_;
bool cc_enable_arenas_;
bool javanano_use_deprecated_package_;
::google::protobuf::internal::ArenaStringPtr objc_class_prefix_;
::google::protobuf::internal::ArenaStringPtr csharp_namespace_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto();
......@@ -5892,6 +5902,30 @@ inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_na
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
}
// optional bool javanano_use_deprecated_package = 38;
inline bool FileOptions::has_javanano_use_deprecated_package() const {
return (_has_bits_[0] & 0x00004000u) != 0;
}
inline void FileOptions::set_has_javanano_use_deprecated_package() {
_has_bits_[0] |= 0x00004000u;
}
inline void FileOptions::clear_has_javanano_use_deprecated_package() {
_has_bits_[0] &= ~0x00004000u;
}
inline void FileOptions::clear_javanano_use_deprecated_package() {
javanano_use_deprecated_package_ = false;
clear_has_javanano_use_deprecated_package();
}
inline bool FileOptions::javanano_use_deprecated_package() const {
// @@protoc_insertion_point(field_get:google.protobuf.FileOptions.javanano_use_deprecated_package)
return javanano_use_deprecated_package_;
}
inline void FileOptions::set_javanano_use_deprecated_package(bool value) {
set_has_javanano_use_deprecated_package();
javanano_use_deprecated_package_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.javanano_use_deprecated_package)
}
// repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
inline int FileOptions::uninterpreted_option_size() const {
return uninterpreted_option_.size();
......
......@@ -42,6 +42,7 @@ syntax = "proto2";
package google.protobuf;
option go_package = "descriptor";
option java_package = "com.google.protobuf";
option javanano_use_deprecated_package = true;
option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB";
......@@ -369,6 +370,10 @@ message FileOptions {
// Namespace for generated classes; defaults to the package.
optional string csharp_namespace = 37;
// Whether the nano proto compiler should generate in the deprecated non-nano
// suffixed package.
optional bool javanano_use_deprecated_package = 38;
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
......
......@@ -82,9 +82,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fduration_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\036google/protobuf/duration.proto\022\017google"
".protobuf\"*\n\010Duration\022\017\n\007seconds\030\001 \001(\003\022\r"
"\n\005nanos\030\002 \001(\005BA\n\023com.google.protobufB\rDu"
"rationProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Protobuf"
"b\006proto3", 168);
"\n\005nanos\030\002 \001(\005BP\n\023com.google.protobufB\rDu"
"rationProtoP\001\240\001\001\242\002\003GPB\252\002\036Google.Protobuf"
".WellKnownTypesb\006proto3", 183);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/duration.proto", &protobuf_RegisterTypes);
Duration::default_instance_ = new Duration();
......
......@@ -79,8 +79,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fempty_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\033google/protobuf/empty.proto\022\017google.pr"
"otobuf\"\007\n\005EmptyB)\n\023com.google.protobufB\n"
"EmptyProtoP\001\242\002\003GPBb\006proto3", 106);
"otobuf\"\007\n\005EmptyBJ\n\023com.google.protobufB\n"
"EmptyProtoP\001\242\002\003GPB\252\002\036Google.Protobuf.Wel"
"lKnownTypesb\006proto3", 139);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/empty.proto", &protobuf_RegisterTypes);
Empty::default_instance_ = new Empty();
......
......@@ -81,8 +81,9 @@ void protobuf_AddDesc_google_2fprotobuf_2ffield_5fmask_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n google/protobuf/field_mask.proto\022\017goog"
"le.protobuf\"\032\n\tFieldMask\022\r\n\005paths\030\001 \003(\tB"
"\?\n\023com.google.protobufB\016FieldMaskProtoP\001"
"\242\002\003GPB\252\002\017Google.Protobufb\006proto3", 152);
"N\n\023com.google.protobufB\016FieldMaskProtoP\001"
"\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypesb"
"\006proto3", 167);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/field_mask.proto", &protobuf_RegisterTypes);
FieldMask::default_instance_ = new FieldMask();
......
......@@ -81,8 +81,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fsource_5fcontext_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n$google/protobuf/source_context.proto\022\017"
"google.protobuf\"\"\n\rSourceContext\022\021\n\tfile"
"_name\030\001 \001(\tB1\n\023com.google.protobufB\022Sour"
"ceContextProtoP\001\242\002\003GPBb\006proto3", 150);
"_name\030\001 \001(\tBR\n\023com.google.protobufB\022Sour"
"ceContextProtoP\001\242\002\003GPB\252\002\036Google.Protobuf"
".WellKnownTypesb\006proto3", 183);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/source_context.proto", &protobuf_RegisterTypes);
SourceContext::default_instance_ = new SourceContext();
......
......@@ -165,9 +165,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto() {
"\000\0220\n\nlist_value\030\006 \001(\0132\032.google.protobuf."
"ListValueH\000B\006\n\004kind\"3\n\tListValue\022&\n\006valu"
"es\030\001 \003(\0132\026.google.protobuf.Value*\033\n\tNull"
"Value\022\016\n\nNULL_VALUE\020\000B\?\n\023com.google.prot"
"obufB\013StructProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Pr"
"otobufb\006proto3", 574);
"Value\022\016\n\nNULL_VALUE\020\000BN\n\023com.google.prot"
"obufB\013StructProtoP\001\240\001\001\242\002\003GPB\252\002\036Google.Pr"
"otobuf.WellKnownTypesb\006proto3", 589);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/struct.proto", &protobuf_RegisterTypes);
Struct::default_instance_ = new Struct();
......
......@@ -82,9 +82,9 @@ void protobuf_AddDesc_google_2fprotobuf_2ftimestamp_2eproto() {
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\037google/protobuf/timestamp.proto\022\017googl"
"e.protobuf\"+\n\tTimestamp\022\017\n\007seconds\030\001 \001(\003"
"\022\r\n\005nanos\030\002 \001(\005BB\n\023com.google.protobufB\016"
"TimestampProtoP\001\240\001\001\242\002\003GPB\252\002\017Google.Proto"
"bufb\006proto3", 171);
"\022\r\n\005nanos\030\002 \001(\005BQ\n\023com.google.protobufB\016"
"TimestampProtoP\001\240\001\001\242\002\003GPB\252\002\036Google.Proto"
"buf.WellKnownTypesb\006proto3", 186);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/timestamp.proto", &protobuf_RegisterTypes);
Timestamp::default_instance_ = new Timestamp();
......
......@@ -221,9 +221,9 @@ void protobuf_AddDesc_google_2fprotobuf_2ftype_2eproto() {
"ntext\"S\n\tEnumValue\022\014\n\004name\030\001 \001(\t\022\016\n\006numb"
"er\030\002 \001(\005\022(\n\007options\030\003 \003(\0132\027.google.proto"
"buf.Option\";\n\006Option\022\014\n\004name\030\001 \001(\t\022#\n\005va"
"lue\030\002 \001(\0132\024.google.protobuf.AnyB(\n\023com.g"
"oogle.protobufB\tTypeProtoP\001\242\002\003GPBb\006proto"
"3", 1321);
"lue\030\002 \001(\0132\024.google.protobuf.AnyBI\n\023com.g"
"oogle.protobufB\tTypeProtoP\001\242\002\003GPB\252\002\036Goog"
"le.Protobuf.WellKnownTypesb\006proto3", 1354);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/type.proto", &protobuf_RegisterTypes);
Type::default_instance_ = new Type();
......
......@@ -262,9 +262,9 @@ void protobuf_AddDesc_google_2fprotobuf_2fwrappers_2eproto() {
"e\030\001 \001(\004\"\033\n\nInt32Value\022\r\n\005value\030\001 \001(\005\"\034\n\013"
"UInt32Value\022\r\n\005value\030\001 \001(\r\"\032\n\tBoolValue\022"
"\r\n\005value\030\001 \001(\010\"\034\n\013StringValue\022\r\n\005value\030\001"
" \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014B>\n\023com"
" \001(\t\"\033\n\nBytesValue\022\r\n\005value\030\001 \001(\014BM\n\023com"
".google.protobufB\rWrappersProtoP\001\242\002\003GPB\252"
"\002\017Google.Protobufb\006proto3", 385);
"\002\036Google.Protobuf.WellKnownTypesb\006proto3", 400);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"google/protobuf/wrappers.proto", &protobuf_RegisterTypes);
DoubleValue::default_instance_ = new DoubleValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment