diff options
-rw-r--r-- | Protobuf.podspec | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | csharp/README.md | 19 | ||||
-rw-r--r-- | java/pom.xml | 4 | ||||
-rw-r--r-- | java/util/pom.xml | 6 | ||||
-rw-r--r-- | javanano/pom.xml | 4 | ||||
-rwxr-xr-x | post_process_dist.sh | 6 | ||||
-rw-r--r-- | protoc-artifacts/pom.xml | 2 | ||||
-rwxr-xr-x | python/google/protobuf/__init__.py | 2 | ||||
-rwxr-xr-x | python/google/protobuf/descriptor.py | 5 | ||||
-rwxr-xr-x | python/google/protobuf/text_format.py | 27 | ||||
-rw-r--r-- | python/tox.ini | 6 | ||||
-rw-r--r-- | ruby/Gemfile.lock | 2 | ||||
-rw-r--r-- | ruby/google-protobuf.gemspec | 2 | ||||
-rw-r--r-- | ruby/pom.xml | 2 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_message.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_unittest.cc | 6 | ||||
-rw-r--r-- | src/google/protobuf/repeated_field.h | 2 | ||||
-rw-r--r-- | src/google/protobuf/stubs/port.h | 7 | ||||
-rw-r--r-- | src/google/protobuf/util/internal/protostream_objectwriter.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/util/json_util_test.cc | 11 |
21 files changed, 78 insertions, 49 deletions
diff --git a/Protobuf.podspec b/Protobuf.podspec index 0cd52025..22dc7062 100644 --- a/Protobuf.podspec +++ b/Protobuf.podspec @@ -5,7 +5,7 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.0.0-alpha-4-pre' + s.version = '3.0.0-alpha-4' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/google/protobuf' s.license = 'New BSD' diff --git a/configure.ac b/configure.ac index ef5342ce..0e587893 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.0.0-alpha-4-pre],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.0.0-beta-1],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/README.md b/csharp/README.md index a798ee62..305c44b6 100644 --- a/csharp/README.md +++ b/csharp/README.md @@ -1,7 +1,7 @@ This directory contains the C# Protocol Buffers runtime library. -Warning: experimental! -====================== +Status: Alpha - ready for early adopters +======================================== This code is still under significant churn. Unlike the original port, it only supports proto3 (but not *all* of proto3 yet) - there are no @@ -12,15 +12,20 @@ reflection. (It's currently exposed publicly, but won't be eventually.) Also unlike the original port, the new version embraces mutability - -there are no builder types. We plan to add "freezing" operations as -well as cloning, however. +there are no builder types. Usage ===== -Use `protoc` with the `--csharp_out` option to generate C# files in the specified directory. -Include these in your C# project, and add a reference to the `Google.Protobuf` project. Currently -there is no NuGet package for this, but we will be building one as soon as the API is stable. +The easiest way how to use C# protobufs is via the `Google.Protobuf` +NuGet package. Just add the NuGet package to your VS project. + +Besides C# runtime library, the NuGet package also contains +precompiled version of `protoc.exe` and a copy of well known `.proto` +files under the package's `tools` directory. + +To generate C# files from your `.proto` files, invoke `protoc` with the +`--csharp_out` option. Supported platforms =================== diff --git a/java/pom.xml b/java/pom.xml index 49099b4a..8b81b645 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> - <version>3.0.0-alpha-4-pre</version> + <version>3.0.0-beta-1</version> <packaging>bundle</packaging> <name>Protocol Buffer Java API</name> <description> @@ -166,7 +166,7 @@ <instructions> <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL> <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName> - <Export-Package>com.google.protobuf;version=3.0.0-alpha-3</Export-Package> + <Export-Package>com.google.protobuf;version=3.0.0-beta-1</Export-Package> </instructions> </configuration> </plugin> diff --git a/java/util/pom.xml b/java/util/pom.xml index 9416f380..44a5662d 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java-util</artifactId> - <version>3.0.0-alpha-4-pre</version> + <version>3.0.0-beta-1</version> <packaging>bundle</packaging> <name>Protocol Buffer Java API</name> <description> @@ -36,7 +36,7 @@ <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> - <version>3.0.0-alpha-4-pre</version> + <version>3.0.0-beta-1</version> <scope>compile</scope> </dependency> <dependency> @@ -123,7 +123,7 @@ <instructions> <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL> <Bundle-SymbolicName>com.google.protobuf.util</Bundle-SymbolicName> - <Export-Package>com.google.protobuf.util;version=3.0.0-alpha-3</Export-Package> + <Export-Package>com.google.protobuf.util;version=3.0.0-beta-1</Export-Package> </instructions> </configuration> </plugin> diff --git a/javanano/pom.xml b/javanano/pom.xml index f0bcc333..1a95a43e 100644 --- a/javanano/pom.xml +++ b/javanano/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf.nano</groupId> <artifactId>protobuf-javanano</artifactId> - <version>3.0.0-alpha-4-pre</version> + <version>3.0.0-alpha-4</version> <packaging>bundle</packaging> <name>Protocol Buffer JavaNano API</name> <description> @@ -165,7 +165,7 @@ <instructions> <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL> <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName> - <Export-Package>com.google.protobuf;version=3.0.0-alpha-3</Export-Package> + <Export-Package>com.google.protobuf;version=3.0.0-alpha-4</Export-Package> </instructions> </configuration> </plugin> diff --git a/post_process_dist.sh b/post_process_dist.sh index 05113af1..6d5b85d3 100755 --- a/post_process_dist.sh +++ b/post_process_dist.sh @@ -40,11 +40,7 @@ rm $BASENAME.tar.gz # Set the entire contents to be user-writable. chmod -R u+w $BASENAME - -# Convert the MSVC projects to MSVC 2005 format. -cd $BASENAME/vsprojects -./convert2008to2005.sh -cd .. +cd $BASENAME for LANG in $LANGUAGES; do # Build the dist again in .tar.gz diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 52a7d2d6..cdf17707 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -10,7 +10,7 @@ </parent> <groupId>com.google.protobuf</groupId> <artifactId>protoc</artifactId> - <version>3.0.0-alpha-4-pre</version> + <version>3.0.0-beta-1</version> <packaging>pom</packaging> <name>Protobuf Compiler</name> <description> diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 50343c89..ed88480f 100755 --- a/python/google/protobuf/__init__.py +++ b/python/google/protobuf/__init__.py @@ -30,4 +30,4 @@ # Copyright 2007 Google Inc. All Rights Reserved. -__version__ = '3.0.0a4.dev0' +__version__ = '3.0.0a4' diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py index 6840d1f4..95b703fc 100755 --- a/python/google/protobuf/descriptor.py +++ b/python/google/protobuf/descriptor.py @@ -36,6 +36,8 @@ file, in types that make this information accessible in Python. __author__ = 'robinson@google.com (Will Robinson)' +import six + from google.protobuf.internal import api_implementation @@ -73,7 +75,7 @@ else: DescriptorMetaclass = type -class DescriptorBase(object): +class DescriptorBase(six.with_metaclass(DescriptorMetaclass)): """Descriptors base class. @@ -88,7 +90,6 @@ class DescriptorBase(object): avoid some bootstrapping issues. """ - __metaclass__ = DescriptorMetaclass if _USE_C_DESCRIPTORS: # The class, or tuple of classes, that are considered as "virtual # subclasses" of this descriptor class. diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py index dd205cf1..1399223f 100755 --- a/python/google/protobuf/text_format.py +++ b/python/google/protobuf/text_format.py @@ -67,6 +67,25 @@ class Error(Exception): class ParseError(Error): """Thrown in case of ASCII parsing error.""" +class TextWriter(object): + def __init__(self, as_utf8): + if six.PY2: + self._writer = io.BytesIO() + else: + self._writer = io.StringIO() + + def write(self, val): + if six.PY2: + if isinstance(val, six.text_type): + val = val.encode('utf-8') + return self._writer.write(val) + + def close(self): + return self._writer.close() + + def getvalue(self): + return self._writer.getvalue() + def MessageToString(message, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, @@ -92,7 +111,7 @@ def MessageToString(message, as_utf8=False, as_one_line=False, Returns: A string of the text formatted protocol buffer message. """ - out = io.BytesIO() + out = TextWriter(as_utf8) PrintMessage(message, out, as_utf8=as_utf8, as_one_line=as_one_line, pointy_brackets=pointy_brackets, use_index_order=use_index_order, @@ -159,11 +178,7 @@ def PrintField(field, value, out, indent=0, as_utf8=False, as_one_line=False, # For groups, use the capitalized name. out.write(field.message_type.name) else: - if isinstance(field.name, six.text_type): - name = field.name.encode('utf-8') - else: - name = field.name - out.write(name) + out.write(field.name) if field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE: # The colon is optional in this case, but our cross-language golden files diff --git a/python/tox.ini b/python/tox.ini index 9a934d0a..d0100758 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -1,9 +1,9 @@ [tox] envlist = - # Py3 tests currently fail because of text handling issues, - # So only test py26/py27 for now. + # cpp implementation on py34 is currently broken due to + # changes introduced by http://bugs.python.org/issue22079. #py{26,27,33,34}-{cpp,python} - py{26,27}-{cpp,python} + py{26,27,33}-{cpp,python}, py34-{python} [testenv] usedevelop=true diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 2cf5e472..91e1666f 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - google-protobuf (3.0.0.alpha.3) + google-protobuf (3.0.0.alpha.4) GEM remote: https://rubygems.org/ diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index a9e570ec..3d53209d 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "google-protobuf" - s.version = "3.0.0.alpha.4.0.pre" + s.version = "3.0.0.alpha.4.0" s.licenses = ["BSD"] s.summary = "Protocol Buffers" s.description = "Protocol Buffers are Google's data interchange format." diff --git a/ruby/pom.xml b/ruby/pom.xml index 247b243a..059ba01f 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -86,7 +86,7 @@ <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> - <version>3.0.0-alpha-2</version> + <version>3.0.0-beta-1</version> </dependency> </dependencies> </project> diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc index aa10b0bb..fc1ce962 100644 --- a/src/google/protobuf/compiler/cpp/cpp_message.cc +++ b/src/google/protobuf/compiler/cpp/cpp_message.cc @@ -2536,13 +2536,7 @@ GenerateOneofClear(io::Printer* printer) { printer->Print(oneof_vars, "void $classname$::clear_$oneofname$() {\n"); printer->Indent(); - // In .proto.h mode, fields with a dependent type will generate - // clearing code that down casts from the dependent base class. - // However, clear_oneof() methods are always in the .cc file, and thus - // must remain in the derived base. So, to make the clearing code work, - // we add a typedef so that the down cast works (it will be a no-op). printer->Print(oneof_vars, - "typedef $classname$ T;\n" "switch($oneofname$_case()) {\n"); printer->Indent(); for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc index 7840cfaf..b7b6039a 100644 --- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc @@ -55,7 +55,9 @@ #include <google/protobuf/unittest.pb.h> #include <google/protobuf/unittest_optimize_for.pb.h> #include <google/protobuf/unittest_embed_optimize_for.pb.h> -#if !defined(_MSC_VER) // Too large for visual studio to compile +#if !defined(GOOGLE_PROTOBUF_CMAKE_BUILD) && !defined(_MSC_VER) +// We exclude this large proto from cmake build because it's too large for +// visual studio to compile (report internal errors). #include <google/protobuf/unittest_enormous_descriptor.pb.h> #endif #include <google/protobuf/unittest_no_generic_services.pb.h> @@ -135,7 +137,7 @@ TEST(GeneratedDescriptorTest, IdenticalDescriptors) { generated_decsriptor_proto.DebugString()); } -#if !defined(_MSC_VER) +#if !defined(GOOGLE_PROTOBUF_CMAKE_BUILD) && !defined(_MSC_VER) // Test that generated code has proper descriptors: // Touch a descriptor generated from an enormous message to validate special // handling for descriptors exceeding the C++ standard's recommended minimum diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index b42d4790..137b29be 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -1223,7 +1223,7 @@ void RepeatedField<Element>::Reserve(int new_size) { Arena* arena = GetArenaNoVirtual(); new_size = max(google::protobuf::internal::kMinRepeatedFieldAllocationSize, max(total_size_ * 2, new_size)); - GOOGLE_CHECK_LE(new_size, + GOOGLE_CHECK_LE(static_cast<size_t>(new_size), (std::numeric_limits<size_t>::max() - kRepHeaderSize) / sizeof(Element)) << "Requested size is too large to fit into size_t."; diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h index 5158a6f9..9ea34cde 100644 --- a/src/google/protobuf/stubs/port.h +++ b/src/google/protobuf/stubs/port.h @@ -45,12 +45,15 @@ #endif #undef PROTOBUF_LITTLE_ENDIAN -#ifdef _MSC_VER +#ifdef _WIN32 // Assuming windows is always little-endian. + // TODO(xiaofeng): The PROTOBUF_LITTLE_ENDIAN is not only used for + // optimization but also for correctness. We should define an + // different macro to test the big-endian code path in coded_stream. #if !defined(PROTOBUF_DISABLE_LITTLE_ENDIAN_OPT_FOR_TEST) #define PROTOBUF_LITTLE_ENDIAN 1 #endif - #if _MSC_VER >= 1300 + #if defined(_MSC_VER) && _MSC_VER >= 1300 // If MSVC has "/RTCc" set, it will complain about truncating casts at // runtime. This file contains some intentional truncating casts. #pragma runtime_checks("c", off) diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.cc b/src/google/protobuf/util/internal/protostream_objectwriter.cc index 28779301..a935ac39 100644 --- a/src/google/protobuf/util/internal/protostream_objectwriter.cc +++ b/src/google/protobuf/util/internal/protostream_objectwriter.cc @@ -1602,8 +1602,10 @@ bool ProtoStreamObjectWriter::IsMap(const google::protobuf::Field& field) { const google::protobuf::Type* field_type = typeinfo_->GetTypeByTypeUrl(field.type_url()); + // TODO(xiaofeng): Unify option names. return GetBoolOptionOrDefault(field_type->options(), - "google.protobuf.MessageOptions.map_entry", false); + "google.protobuf.MessageOptions.map_entry", false) || + GetBoolOptionOrDefault(field_type->options(), "map_entry", false); } void ProtoStreamObjectWriter::WriteTag(const google::protobuf::Field& field) { diff --git a/src/google/protobuf/util/json_util_test.cc b/src/google/protobuf/util/json_util_test.cc index 7f88e672..f4dc3562 100644 --- a/src/google/protobuf/util/json_util_test.cc +++ b/src/google/protobuf/util/json_util_test.cc @@ -47,6 +47,7 @@ namespace { using proto3::FOO; using proto3::BAR; using proto3::TestMessage; +using proto3::TestMap; static const char kTypeUrlPrefix[] = "type.googleapis.com"; @@ -147,6 +148,16 @@ TEST_F(JsonUtilTest, ParseMessage) { EXPECT_EQ(96, m.repeated_message_value(1).value()); } +TEST_F(JsonUtilTest, ParseMap) { + TestMap message; + (*message.mutable_string_map())["hello"] = 1234; + JsonOptions options; + EXPECT_EQ("{\"stringMap\":{\"hello\":1234}}", ToJson(message, options)); + TestMap other; + ASSERT_TRUE(FromJson(ToJson(message, options), &other)); + EXPECT_EQ(message.DebugString(), other.DebugString()); +} + typedef pair<char*, int> Segment; // A ZeroCopyOutputStream that writes to multiple buffers. class SegmentedZeroCopyOutputStream : public io::ZeroCopyOutputStream { |