aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--CHANGES.txt51
-rw-r--r--Makefile.am3
-rw-r--r--Protobuf.podspec2
-rw-r--r--cmake/extract_includes.bat.in1
-rw-r--r--configure.ac2
-rw-r--r--conformance/conformance_test.cc16
-rw-r--r--conformance/failure_list_csharp.txt4
-rw-r--r--csharp/Google.Protobuf.Tools.nuspec2
-rw-r--r--csharp/src/Google.Protobuf/project.json2
-rwxr-xr-xjava/compatibility_tests/v2.5.0/test.sh10
-rw-r--r--java/core/pom.xml2
-rw-r--r--java/lite/pom.xml2
-rw-r--r--java/pom.xml2
-rw-r--r--java/util/pom.xml2
-rw-r--r--js/README.md3
-rw-r--r--js/map.js2
-rw-r--r--js/package.json2
-rwxr-xr-xprotoc-artifacts/build-protoc.sh27
-rwxr-xr-xprotoc-artifacts/build-zip.sh52
-rw-r--r--protoc-artifacts/pom.xml3
-rwxr-xr-xpython/google/protobuf/__init__.py2
-rw-r--r--python/google/protobuf/json_format.py2
-rw-r--r--python/setup.cfg2
-rw-r--r--ruby/google-protobuf.gemspec2
-rw-r--r--ruby/lib/google/protobuf/well_known_types.rb212
-rw-r--r--ruby/pom.xml2
-rw-r--r--ruby/tests/basic.rb4
-rw-r--r--ruby/tests/well_known_types_test.rb122
-rw-r--r--src/Makefile.am4
-rw-r--r--src/google/protobuf/stubs/int128.cc6
-rw-r--r--src/google/protobuf/stubs/map_util.h7
-rw-r--r--src/google/protobuf/stubs/port.h20
-rw-r--r--src/google/protobuf/util/time_util.cc9
-rwxr-xr-xtests.sh9
35 files changed, 521 insertions, 76 deletions
diff --git a/.travis.yml b/.travis.yml
index 1417cb98..094235e0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -57,6 +57,10 @@ matrix:
# tests on jenkins running in parallel.
- os: linux
env: CONFIG=cpp_distcheck
+ # The Java compatibility test currently only runs on Linux because it will
+ # fetch pre-built Linux protoc binaries in the test.
+ - os: linux
+ env: CONFIG=java_compatibility
allow_failures:
# These currently do not work on OS X but are being worked on by @haberman.
- os: osx
diff --git a/CHANGES.txt b/CHANGES.txt
index 04fa418e..822136c0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,54 @@
+2016-07-27 version 3.0.0 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite)
+ General
+ * This log only contains changes since the beta-4 release. Summarized change
+ log since the last stable release (v2.6.1) can be found in the github
+ release page.
+
+ Compatibility Notice
+ * v3.0.0 is the first API stable release of the v3.x series. We do not expect
+ any future API breaking changes.
+ * For C++, Java Lite and Objective-C, source level compatibility is
+ guaranteed. Upgrading from v3.0.0 to newer minor version releases will be
+ source compatible. For example, if your code compiles against protobuf
+ v3.0.0, it will continue to compile after you upgrade protobuf library to
+ v3.1.0.
+ * For other languages, both source level compatibility and binary level
+ compatibility are guaranteed. For example, if you have a Java binary built
+ against protobuf v3.0.0. After switching the protobuf runtime binary to
+ v3.1.0, your built binary should continue to work.
+ * Compatibility is only guaranteed for documented API and documented
+ behaviors. If you are using undocumented API (e.g., use anything in the C++
+ internal namespace), it can be broken by minor version releases in an
+ undetermined manner.
+
+ Ruby
+ * When you assign a string field `a.string_field = "X"`, we now call
+ #encode(UTF-8) on the string and freeze the copy. This saves you from
+ needing to ensure the string is already encoded as UTF-8. It also prevents
+ you from mutating the string after it has been assigned (this is how we
+ ensure it stays valid UTF-8).
+ * The generated file for `foo.proto` is now `foo_pb.rb` instead of just
+ `foo.rb`. This makes it easier to see which imports/requires are from
+ protobuf generated code, and also prevents conflicts with any `foo.rb` file
+ you might have written directly in Ruby. It is a backward-incompatible
+ change: you will need to update all of your `require` statements.
+ * For package names like `foo_bar`, we now translate this to the Ruby module
+ `FooBar`. This is more idiomatic Ruby than what we used to do (`Foo_bar`).
+
+ JavaScript
+ * Scalar fields like numbers and boolean now return defaults instead of
+ `undefined` or `null` when they are unset. You can test for presence
+ explicitly by calling `hasFoo()`, which we now generate for scalar fields.
+
+ Java Lite
+ * Java Lite is now implemented as a separate plugin, maintained in the
+ `javalite` branch. Both lite runtime and protoc artifacts will be available
+ in Maven.
+
+ C#
+ * Target platforms now .NET 4.5, selected portable subsets and .NET Core.
+ * legacy_enum_values option is no longer supported.
+
2016-07-15 version 3.0.0-beta-4 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript)
General
* Added a deterministic serialization API for C++. The deterministic
diff --git a/Makefile.am b/Makefile.am
index ccbfd065..41d25823 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -656,6 +656,7 @@ python_EXTRA_DIST= \
python/google/protobuf/text_encoding.py \
python/google/protobuf/text_format.py \
python/mox.py \
+ python/setup.cfg \
python/setup.py \
python/stubout.py \
python/tox.ini \
@@ -681,6 +682,7 @@ ruby_EXTRA_DIST= \
ruby/google-protobuf.gemspec \
ruby/lib/google/protobuf/message_exts.rb \
ruby/lib/google/protobuf/repeated_field.rb \
+ ruby/lib/google/protobuf/well_known_types.rb \
ruby/lib/google/protobuf.rb \
ruby/pom.xml \
ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \
@@ -707,6 +709,7 @@ ruby_EXTRA_DIST= \
ruby/tests/generated_code.proto \
ruby/tests/test_import.proto \
ruby/tests/generated_code_test.rb \
+ ruby/tests/well_known_types_test.rb \
ruby/travis-test.sh
js_EXTRA_DIST= \
diff --git a/Protobuf.podspec b/Protobuf.podspec
index ac27f03e..642fc3e2 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-beta-4'
+ s.version = '3.0.0'
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/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index c76973c9..9edafca8 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -69,7 +69,6 @@ copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h include\goo
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h include\google\protobuf\reflection.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h
-copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field_reflection.h include\google\protobuf\repeated_field_reflection.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h include\google\protobuf\service.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h include\google\protobuf\source_context.pb.h
copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h include\google\protobuf\struct.pb.h
diff --git a/configure.ac b/configure.ac
index 7ae4a88b..41887997 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,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-beta-4],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.0.0],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])
diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc
index 59a61e51..598ef732 100644
--- a/conformance/conformance_test.cc
+++ b/conformance/conformance_test.cc
@@ -814,18 +814,26 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
"Uint64FieldMaxValue",
R"({"optionalUint64": "18446744073709551615"})",
"optional_uint64: 18446744073709551615");
+ // While not the largest Int64, this is the largest
+ // Int64 which can be exactly represented within an
+ // IEEE-754 64-bit float, which is the expected level
+ // of interoperability guarantee. Larger values may
+ // work in some implementations, but should not be
+ // relied upon.
RunValidJsonTest(
"Int64FieldMaxValueNotQuoted",
- R"({"optionalInt64": 9223372036854775807})",
- "optional_int64: 9223372036854775807");
+ R"({"optionalInt64": 9223372036854774784})",
+ "optional_int64: 9223372036854774784");
RunValidJsonTest(
"Int64FieldMinValueNotQuoted",
R"({"optionalInt64": -9223372036854775808})",
"optional_int64: -9223372036854775808");
+ // Largest interoperable Uint64; see comment above
+ // for Int64FieldMaxValueNotQuoted.
RunValidJsonTest(
"Uint64FieldMaxValueNotQuoted",
- R"({"optionalUint64": 18446744073709551615})",
- "optional_uint64: 18446744073709551615");
+ R"({"optionalUint64": 18446744073709549568})",
+ "optional_uint64: 18446744073709549568");
// Values can be represented as JSON strings.
RunValidJsonTest(
"Int32FieldStringValue",
diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt
index e7de4b96..1716bcbd 100644
--- a/conformance/failure_list_csharp.txt
+++ b/conformance/failure_list_csharp.txt
@@ -4,8 +4,4 @@ JsonInput.FieldNameInSnakeCase.ProtobufOutput
JsonInput.FieldNameWithMixedCases.JsonOutput
JsonInput.FieldNameWithMixedCases.ProtobufOutput
JsonInput.FieldNameWithMixedCases.Validator
-JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput
-JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput
JsonInput.OriginalProtoFieldName.JsonOutput
-JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput
-JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 659b2e77..24b4a776 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
- <version>3.0.0-beta4</version>
+ <version>3.0.0</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
diff --git a/csharp/src/Google.Protobuf/project.json b/csharp/src/Google.Protobuf/project.json
index c8eae6d0..9b831f12 100644
--- a/csharp/src/Google.Protobuf/project.json
+++ b/csharp/src/Google.Protobuf/project.json
@@ -1,5 +1,5 @@
{
- "version": "3.0.0-beta4",
+ "version": "3.0.0",
"title": "Google Protocol Buffers",
"description": "See project site for more info.",
"authors": [ "Google Inc." ],
diff --git a/java/compatibility_tests/v2.5.0/test.sh b/java/compatibility_tests/v2.5.0/test.sh
index 08df12ef..5d5e9ed4 100755
--- a/java/compatibility_tests/v2.5.0/test.sh
+++ b/java/compatibility_tests/v2.5.0/test.sh
@@ -21,23 +21,23 @@ case "$1" in
;;
2.6.1)
OLD_VERSION=2.6.1
- OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/2.6.1-build2/protoc-2.6.1-build2-linux-x86_32.exe
+ OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/2.6.1-build2/protoc-2.6.1-build2-linux-x86_64.exe
;;
3.0.0-beta-1)
OLD_VERSION=3.0.0-beta-1
- OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-1/protoc-3.0.0-beta-1-linux-x86_32.exe
+ OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-1/protoc-3.0.0-beta-1-linux-x86_64.exe
;;
3.0.0-beta-2)
OLD_VERSION=3.0.0-beta-2
- OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_32.exe
+ OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-2/protoc-3.0.0-beta-2-linux-x86_64.exe
;;
3.0.0-beta-3)
OLD_VERSION=3.0.0-beta-3
- OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-x86_32.exe
+ OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-x86_64.exe
;;
3.0.0-beta-4)
OLD_VERSION=3.0.0-beta-4
- OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-4/protoc-3.0.0-beta-4-linux-x86_32.exe
+ OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-4/protoc-3.0.0-beta-4-linux-x86_64.exe
;;
*)
echo "[ERROR]: Unknown version number: $1"
diff --git a/java/core/pom.xml b/java/core/pom.xml
index 422bde82..39d67818 100644
--- a/java/core/pom.xml
+++ b/java/core/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.0.0-beta-4</version>
+ <version>3.0.0</version>
</parent>
<artifactId>protobuf-java</artifactId>
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index 87a5c44d..9862cd94 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.0.0-beta-4</version>
+ <version>3.0.0</version>
</parent>
<artifactId>protobuf-lite</artifactId>
diff --git a/java/pom.xml b/java/pom.xml
index 2d8e9a13..3a91a0ba 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -11,7 +11,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.0.0-beta-4</version>
+ <version>3.0.0</version>
<packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name>
diff --git a/java/util/pom.xml b/java/util/pom.xml
index d8f64eb1..0d5e8e37 100644
--- a/java/util/pom.xml
+++ b/java/util/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
- <version>3.0.0-beta-4</version>
+ <version>3.0.0</version>
</parent>
<artifactId>protobuf-java-util</artifactId>
diff --git a/js/README.md b/js/README.md
index 15d48c87..f4184621 100644
--- a/js/README.md
+++ b/js/README.md
@@ -152,8 +152,7 @@ idea of how the library generally works:
// Serializes to a UInt8Array.
bytes = message.serializeBinary();
- var message2 = new MyMessage();
- message2.deserializeBinary(bytes);
+ var message2 = MyMessage.deserializeBinary(bytes);
For more examples, see the tests. You can also look at the generated code
to see what methods are defined for your generated messages.
diff --git a/js/map.js b/js/map.js
index f051e00d..e6406a60 100644
--- a/js/map.js
+++ b/js/map.js
@@ -365,7 +365,7 @@ jspb.Map.prototype.serializeBinary = function(
valueWriterFn.call(writer, 2, this.wrapEntry_(entry),
opt_valueWriterCallback);
} else {
- valueWriterFn_.call(writer, 2, entry.value);
+ valueWriterFn.call(writer, 2, entry.value);
}
writer.endSubMessage();
}
diff --git a/js/package.json b/js/package.json
index 76ce0c1d..3f51d96b 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
{
"name": "google-protobuf",
- "version": "3.0.0-alpha.7",
+ "version": "3.0.0",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh
index 88e6ae50..e31948e9 100755
--- a/protoc-artifacts/build-protoc.sh
+++ b/protoc-artifacts/build-protoc.sh
@@ -1,17 +1,30 @@
#!/bin/bash
-# Builds protoc executable into target/protoc.exe
+# Builds protoc executable into target/protoc.exe; optionally build protoc
+# plugins into target/protoc-gen-*.exe
# To be run from Maven.
-# Usage: build-protoc.sh <OS> <ARCH>
+# Usage: build-protoc.sh <OS> <ARCH> <TARGET>
# <OS> and <ARCH> are ${os.detected.name} and ${os.detected.arch} from os-maven-plugin
+# <TARGET> can be "protoc" or "protoc-gen-javalite"
OS=$1
ARCH=$2
+MAKE_TARGET=$3
-if [[ $# < 2 ]]; then
+if [[ $# < 3 ]]; then
echo "No arguments provided. This script is intended to be run from Maven."
exit 1
fi
+case $MAKE_TARGET in
+ protoc-gen-javalite)
+ ;;
+ protoc)
+ ;;
+ *)
+ echo "Target ""$TARGET"" invalid."
+ exit 1
+esac
+
# Under Cygwin, bash doesn't have these in PATH when called from Maven which
# runs in Windows version of Java.
export PATH="/bin:/usr/bin:$PATH"
@@ -126,7 +139,7 @@ checkDependencies ()
}
############################################################################
-echo "Building protoc, OS=$OS ARCH=$ARCH"
+echo "Building protoc, OS=$OS ARCH=$ARCH TARGET=$TARGET"
# Nested double quotes are unintuitive, but it works.
cd "$(dirname "$0")"
@@ -134,7 +147,7 @@ cd "$(dirname "$0")"
WORKING_DIR=$(pwd)
CONFIGURE_ARGS="--disable-shared"
-MAKE_TARGET="protoc"
+TARGET_FILE=target/$MAKE_TARGET.exe
if [[ "$OS" == windows ]]; then
MAKE_TARGET="${MAKE_TARGET}.exe"
fi
@@ -209,12 +222,10 @@ fi
export CXXFLAGS LDFLAGS
-TARGET_FILE=target/protoc.exe
-
cd "$WORKING_DIR"/.. && ./configure $CONFIGURE_ARGS &&
cd src && make clean && make $MAKE_TARGET &&
cd "$WORKING_DIR" && mkdir -p target &&
- (cp ../src/protoc $TARGET_FILE || cp ../src/protoc.exe $TARGET_FILE) ||
+ cp ../src/$MAKE_TARGET $TARGET_FILE ||
exit 1
if [[ "$OS" == osx ]]; then
diff --git a/protoc-artifacts/build-zip.sh b/protoc-artifacts/build-zip.sh
index 054e2ea1..3c5e887b 100755
--- a/protoc-artifacts/build-zip.sh
+++ b/protoc-artifacts/build-zip.sh
@@ -1,26 +1,30 @@
#!/bin/bash
-if [ $# -eq 0 ]; then
+if [ $# -ne 2 ]; then
cat <<EOF
-Usage: $0 <VERSION_NUMBER>
+Usage: $0 <TARGET> <VERSION_NUMBER>
+
+TARGET: protoc | protoc-gen-javalite
Example:
- $ $0 3.0.0-beta-4
+ $ $0 protoc 3.0.0
+ $ $0 protoc-gen-javalite 3.0.0
-This script will download pre-built protoc binaries from maven repository
-and package them with well-known type .proto files to create .zip packages
-suitable to be included in the github release page. Each invocation will
-create 5 zip packages:
- dist/protoc-<VERSION_NUMBER>-win32.zip
- dist/protoc-<VERSION_NUMBER>-osx-x86_32.zip
- dist/protoc-<VERSION_NUMBER>-osx-x86_64.zip
- dist/protoc-<VERSION_NUMBER>-linux-x86_32.zip
- dist/protoc-<VERSION_NUMBER>-linux-x86_64.zip
+This script will download pre-built protoc or protoc plugin binaries from maven
+repository and create .zip packages suitable to be included in the github
+release page. If the target is protoc, well-known type .proto files will also be
+included. Each invocation will create 5 zip packages:
+ dist/<TARGET>-<VERSION_NUMBER>-win32.zip
+ dist/<TARGET>-<VERSION_NUMBER>-osx-x86_32.zip
+ dist/<TARGET>-<VERSION_NUMBER>-osx-x86_64.zip
+ dist/<TARGET>-<VERSION_NUMBER>-linux-x86_32.zip
+ dist/<TARGET>-<VERSION_NUMBER>-linux-x86_64.zip
EOF
exit 1
fi
-VERSION_NUMBER=$1
+TARGET=$1
+VERSION_NUMBER=$2
# <zip file name> <binary file name> pairs.
declare -a FILE_NAMES=( \
@@ -78,17 +82,27 @@ mkdir -p ${DIR}/bin
# Create a zip file for each binary.
for((i=0;i<${#FILE_NAMES[@]};i+=2));do
ZIP_NAME=${FILE_NAMES[$i]}
+ if [ ${ZIP_NAME:0:3} = "win" ]; then
+ BINARY="$TARGET.exe"
+ else
+ BINARY="$TARGET"
+ fi
BINARY_NAME=${FILE_NAMES[$(($i+1))]}
- BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION_NUMBER}/protoc-${VERSION_NUMBER}-${BINARY_NAME}
- if ! wget ${BINARY_URL} -O ${DIR}/bin/protoc &> /dev/null; then
+ BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/$TARGET/${VERSION_NUMBER}/$TARGET-${VERSION_NUMBER}-${BINARY_NAME}
+ if ! wget ${BINARY_URL} -O ${DIR}/bin/$BINARY &> /dev/null; then
echo "[ERROR] Failed to download ${BINARY_URL}" >&2
- echo "[ERROR] Skipped protoc-${VERSION_NAME}-${ZIP_NAME}" >&2
+ echo "[ERROR] Skipped $TARGET-${VERSION_NAME}-${ZIP_NAME}" >&2
continue
fi
- TARGET_ZIP_FILE=`pwd`/dist/protoc-${VERSION_NUMBER}-${ZIP_NAME}
+ TARGET_ZIP_FILE=`pwd`/dist/$TARGET-${VERSION_NUMBER}-${ZIP_NAME}
pushd $DIR &> /dev/null
- chmod +x bin/protoc
- zip -r ${TARGET_ZIP_FILE} include bin readme.txt &> /dev/null
+ chmod +x bin/$BINARY
+ if [ "$TARGET" = "protoc" ]; then
+ zip -r ${TARGET_ZIP_FILE} include bin readme.txt &> /dev/null
+ else
+ zip -r ${TARGET_ZIP_FILE} bin &> /dev/null
+ fi
+ rm bin/$BINARY
popd &> /dev/null
echo "[INFO] Successfully created ${TARGET_ZIP_FILE}"
done
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index 8fad896a..840bc60a 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-beta-4</version>
+ <version>3.0.0</version>
<packaging>pom</packaging>
<name>Protobuf Compiler</name>
<description>
@@ -59,6 +59,7 @@
<argument>build-protoc.sh</argument>
<argument>${os.detected.name}</argument>
<argument>${os.detected.arch}</argument>
+ <argument>protoc</argument>
</arguments>
</configuration>
</plugin>
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index 7213496e..6210a404 100755
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -30,7 +30,7 @@
# Copyright 2007 Google Inc. All Rights Reserved.
-__version__ = '3.0.0b4'
+__version__ = '3.0.0'
if __name__ != '__main__':
try:
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index bb6a1998..edc0cb50 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -310,7 +310,7 @@ def Parse(text, message, ignore_unknown_fields=False):
Args:
text: Message JSON representation.
- message: A protocol beffer message to merge into.
+ message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Returns:
diff --git a/python/setup.cfg b/python/setup.cfg
new file mode 100644
index 00000000..2a9acf13
--- /dev/null
+++ b/python/setup.cfg
@@ -0,0 +1,2 @@
+[bdist_wheel]
+universal = 1
diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec
index 8cf40e3f..286d8fe3 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.7.0.0"
+ s.version = "3.0.0"
s.licenses = ["BSD"]
s.summary = "Protocol Buffers"
s.description = "Protocol Buffers are Google's data interchange format."
diff --git a/ruby/lib/google/protobuf/well_known_types.rb b/ruby/lib/google/protobuf/well_known_types.rb
new file mode 100644
index 00000000..547de874
--- /dev/null
+++ b/ruby/lib/google/protobuf/well_known_types.rb
@@ -0,0 +1,212 @@
+#!/usr/bin/ruby
+# Protocol Buffers - Google's data interchange format
+# Copyright 2008 Google Inc. All rights reserved.
+# https://developers.google.com/protocol-buffers/
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+require 'google/protobuf/any_pb'
+require 'google/protobuf/duration_pb'
+require 'google/protobuf/field_mask_pb'
+require 'google/protobuf/struct_pb'
+require 'google/protobuf/timestamp_pb'
+
+module Google
+ module Protobuf
+
+ Any.class_eval do
+ def pack(msg, type_url_prefix='type.googleapis.com/')
+ if type_url_prefix.empty? or type_url_prefix[-1] != '/' then
+ self.type_url = "#{type_url_prefix}/#{msg.class.descriptor.name}"
+ else
+ self.type_url = "#{type_url_prefix}#{msg.class.descriptor.name}"
+ end
+ self.value = msg.to_proto
+ end
+
+ def unpack(klass)
+ if self.is(klass) then
+ klass.decode(self.value)
+ else
+ nil
+ end
+ end
+
+ def type_name
+ return self.type_url.split("/")[-1]
+ end
+
+ def is(klass)
+ return self.type_name == klass.descriptor.name
+ end
+ end
+
+ Timestamp.class_eval do
+ def to_time
+ Time.at(self.to_f)
+ end
+
+ def from_time(time)
+ self.seconds = time.to_i
+ self.nanos = time.nsec
+ end
+
+ def to_i
+ self.seconds
+ end
+
+ def to_f
+ self.seconds + (self.nanos.to_f / 1_000_000_000)
+ end
+ end
+
+ Duration.class_eval do
+ def to_f
+ self.seconds + (self.nanos.to_f / 1_000_000_000)
+ end
+ end
+
+ class UnexpectedStructType < Google::Protobuf::Error; end
+
+ Value.class_eval do
+ def to_ruby(recursive = false)
+ case self.kind
+ when :struct_value
+ if recursive
+ self.struct_value.to_h
+ else
+ self.struct_value
+ end
+ when :list_value
+ if recursive
+ self.list_value.to_a
+ else
+ self.list_value
+ end
+ when :null_value
+ nil
+ when :number_value
+ self.number_value
+ when :string_value
+ self.string_value
+ when :bool_value
+ self.bool_value
+ else
+ raise UnexpectedStructType
+ end
+ end
+
+ def from_ruby(value)
+ case value
+ when NilClass
+ self.null_value = 0
+ when Numeric
+ self.number_value = value
+ when String
+ self.string_value = value
+ when TrueClass
+ self.bool_value = true
+ when FalseClass
+ self.bool_value = false
+ when Struct
+ self.struct_value = value
+ when Hash
+ self.struct_value = Struct.from_hash(value)
+ when ListValue
+ self.list_value = value
+ when Array
+ self.list_value = ListValue.from_a(value)
+ else
+ raise UnexpectedStructType
+ end
+ end
+ end
+
+ Struct.class_eval do
+ def [](key)
+ self.fields[key].to_ruby
+ end
+
+ def []=(key, value)
+ unless key.is_a?(String)
+ raise UnexpectedStructType, "Struct keys must be strings."
+ end
+ self.fields[key] ||= Google::Protobuf::Value.new
+ self.fields[key].from_ruby(value)
+ end
+
+ def to_h
+ ret = {}
+ self.fields.each { |key, val| ret[key] = val.to_ruby(true) }
+ ret
+ end
+
+ def self.from_hash(hash)
+ ret = Struct.new
+ hash.each { |key, val| ret[key] = val }
+ ret
+ end
+ end
+
+ ListValue.class_eval do
+ include Enumerable
+
+ def length
+ self.values.length
+ end
+
+ def [](index)
+ self.values[index].to_ruby
+ end
+
+ def []=(index, value)
+ self.values[index].from_ruby(value)
+ end
+
+ def <<(value)
+ wrapper = Google::Protobuf::Value.new
+ wrapper.from_ruby(value)
+ self.values << wrapper
+ end
+
+ def each
+ self.values.each { |x| yield(x.to_ruby) }
+ end
+
+ def to_a
+ self.values.map { |x| x.to_ruby(true) }
+ end
+
+ def self.from_a(arr)
+ ret = ListValue.new
+ arr.each { |val| ret << val }
+ ret
+ end
+ end
+
+ end
+end
diff --git a/ruby/pom.xml b/ruby/pom.xml
index 62845815..99e8449b 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-beta-3</version>
+ <version>3.0.0-beta-4</version>
</dependency>
</dependencies>
</project>
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index f81e456c..8b6d329e 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -468,9 +468,9 @@ module BasicTest
assert m.length == 2
m2 = m.dup
- assert m == m2
+ assert_equal m, m2
assert m.hash != 0
- assert m.hash == m2.hash
+ assert_equal m.hash, m2.hash
collected = {}
m.each { |k,v| collected[v] = k }
diff --git a/ruby/tests/well_known_types_test.rb b/ruby/tests/well_known_types_test.rb
new file mode 100644
index 00000000..9b46632b
--- /dev/null
+++ b/ruby/tests/well_known_types_test.rb
@@ -0,0 +1,122 @@
+#!/usr/bin/ruby
+
+require 'test/unit'
+require 'google/protobuf/well_known_types'
+
+class TestWellKnownTypes < Test::Unit::TestCase
+ def test_timestamp
+ ts = Google::Protobuf::Timestamp.new
+
+ assert_equal Time.at(0), ts.to_time
+
+ ts.seconds = 12345
+ assert_equal Time.at(12345), ts.to_time
+ assert_equal 12345, ts.to_i
+
+ ts.from_time(Time.at(123456, 654321))
+ assert_equal 123456, ts.seconds
+ assert_equal 654321000, ts.nanos
+ assert_equal Time.at(123456.654321), ts.to_time
+ end
+
+ def test_duration
+ duration = Google::Protobuf::Duration.new(seconds: 123, nanos: 456)
+ assert_equal 123.000000456, duration.to_f
+ end
+
+ def test_struct
+ struct = Google::Protobuf::Struct.new
+
+ substruct = {
+ "subkey" => 999,
+ "subkey2" => false
+ }
+
+ sublist = ["abc", 123, {"deepkey" => "deepval"}]
+
+ struct["number"] = 12345
+ struct["boolean-true"] = true
+ struct["boolean-false"] = false
+ struct["null"] = nil
+ struct["string"] = "abcdef"
+ struct["substruct"] = substruct
+ struct["sublist"] = sublist
+
+ assert_equal 12345, struct["number"]
+ assert_equal true, struct["boolean-true"]
+ assert_equal false, struct["boolean-false"]
+ assert_equal nil, struct["null"]
+ assert_equal "abcdef", struct["string"]
+ assert_equal(Google::Protobuf::Struct.from_hash(substruct),
+ struct["substruct"])
+ assert_equal(Google::Protobuf::ListValue.from_a(sublist),
+ struct["sublist"])
+
+ should_equal = {
+ "number" => 12345,
+ "boolean-true" => true,
+ "boolean-false" => false,
+ "null" => nil,
+ "string" => "abcdef",
+ "substruct" => {
+ "subkey" => 999,
+ "subkey2" => false
+ },
+ "sublist" => ["abc", 123, {"deepkey" => "deepval"}]
+ }
+
+ list = struct["sublist"]
+ list.is_a?(Google::Protobuf::ListValue)
+ assert_equal "abc", list[0]
+ assert_equal 123, list[1]
+ assert_equal({"deepkey" => "deepval"}, list[2].to_h)
+
+ # to_h returns a fully-flattened Ruby structure (Hash and Array).
+ assert_equal(should_equal, struct.to_h)
+
+ # Test that we can assign Struct and ListValue directly.
+ struct["substruct"] = Google::Protobuf::Struct.from_hash(substruct)
+ struct["sublist"] = Google::Protobuf::ListValue.from_a(sublist)
+
+ assert_equal(should_equal, struct.to_h)
+
+ struct["sublist"] << nil
+ should_equal["sublist"] << nil
+
+ assert_equal(should_equal, struct.to_h)
+ assert_equal(should_equal["sublist"].length, struct["sublist"].length)
+
+ assert_raise Google::Protobuf::UnexpectedStructType do
+ struct[123] = 5
+ end
+
+ assert_raise Google::Protobuf::UnexpectedStructType do
+ struct[5] = Time.new
+ end
+
+ assert_raise Google::Protobuf::UnexpectedStructType do
+ struct[5] = [Time.new]
+ end
+
+ assert_raise Google::Protobuf::UnexpectedStructType do
+ struct[5] = {123 => 456}
+ end
+
+ assert_raise Google::Protobuf::UnexpectedStructType do
+ struct = Google::Protobuf::Struct.new
+ struct.fields["foo"] = Google::Protobuf::Value.new
+ # Tries to return a Ruby value for a Value class whose type
+ # hasn't been filled in.
+ struct["foo"]
+ end
+ end
+
+ def test_any
+ any = Google::Protobuf::Any.new
+ ts = Google::Protobuf::Timestamp.new(seconds: 12345, nanos: 6789)
+ any.pack(ts)
+
+ assert any.is(Google::Protobuf::Timestamp)
+ assert_equal ts, any.unpack(Google::Protobuf::Timestamp)
+ end
+end
diff --git a/src/Makefile.am b/src/Makefile.am
index 524886ea..f70e9550 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,10 @@ AM_LDFLAGS = $(PTHREAD_CFLAGS)
# If I say "dist_include_DATA", automake complains that $(includedir) is not
# a "legitimate" directory for DATA. Screw you, automake.
protodir = $(includedir)
+
+# If you are adding new files here, also remember to change the build files for
+# all other languages, //protoc-artifacts/build-zip.sh and run
+# //update_file_list.sh for bazel.
nobase_dist_proto_DATA = google/protobuf/descriptor.proto \
google/protobuf/any.proto \
google/protobuf/api.proto \
diff --git a/src/google/protobuf/stubs/int128.cc b/src/google/protobuf/stubs/int128.cc
index 3a36b4b1..a5090801 100644
--- a/src/google/protobuf/stubs/int128.cc
+++ b/src/google/protobuf/stubs/int128.cc
@@ -145,15 +145,15 @@ std::ostream& operator<<(std::ostream& o, const uint128& b) {
std::streamsize div_base_log;
switch (flags & std::ios::basefield) {
case std::ios::hex:
- div = GOOGLE_ULONGLONG(0x1000000000000000); // 16^15
+ div = static_cast<uint64>(GOOGLE_ULONGLONG(0x1000000000000000)); // 16^15
div_base_log = 15;
break;
case std::ios::oct:
- div = GOOGLE_ULONGLONG(01000000000000000000000); // 8^21
+ div = static_cast<uint64>(GOOGLE_ULONGLONG(01000000000000000000000)); // 8^21
div_base_log = 21;
break;
default: // std::ios::dec
- div = GOOGLE_ULONGLONG(10000000000000000000); // 10^19
+ div = static_cast<uint64>(GOOGLE_ULONGLONG(10000000000000000000)); // 10^19
div_base_log = 19;
break;
}
diff --git a/src/google/protobuf/stubs/map_util.h b/src/google/protobuf/stubs/map_util.h
index 4cccbbed..887f12a6 100644
--- a/src/google/protobuf/stubs/map_util.h
+++ b/src/google/protobuf/stubs/map_util.h
@@ -208,7 +208,7 @@ typename Collection::value_type::second_type::element_type&
FindLinkedPtrOrDie(const Collection& collection,
const typename Collection::value_type::first_type& key) {
typename Collection::const_iterator it = collection.find(key);
- CHECK(it != collection.end()) << "key not found: " << key;
+ GOOGLE_CHECK(it != collection.end()) << "key not found: " << key;
// Since linked_ptr::operator*() is a const member returning a non const,
// we do not need a version of this function taking a non const collection.
return *it->second;
@@ -337,14 +337,15 @@ bool InsertIfNotPresent(
template <class Collection>
void InsertOrDie(Collection* const collection,
const typename Collection::value_type& value) {
- CHECK(InsertIfNotPresent(collection, value)) << "duplicate value: " << value;
+ GOOGLE_CHECK(InsertIfNotPresent(collection, value))
+ << "duplicate value: " << value;
}
// Same as above except doesn't log the value on error.
template <class Collection>
void InsertOrDieNoPrint(Collection* const collection,
const typename Collection::value_type& value) {
- CHECK(InsertIfNotPresent(collection, value)) << "duplicate value.";
+ GOOGLE_CHECK(InsertIfNotPresent(collection, value)) << "duplicate value.";
}
// Inserts the key-value pair into the collection. Dies if key was already
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index 328258b7..d7f93b4c 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -109,15 +109,15 @@ typedef unsigned __int16 uint16;
typedef unsigned __int32 uint32;
typedef unsigned __int64 uint64;
#else
-typedef signed char int8;
-typedef short int16;
-typedef int int32;
-typedef long long int64;
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned long long uint64;
+typedef int8_t int8;
+typedef int16_t int16;
+typedef int32_t int32;
+typedef int64_t int64;
+
+typedef uint8_t uint8;
+typedef uint16_t uint16;
+typedef uint32_t uint32;
+typedef uint64_t uint64;
#endif
// long long macros to be used because gcc and vc++ use different suffixes,
@@ -131,8 +131,10 @@ typedef unsigned long long uint64;
#define GOOGLE_ULONGLONG(x) x##UI64
#define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...)
#else
+// By long long, we actually mean int64.
#define GOOGLE_LONGLONG(x) x##LL
#define GOOGLE_ULONGLONG(x) x##ULL
+// Used to format real long long integers.
#define GOOGLE_LL_FORMAT "ll" // As in "%lld". Note that "q" is poor form also.
#endif
diff --git a/src/google/protobuf/util/time_util.cc b/src/google/protobuf/util/time_util.cc
index c782d691..031d019a 100644
--- a/src/google/protobuf/util/time_util.cc
+++ b/src/google/protobuf/util/time_util.cc
@@ -142,6 +142,13 @@ int64 RoundTowardZero(int64 value, int64 divider) {
}
} // namespace
+// Actually define these static const integers. Required by C++ standard (but
+// omitting them may still work with some compilers).
+const int64 TimeUtil::kTimestampMinSeconds;
+const int64 TimeUtil::kTimestampMaxSeconds;
+const int64 TimeUtil::kDurationMaxSeconds;
+const int64 TimeUtil::kDurationMinSeconds;
+
string TimeUtil::ToString(const Timestamp& timestamp) {
return FormatTime(timestamp.seconds(), timestamp.nanos());
}
@@ -174,7 +181,7 @@ string TimeUtil::ToString(const Duration& duration) {
seconds = -seconds;
nanos = -nanos;
}
- result += StringPrintf("%" GOOGLE_LL_FORMAT "d", seconds);
+ result += SimpleItoa(seconds);
if (nanos != 0) {
result += "." + FormatNanos(nanos);
}
diff --git a/tests.sh b/tests.sh
index 7d2eb3be..9e95f2b7 100755
--- a/tests.sh
+++ b/tests.sh
@@ -195,6 +195,14 @@ build_java_oracle7() {
use_java oracle7
build_java oracle7
}
+build_java_compatibility() {
+ use_java jdk7
+ internal_build_cpp
+ # Use the unit-tests extraced from 2.5.0 to test the compatibilty between
+ # 3.0.0-beta-4 and the current version.
+ cd java/compatibility_tests/v2.5.0
+ ./test.sh 3.0.0-beta-4
+}
build_javanano_jdk7() {
use_java jdk7
@@ -340,6 +348,7 @@ Usage: $0 { cpp |
csharp |
java_jdk7 |
java_oracle7 |
+ java_compatibility |
javanano_jdk7 |
javanano_oracle7 |
objectivec_ios |