Skip to content

Commit

Permalink
Merge pull request #9482 from haberman/sync-stage
Browse files Browse the repository at this point in the history
Integrate from Piper for C++, Java, and Python
  • Loading branch information
haberman committed Feb 9, 2022
2 parents 2d69d44 + 73f772b commit ce731e2
Show file tree
Hide file tree
Showing 74 changed files with 2,259 additions and 1,928 deletions.
8 changes: 8 additions & 0 deletions CHANGES.txt
Expand Up @@ -21,6 +21,7 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Report original exceptions when parsing JSON
* Add more info to @deprecated javadoc for set/get/has methods
* Fix initialization bug in doc comment line numbers
* Fix comments for message set wire format.

Kotlin
* Add orNull extensions for optional message fields in Kotlin.
Expand All @@ -46,6 +47,8 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
zone. If omitted or None, the function returns a timezone-naive UTC datetime
(as previously).
* Adds client_streaming and server_streaming fields to MethodDescriptor.
* Add "ensure_ascii" parameter to json_format.MessageToJson. This allows smaller
JSON serializations with UTF-8 or other non-ASCII encodings.

Compiler
* Migrate IsDefault(const std::string*) and UnsafeSetDefault(const std::string*)
Expand All @@ -63,6 +66,7 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Do not log/report the same descriptor symbol multiple times if it contains
more than one invalid character.
* Add UnknownFieldSet::SerializeToString and SerializeToCodedStream.
* Remove explicit default pointers and deprecated API from protocol compiler

Arenas
* Change Repeated*Field to reuse memory when using arenas.
Expand All @@ -80,6 +84,10 @@ Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
* Generate narrower code
* Fix https://github.com/protocolbuffers/protobuf/issues/9378 by removing
shadowed _cached_size_ field
* Remove GetPointer() and explicit nullptr defaults.
* add proto_h flag for speeding up large builds
* Add missing overload for reference wrapped fields.


2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Expand Up @@ -544,6 +544,7 @@ java_EXTRA_DIST=
java/kotlin/generate-test-sources-build.xml \
java/kotlin/pom.xml \
java/kotlin/pom_template.xml \
java/kotlin/src/main/kotlin/com/google/protobuf/Anies.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/ByteStrings.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
Expand All @@ -553,6 +554,7 @@ java_EXTRA_DIST=
java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/AniesTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
Expand Down
9 changes: 7 additions & 2 deletions conformance/conformance_nodejs.js
Expand Up @@ -41,11 +41,16 @@ function doTest(request) {
var response = new conformance.ConformanceResponse();

try {
if (request.getRequestedOutputFormat() === conformance.WireFormat.JSON) {
if (request.getRequestedOutputFormat() == conformance.WireFormat.JSON) {
response.setSkipped("JSON not supported.");
return response;
}

if (request.getRequestedOutputFormat() == conformance.WireFormat.TEXT_FORMAT) {
response.setSkipped('Text format is not supported as output format.');
return response;
}

switch (request.getPayloadCase()) {
case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: {
if (request.getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
Expand All @@ -67,7 +72,7 @@ function doTest(request) {
} else {
throw "Protobuf request doesn\'t have specific payload type";
}
}
} break;

case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD:
response.setSkipped("JSON not supported.");
Expand Down
14 changes: 12 additions & 2 deletions conformance/conformance_test.cc
Expand Up @@ -350,15 +350,25 @@ bool ConformanceTestSuite::CheckSetEmpty(
StringAppendF(&output_, "\n");

if (!write_to_file.empty()) {
std::ofstream os(write_to_file);
std::string full_filename;
const std::string* filename = &write_to_file;
if (!output_dir_.empty()) {
full_filename = output_dir_;
if (*output_dir_.rbegin() != '/') {
full_filename.push_back('/');
}
full_filename += write_to_file;
filename = &full_filename;
}
std::ofstream os(*filename);
if (os) {
for (std::set<string>::const_iterator iter = set_to_check.begin();
iter != set_to_check.end(); ++iter) {
os << *iter << "\n";
}
} else {
StringAppendF(&output_, "Failed to open file: %s\n",
write_to_file.c_str());
filename->c_str());
}
}

Expand Down
6 changes: 6 additions & 0 deletions conformance/conformance_test.h
Expand Up @@ -174,6 +174,11 @@ class ConformanceTestSuite {
failure_list_flag_name_ = failure_list_flag_name;
}

// Sets the path of the output directory.
void SetOutputDir(const char* output_dir) {
output_dir_ = output_dir;
}

// Run all the conformance tests against the given test runner.
// Test output will be stored in "output".
//
Expand Down Expand Up @@ -296,6 +301,7 @@ class ConformanceTestSuite {
bool verbose_;
bool enforce_recommended_;
std::string output_;
std::string output_dir_;
std::string failure_list_flag_name_;
std::string failure_list_filename_;

Expand Down
6 changes: 6 additions & 0 deletions conformance/conformance_test_runner.cc
Expand Up @@ -141,6 +141,9 @@ void UsageError() {
" strictly conforming to protobuf\n");
fprintf(stderr,
" spec.\n");
fprintf(stderr,
" --output_dir <dirname> Directory to write\n"
" output files.\n");
exit(1);
}

Expand Down Expand Up @@ -208,6 +211,9 @@ int ForkPipeRunner::Run(
suite->SetVerbose(true);
} else if (strcmp(argv[arg], "--enforce_recommended") == 0) {
suite->SetEnforceRecommended(true);
} else if (strcmp(argv[arg], "--output_dir") == 0) {
if (++arg == argc) UsageError();
suite->SetOutputDir(argv[arg]);
} else if (argv[arg][0] == '-') {
bool recognized_flag = false;
for (ConformanceTestSuite* suite : suites) {
Expand Down

0 comments on commit ce731e2

Please sign in to comment.