aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml8
-rw-r--r--BUILD18
-rw-r--r--CHANGES.txt6
-rwxr-xr-xcsharp/generate_protos.sh2
-rw-r--r--csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs43
-rwxr-xr-xgenerate_descriptor_proto.sh5
-rwxr-xr-xobjectivec/DevTools/full_mac_build.sh10
-rw-r--r--python/google/protobuf/pyext/message.cc9
-rw-r--r--ruby/src/main/sentinel.proto18
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc2
-rw-r--r--src/google/protobuf/io/gzip_stream.cc4
-rwxr-xr-xtravis.sh18
12 files changed, 114 insertions, 29 deletions
diff --git a/.travis.yml b/.travis.yml
index e368826f..9bc4d88f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,8 +7,8 @@ language: cpp
os:
- linux
- osx
-# The Objective C build needs Xcode 6.4 or later.
-osx_image: xcode7.1
+# The Objective C build needs Xcode 7.0 or later.
+osx_image: xcode7.2
script:
- ./travis.sh $CONFIG
env:
@@ -67,5 +67,9 @@ matrix:
env: CONFIG=ruby22
- os: osx
env: CONFIG=jruby
+ # https://github.com/google/protobuf/issues/1253 - Started failing when
+ # we moved to an OS X image that is 10.11.
+ - os: osx
+ env: CONFIG=python_cpp
notifications:
email: false
diff --git a/BUILD b/BUILD
index 3cac4a86..c4de1c4c 100644
--- a/BUILD
+++ b/BUILD
@@ -462,11 +462,11 @@ genrule(
name = "gen_well_known_protos_java",
srcs = WELL_KNOWN_PROTOS,
outs = [
- "wellknown.srcjar"
+ "wellknown.srcjar",
],
cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" +
- " -Isrc $(SRCS) " +
- " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar",
+ " -Isrc $(SRCS) " +
+ " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar",
tools = [":protoc"],
)
@@ -539,7 +539,10 @@ cc_binary(
]),
copts = COPTS + [
"-DGOOGLE_PROTOBUF_HAS_ONEOF=1",
- ],
+ ] + select({
+ "//conditions:default": [],
+ ":allow_oversize_protos": ["-DPROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS=1"],
+ }),
includes = [
"python/",
"src/",
@@ -561,6 +564,13 @@ config_setting(
},
)
+config_setting(
+ name = "allow_oversize_protos",
+ values = {
+ "define": "allow_oversize_protos=true",
+ },
+)
+
py_proto_library(
name = "protobuf_python",
srcs = WELL_KNOWN_PROTOS,
diff --git a/CHANGES.txt b/CHANGES.txt
index 3023c812..c3503fc8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,4 @@
-2015-08-26 version 3.0.0-beta-1 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript)
+2015-12-30 version 3.0.0-beta-2 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript)
General
* Introduced a new language implementation: JavaScript.
* Added a new field option "json_name". By default proto field names are
@@ -35,6 +35,10 @@
and a few well-known types except for Any and Struct.
* Added runtime support for Any, Timestamp, Duration and FieldMask.
* [ ] is now accepted for repeated scalar fields in text format parser.
+ * Map fields now have proper O(1) performance for lookup/insert/delete
+ when using the Python/C++ implementation. They were previously using O(n)
+ search-based algorithms because the C++ reflection interface didn't
+ support true map operations.
Objective-C (Beta)
* Various bug-fixes and code tweaks to pass more strict compiler warnings.
diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 9899097d..d979aa52 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -6,7 +6,7 @@
set -ex
# cd to repository root
-cd $(dirname $0)/..
+pushd $(dirname $0)/..
# Protocol buffer compiler to use. If the PROTOC variable is set,
# use that. Otherwise, probe for expected locations under both
diff --git a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
index a2c833fe..5b7185dc 100644
--- a/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
+++ b/csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
@@ -319,9 +319,10 @@ namespace Google.Protobuf.WellKnownTypes
// Merging is odd with wrapper types, due to the way that default values aren't emitted in
// the binary stream. In fact we cheat a little bit - a message with an explicitly present default
- // value will have that default value ignored.
+ // value will have that default value ignored. See issue 615. Fixing this would require significant upheaval to
+ // the FieldCodec side of things.
[Test]
- public void MergingCornerCase()
+ public void MergingStreamExplicitValue()
{
var message = new TestWellKnownTypes { Int32Field = 5 };
@@ -343,10 +344,48 @@ namespace Google.Protobuf.WellKnownTypes
message.MergeFrom(bytes);
// A normal implementation would have 0 now, as the explicit default would have been overwritten the 5.
+ // With the FieldCodec for Nullable<int>, we can't tell the difference between an implicit 0 and an explicit 0.
Assert.AreEqual(5, message.Int32Field);
}
[Test]
+ public void MergingStreamNoValue()
+ {
+ var message = new TestWellKnownTypes { Int32Field = 5 };
+
+ // Create a byte array which an Int32 field, but with no value.
+ var bytes = new TestWellKnownTypes { Int32Field = 0 }.ToByteArray();
+ Assert.AreEqual(2, bytes.Length); // The tag for Int32Field is a single byte, then a byte indicating a 0-length message.
+ message.MergeFrom(bytes);
+
+ // The "implicit" 0 did *not* overwrite the value.
+ // (This is the correct behaviour.)
+ Assert.AreEqual(5, message.Int32Field);
+ }
+
+ // All permutations of origin/merging value being null, zero (default) or non-default.
+ // As this is the in-memory version, we don't need to worry about the difference between implicit and explicit 0.
+ [Test]
+ [TestCase(null, null, null)]
+ [TestCase(null, 0, 0)]
+ [TestCase(null, 5, 5)]
+ [TestCase(0, null, 0)]
+ [TestCase(0, 0, 0)]
+ [TestCase(0, 5, 5)]
+ [TestCase(5, null, 5)]
+ [TestCase(5, 0, 5)]
+ [TestCase(5, 10, 10)]
+ public void MergingMessageWithZero(int? originValue, int? mergingValue, int? expectedResult)
+ {
+ // This differs from the MergingStreamCornerCase because when we merge message *objects*,
+ // we ignore default values from the "source".
+ var message1 = new TestWellKnownTypes { Int32Field = originValue };
+ var message2 = new TestWellKnownTypes { Int32Field = mergingValue };
+ message1.MergeFrom(message2);
+ Assert.AreEqual(expectedResult, message1.Int32Field);
+ }
+
+ [Test]
public void UnknownFieldInWrapper()
{
var stream = new MemoryStream();
diff --git a/generate_descriptor_proto.sh b/generate_descriptor_proto.sh
index 44006b2c..81b8a0d6 100755
--- a/generate_descriptor_proto.sh
+++ b/generate_descriptor_proto.sh
@@ -96,3 +96,8 @@ if test -x objectivec/generate_descriptors_proto.sh; then
echo "Generating messages for objc."
objectivec/generate_descriptors_proto.sh $@
fi
+
+if test -x csharp/generate_protos.sh; then
+ echo "Generating messages for C#."
+ csharp/generate_protos.sh $@
+fi
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index 709aae0a..c8681e26 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -234,7 +234,7 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
echo "ERROR: Xcode 6.3/6.4 no longer supported for building, please use 7.0 or higher." 1>&2
exit 10
;;
- 7.* )
+ 7.1* )
XCODEBUILD_TEST_BASE_IOS+=(
-destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
-destination "platform=iOS Simulator,name=iPhone 6,OS=9.0" # 64bit
@@ -242,6 +242,14 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then
-destination "platform=iOS Simulator,name=iPad Air,OS=9.0" # 64bit
)
;;
+ 7.* )
+ XCODEBUILD_TEST_BASE_IOS+=(
+ -destination "platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
+ -destination "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit
+ -destination "platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
+ -destination "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit
+ )
+ ;;
* )
echo "Time to update the simulator targets for Xcode ${XCODE_VERSION}"
exit 2
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 863cde01..60ec9c1b 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -1921,6 +1921,15 @@ static PyObject* MergeFromString(CMessage* self, PyObject* arg) {
AssureWritable(self);
io::CodedInputStream input(
reinterpret_cast<const uint8*>(data), data_length);
+#if PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS
+ // Protobuf has a 64MB limit built in, this code will override this. Please do
+ // not enable this unless you fully understand the implications: protobufs
+ // must all be kept in memory at the same time, so if they grow too big you
+ // may get OOM errors. The protobuf APIs do not provide any tools for
+ // processing protobufs in chunks. If you have protos this big you should
+ // break them up if it is at all convenient to do so.
+ input.SetTotalBytesLimit(INT_MAX, INT_MAX);
+#endif // PROTOBUF_PYTHON_ALLOW_OVERSIZE_PROTOS
PyDescriptorPool* pool = GetDescriptorPoolForMessage(self);
input.SetExtensionRegistry(pool->pool, pool->message_factory);
bool success = self->message->MergePartialFromCodedStream(&input);
diff --git a/ruby/src/main/sentinel.proto b/ruby/src/main/sentinel.proto
index 89a1ae19..722041ba 100644
--- a/ruby/src/main/sentinel.proto
+++ b/ruby/src/main/sentinel.proto
@@ -3,13 +3,13 @@ package com.google.protobuf.jruby;
option optimize_for = CODE_SIZE;
message Sentinel {
- optional int32 default_int32 = 1;
- optional int64 default_int64 = 2;
- optional uint32 default_unit32 = 3;
- optional uint64 default_uint64 = 4;
- optional string default_string = 5;
- optional bool default_bool = 6;
- optional float default_float = 7;
- optional double default_double = 8;
- optional bytes default_bytes = 9;
+ int32 default_int32 = 1;
+ int64 default_int64 = 2;
+ uint32 default_unit32 = 3;
+ uint64 default_uint64 = 4;
+ string default_string = 5;
+ bool default_bool = 6;
+ float default_float = 7;
+ double default_double = 8;
+ bytes default_bytes = 9;
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
index c3e9fe74..47729e1c 100644
--- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
@@ -107,7 +107,7 @@ class MockGeneratorContext : public GeneratorContext {
virtual io::ZeroCopyOutputStream* Open(const string& filename) {
string** map_slot = &files_[filename];
- if (*map_slot != NULL) delete *map_slot;
+ delete *map_slot;
*map_slot = new string;
return new io::StringOutputStream(*map_slot);
diff --git a/src/google/protobuf/io/gzip_stream.cc b/src/google/protobuf/io/gzip_stream.cc
index 1be6c863..9c621b6a 100644
--- a/src/google/protobuf/io/gzip_stream.cc
+++ b/src/google/protobuf/io/gzip_stream.cc
@@ -241,9 +241,7 @@ void GzipOutputStream::Init(ZeroCopyOutputStream* sub_stream,
GzipOutputStream::~GzipOutputStream() {
Close();
- if (input_buffer_ != NULL) {
- operator delete(input_buffer_);
- }
+ operator delete(input_buffer_);
}
// private
diff --git a/travis.sh b/travis.sh
index 5a77a2a8..ff5e99d5 100755
--- a/travis.sh
+++ b/travis.sh
@@ -171,7 +171,13 @@ internal_objectivec_common () {
# http://docs.travis-ci.com/user/osx-ci-environment/
# We don't use a before_install because we test multiple OSes.
brew update
- brew outdated xctool || brew upgrade xctool
+ # xctool 0.2.8 seems to have a bug where it randomly kills tests saying
+ # they failed. Disabling the updates, but letting it report about being
+ # updates as a hint that this needs to eventually get re-enabled.
+ # https://github.com/facebook/xctool/issues/619
+ # https://github.com/google/protobuf/issues/1232
+ brew outdated xctool || true
+ #brew outdated xctool || brew upgrade xctool
# Reused the build script that takes care of configuring and ensuring things
# are up to date. Xcode and conformance tests will be directly invoked.
objectivec/DevTools/full_mac_build.sh \
@@ -179,8 +185,10 @@ internal_objectivec_common () {
}
internal_xctool_debug_and_release() {
- xctool -configuration Debug "$@"
- xctool -configuration Release "$@"
+ # Always use -reporter plain to avoid escape codes in output (makes travis
+ # logs easier to read).
+ xctool -reporter plain -configuration Debug "$@"
+ xctool -reporter plain -configuration Release "$@"
}
build_objectivec_ios() {
@@ -195,9 +203,9 @@ build_objectivec_ios() {
build-tests
IOS_DESTINATIONS=(
"platform=iOS Simulator,name=iPhone 4s,OS=8.1" # 32bit
- "platform=iOS Simulator,name=iPhone 6,OS=9.1" # 64bit
+ "platform=iOS Simulator,name=iPhone 6,OS=9.2" # 64bit
"platform=iOS Simulator,name=iPad 2,OS=8.1" # 32bit
- "platform=iOS Simulator,name=iPad Air,OS=9.1" # 64bit
+ "platform=iOS Simulator,name=iPad Air,OS=9.2" # 64bit
)
for i in "${IOS_DESTINATIONS[@]}" ; do
internal_xctool_debug_and_release \