Skip to content

Commit

Permalink
Merge pull request #6298 from TeBoring/3.9.x-merge
Browse files Browse the repository at this point in the history
Merge master into 3.9.x
  • Loading branch information
TeBoring authored Jun 24, 2019
2 parents 4aa7750 + d581c76 commit 3f33753
Show file tree
Hide file tree
Showing 51 changed files with 390 additions and 393 deletions.
103 changes: 102 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ cc_library(
# TODO(keveman): Remove this target once the support gets added to Bazel.
cc_library(
name = "protobuf_headers",
hdrs = glob(["src/**/*.h"]),
hdrs = glob(["src/**/*.h", "src/**/*.inc"]),
includes = ["src/"],
visibility = ["//visibility:public"],
)
Expand Down Expand Up @@ -647,6 +647,107 @@ java_library(
visibility = ["//visibility:public"],
)

java_library(
name = "protobuf_javalite",
srcs = [
# Keep in sync with java/lite/pom.xml
"java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java",
"java/core/src/main/java/com/google/protobuf/AbstractParser.java",
"java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java",
"java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java",
"java/core/src/main/java/com/google/protobuf/Android.java",
"java/core/src/main/java/com/google/protobuf/ArrayDecoders.java",
"java/core/src/main/java/com/google/protobuf/BinaryReader.java",
"java/core/src/main/java/com/google/protobuf/BinaryWriter.java",
"java/core/src/main/java/com/google/protobuf/BooleanArrayList.java",
"java/core/src/main/java/com/google/protobuf/BufferAllocator.java",
"java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java",
"java/core/src/main/java/com/google/protobuf/ByteOutput.java",
"java/core/src/main/java/com/google/protobuf/ByteString.java",
"java/core/src/main/java/com/google/protobuf/CodedInputStream.java",
"java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java",
"java/core/src/main/java/com/google/protobuf/CodedOutputStream.java",
"java/core/src/main/java/com/google/protobuf/CodedOutputStreamWriter.java",
"java/core/src/main/java/com/google/protobuf/DoubleArrayList.java",
"java/core/src/main/java/com/google/protobuf/ExperimentalApi.java",
"java/core/src/main/java/com/google/protobuf/ExtensionLite.java",
"java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java",
"java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java",
"java/core/src/main/java/com/google/protobuf/ExtensionSchema.java",
"java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java",
"java/core/src/main/java/com/google/protobuf/ExtensionSchemas.java",
"java/core/src/main/java/com/google/protobuf/FieldInfo.java",
"java/core/src/main/java/com/google/protobuf/FieldSet.java",
"java/core/src/main/java/com/google/protobuf/FieldType.java",
"java/core/src/main/java/com/google/protobuf/FloatArrayList.java",
"java/core/src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java",
"java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java",
"java/core/src/main/java/com/google/protobuf/IntArrayList.java",
"java/core/src/main/java/com/google/protobuf/Internal.java",
"java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java",
"java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java",
"java/core/src/main/java/com/google/protobuf/JavaType.java",
"java/core/src/main/java/com/google/protobuf/LazyField.java",
"java/core/src/main/java/com/google/protobuf/LazyFieldLite.java",
"java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java",
"java/core/src/main/java/com/google/protobuf/LazyStringList.java",
"java/core/src/main/java/com/google/protobuf/ListFieldSchema.java",
"java/core/src/main/java/com/google/protobuf/LongArrayList.java",
"java/core/src/main/java/com/google/protobuf/ManifestSchemaFactory.java",
"java/core/src/main/java/com/google/protobuf/MapEntryLite.java",
"java/core/src/main/java/com/google/protobuf/MapFieldLite.java",
"java/core/src/main/java/com/google/protobuf/MapFieldSchema.java",
"java/core/src/main/java/com/google/protobuf/MapFieldSchemaLite.java",
"java/core/src/main/java/com/google/protobuf/MapFieldSchemas.java",
"java/core/src/main/java/com/google/protobuf/MessageInfo.java",
"java/core/src/main/java/com/google/protobuf/MessageInfoFactory.java",
"java/core/src/main/java/com/google/protobuf/MessageLite.java",
"java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java",
"java/core/src/main/java/com/google/protobuf/MessageLiteToString.java",
"java/core/src/main/java/com/google/protobuf/MessageSchema.java",
"java/core/src/main/java/com/google/protobuf/MessageSetSchema.java",
"java/core/src/main/java/com/google/protobuf/MutabilityOracle.java",
"java/core/src/main/java/com/google/protobuf/NewInstanceSchema.java",
"java/core/src/main/java/com/google/protobuf/NewInstanceSchemaLite.java",
"java/core/src/main/java/com/google/protobuf/NewInstanceSchemas.java",
"java/core/src/main/java/com/google/protobuf/NioByteString.java",
"java/core/src/main/java/com/google/protobuf/OneofInfo.java",
"java/core/src/main/java/com/google/protobuf/Parser.java",
"java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java",
"java/core/src/main/java/com/google/protobuf/ProtoSyntax.java",
"java/core/src/main/java/com/google/protobuf/Protobuf.java",
"java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java",
"java/core/src/main/java/com/google/protobuf/ProtobufLists.java",
"java/core/src/main/java/com/google/protobuf/ProtocolStringList.java",
"java/core/src/main/java/com/google/protobuf/RawMessageInfo.java",
"java/core/src/main/java/com/google/protobuf/Reader.java",
"java/core/src/main/java/com/google/protobuf/RopeByteString.java",
"java/core/src/main/java/com/google/protobuf/Schema.java",
"java/core/src/main/java/com/google/protobuf/SchemaFactory.java",
"java/core/src/main/java/com/google/protobuf/SchemaUtil.java",
"java/core/src/main/java/com/google/protobuf/SmallSortedMap.java",
"java/core/src/main/java/com/google/protobuf/StructuralMessageInfo.java",
"java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java",
"java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java",
"java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java",
"java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java",
"java/core/src/main/java/com/google/protobuf/UnknownFieldSetLiteSchema.java",
"java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java",
"java/core/src/main/java/com/google/protobuf/UnsafeUtil.java",
"java/core/src/main/java/com/google/protobuf/Utf8.java",
"java/core/src/main/java/com/google/protobuf/WireFormat.java",
"java/core/src/main/java/com/google/protobuf/Writer.java",
],
javacopts = select({
"//:jdk9": ["--add-modules=jdk.unsupported"],
"//conditions:default": [
"-source 7",
"-target 7",
],
}),
visibility = ["//visibility:public"],
)

java_library(
name = "protobuf_java_util",
srcs = glob([
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1230,6 +1230,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \
examples/pubspec.yaml \
examples/third_party/zlib.BUILD \
protobuf.bzl \
protobuf_deps.bzl \
python/release/wheel/build_wheel_manylinux.sh \
python/release/wheel/Dockerfile \
python/release/wheel/protobuf_optimized_pip.sh \
Expand Down
8 changes: 4 additions & 4 deletions conformance/binary_json_conformance_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1980,12 +1980,12 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
"repeated_timestamp: {seconds: 253402300799 nanos: 999999999}");
RunValidJsonTest(
"TimestampWithPositiveOffset", REQUIRED,
R"({"optionalTimestamp": "1970-01-01T08:00:00+08:00"})",
"optional_timestamp: {seconds: 0}");
R"({"optionalTimestamp": "1970-01-01T08:00:01+08:00"})",
"optional_timestamp: {seconds: 1}");
RunValidJsonTest(
"TimestampWithNegativeOffset", REQUIRED,
R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})",
"optional_timestamp: {seconds: 0}");
R"({"optionalTimestamp": "1969-12-31T16:00:01-08:00"})",
"optional_timestamp: {seconds: 1}");
RunValidJsonTest(
"TimestampNull", REQUIRED,
R"({"optionalTimestamp": null})",
Expand Down
4 changes: 0 additions & 4 deletions conformance/failure_list_php.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Required.Proto3.JsonInput.FloatFieldTooLarge
Required.Proto3.JsonInput.FloatFieldTooSmall
Expand Down
2 changes: 0 additions & 2 deletions conformance/failure_list_php_c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
Recommended.Proto3.JsonInput.MapFieldValueIsNull
Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
Expand All @@ -17,7 +16,6 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput
Required.DurationProtoInputTooLarge.JsonOutput
Required.DurationProtoInputTooSmall.JsonOutput
Expand Down
2 changes: 0 additions & 2 deletions conformance/failure_list_ruby.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
Recommended.Proto3.JsonInput.MapFieldValueIsNull
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull
Expand All @@ -16,7 +15,6 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
Required.DurationProtoInputTooLarge.JsonOutput
Required.DurationProtoInputTooSmall.JsonOutput
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
Expand Down
2 changes: 0 additions & 2 deletions conformance/failure_list_ruby_mac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
Recommended.Proto3.JsonInput.MapFieldValueIsNull
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull
Expand All @@ -15,7 +14,6 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
Required.DurationProtoInputTooLarge.JsonOutput
Required.DurationProtoInputTooSmall.JsonOutput
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
Expand Down
4 changes: 4 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,7 @@ with info about your project (name and website) so we can add an entry for you.
* Website: https://twirpql.dev
* Extensions: 1070

1. Protoc-gen-validate
* Website: https://github.com/envoyproxy/protoc-gen-validate
* Extensions: 1071

10 changes: 5 additions & 5 deletions java/compatibility_tests/v2.5.0/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,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_64.exe
OLD_VERSION_PROTOC=https://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_64.exe
OLD_VERSION_PROTOC=https://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_64.exe
OLD_VERSION_PROTOC=https://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_64.exe
OLD_VERSION_PROTOC=https://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_64.exe
OLD_VERSION_PROTOC=https://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"
Expand Down
1 change: 1 addition & 0 deletions java/lite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<resource>
<directory>${basedir}/../core/src/main/java/com/google/protobuf</directory>
<includes>
<!-- Keep in sync with //:BUILD -->
<include>AbstractMessageLite.java</include>
<include>AbstractParser.java</include>
<include>AbstractProtobufList.java</include>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM grpctesting/rake-compiler-dock_53c22085d091183c528303791e7771359f699bcf

RUN /bin/bash -l -c "gem install bundler"
RUN /bin/bash -l -c "gem update --system '2.7.9' && gem install bundler"
41 changes: 29 additions & 12 deletions php/ext/google/protobuf/upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -12431,18 +12431,32 @@ static size_t fmt_bool(bool val, char* buf, size_t length) {
return n;
}

static size_t fmt_int64(long val, char* buf, size_t length) {
size_t n = _upb_snprintf(buf, length, "%ld", val);
static size_t fmt_int64_as_number(long long val, char* buf, size_t length) {
size_t n = _upb_snprintf(buf, length, "%lld", val);
CHKLENGTH(n > 0 && n < length);
return n;
}

static size_t fmt_uint64(unsigned long long val, char* buf, size_t length) {
static size_t fmt_uint64_as_number(
unsigned long long val, char* buf, size_t length) {
size_t n = _upb_snprintf(buf, length, "%llu", val);
CHKLENGTH(n > 0 && n < length);
return n;
}

static size_t fmt_int64_as_string(long long val, char* buf, size_t length) {
size_t n = _upb_snprintf(buf, length, "\"%lld\"", val);
CHKLENGTH(n > 0 && n < length);
return n;
}

static size_t fmt_uint64_as_string(
unsigned long long val, char* buf, size_t length) {
size_t n = _upb_snprintf(buf, length, "\"%llu\"", val);
CHKLENGTH(n > 0 && n < length);
return n;
}

/* Print a map key given a field name. Called by scalar field handlers and by
* startseq for repeated fields. */
static bool putkey(void *closure, const void *handler_data) {
Expand Down Expand Up @@ -12486,26 +12500,29 @@ static bool putkey(void *closure, const void *handler_data) {
static bool putmapkey_##type(void *closure, const void *handler_data, \
type val) { \
upb_json_printer *p = closure; \
char data[64]; \
size_t length = fmt_func(val, data, sizeof(data)); \
UPB_UNUSED(handler_data); \
print_data(p, "\"", 1); \
CHK(put##type(closure, handler_data, val)); \
print_data(p, data, length); \
print_data(p, "\":", 2); \
return true; \
}

TYPE_HANDLERS(double, fmt_double)
TYPE_HANDLERS(float, fmt_float)
TYPE_HANDLERS(bool, fmt_bool)
TYPE_HANDLERS(int32_t, fmt_int64)
TYPE_HANDLERS(uint32_t, fmt_int64)
TYPE_HANDLERS(int64_t, fmt_int64)
TYPE_HANDLERS(uint64_t, fmt_uint64)
TYPE_HANDLERS(int32_t, fmt_int64_as_number)
TYPE_HANDLERS(uint32_t, fmt_int64_as_number)
TYPE_HANDLERS(int64_t, fmt_int64_as_string)
TYPE_HANDLERS(uint64_t, fmt_uint64_as_string)

/* double and float are not allowed to be map keys. */
TYPE_HANDLERS_MAPKEY(bool, fmt_bool)
TYPE_HANDLERS_MAPKEY(int32_t, fmt_int64)
TYPE_HANDLERS_MAPKEY(uint32_t, fmt_int64)
TYPE_HANDLERS_MAPKEY(int64_t, fmt_int64)
TYPE_HANDLERS_MAPKEY(uint64_t, fmt_uint64)
TYPE_HANDLERS_MAPKEY(int32_t, fmt_int64_as_number)
TYPE_HANDLERS_MAPKEY(uint32_t, fmt_int64_as_number)
TYPE_HANDLERS_MAPKEY(int64_t, fmt_int64_as_number)
TYPE_HANDLERS_MAPKEY(uint64_t, fmt_uint64_as_number)

#undef TYPE_HANDLERS
#undef TYPE_HANDLERS_MAPKEY
Expand Down
2 changes: 1 addition & 1 deletion php/src/Google/Protobuf/Internal/DescriptorProto.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions php/src/Google/Protobuf/Internal/EnumDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,26 @@ public function addValue($number, $value)

public function getValueByNumber($number)
{
return $this->value[$number];
if (isset($this->value[$number])) {
return $this->value[$number];
}
return null;
}

public function getValueByName($name)
{
return $this->name_to_value[$name];
if (isset($this->name_to_value[$name])) {
return $this->name_to_value[$name];
}
return null;
}

public function getValueDescriptorByIndex($index)
{
return $this->value_descriptor[$index];
if (isset($this->value_descriptor[$index])) {
return $this->value_descriptor[$index];
}
return null;
}

public function getValueCount()
Expand Down
2 changes: 1 addition & 1 deletion php/src/Google/Protobuf/Internal/EnumDescriptorProto.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f33753

Please sign in to comment.