aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rwxr-xr-xbenchmarks/python/py_benchmark.py17
-rwxr-xr-xbenchmarks/util/big_query_utils.py27
-rwxr-xr-xbenchmarks/util/run_and_upload.py14
-rw-r--r--csharp/Google.Protobuf.Tools.nuspec2
-rw-r--r--csharp/Google.Protobuf.Tools.targets16
-rwxr-xr-xsrc/google/protobuf/compiler/js/js_generator.cc3
-rw-r--r--src/google/protobuf/stubs/platform_macros.h6
-rw-r--r--src/google/protobuf/util/json_util.cc3
9 files changed, 60 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am
index ac87e8a3..76bb2ba2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,7 @@ pkgconfig_DATA = protobuf.pc protobuf-lite.pc
csharp_EXTRA_DIST= \
csharp/.gitignore \
csharp/CHANGES.txt \
+ csharp/Google.Protobuf.Tools.targets \
csharp/Google.Protobuf.Tools.nuspec \
csharp/README.md \
csharp/build_packages.bat \
diff --git a/benchmarks/python/py_benchmark.py b/benchmarks/python/py_benchmark.py
index 6942d208..e86b61e7 100755
--- a/benchmarks/python/py_benchmark.py
+++ b/benchmarks/python/py_benchmark.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import sys
import os
import timeit
@@ -138,15 +139,15 @@ if __name__ == "__main__":
results.append(run_one_test(file))
if args.json != "no":
- print json.dumps(results)
+ print(json.dumps(results))
else:
for result in results:
- print "Message %s of dataset file %s" % \
- (result["message_name"], result["filename"])
- print "Average time for parse_from_benchmark: %.2f ns" % \
+ print("Message %s of dataset file %s" % \
+ (result["message_name"], result["filename"]))
+ print("Average time for parse_from_benchmark: %.2f ns" % \
(result["benchmarks"][ \
- args.behavior_prefix + "_parse_from_benchmark"])
- print "Average time for serialize_to_benchmark: %.2f ns" % \
+ args.behavior_prefix + "_parse_from_benchmark"]))
+ print("Average time for serialize_to_benchmark: %.2f ns" % \
(result["benchmarks"][ \
- args.behavior_prefix + "_serialize_to_benchmark"])
- print ""
+ args.behavior_prefix + "_serialize_to_benchmark"]))
+ print("")
diff --git a/benchmarks/util/big_query_utils.py b/benchmarks/util/big_query_utils.py
index 14105aa6..aea55bbd 100755
--- a/benchmarks/util/big_query_utils.py
+++ b/benchmarks/util/big_query_utils.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python2.7
+from __future__ import print_function
import argparse
import json
import uuid
@@ -37,11 +38,11 @@ def create_dataset(biq_query, project_id, dataset_id):
dataset_req.execute(num_retries=NUM_RETRIES)
except HttpError as http_error:
if http_error.resp.status == 409:
- print 'Warning: The dataset %s already exists' % dataset_id
+ print('Warning: The dataset %s already exists' % dataset_id)
else:
# Note: For more debugging info, print "http_error.content"
- print 'Error in creating dataset: %s. Err: %s' % (dataset_id,
- http_error)
+ print('Error in creating dataset: %s. Err: %s' % (dataset_id,
+ http_error))
is_success = False
return is_success
@@ -109,13 +110,13 @@ def create_table2(big_query,
table_req = big_query.tables().insert(
projectId=project_id, datasetId=dataset_id, body=body)
res = table_req.execute(num_retries=NUM_RETRIES)
- print 'Successfully created %s "%s"' % (res['kind'], res['id'])
+ print('Successfully created %s "%s"' % (res['kind'], res['id']))
except HttpError as http_error:
if http_error.resp.status == 409:
- print 'Warning: Table %s already exists' % table_id
+ print('Warning: Table %s already exists' % table_id)
else:
- print 'Error in creating table: %s. Err: %s' % (table_id,
- http_error)
+ print('Error in creating table: %s. Err: %s' % (table_id,
+ http_error))
is_success = False
return is_success
@@ -141,9 +142,9 @@ def patch_table(big_query, project_id, dataset_id, table_id, fields_schema):
tableId=table_id,
body=body)
res = table_req.execute(num_retries=NUM_RETRIES)
- print 'Successfully patched %s "%s"' % (res['kind'], res['id'])
+ print('Successfully patched %s "%s"' % (res['kind'], res['id']))
except HttpError as http_error:
- print 'Error in creating table: %s. Err: %s' % (table_id, http_error)
+ print('Error in creating table: %s. Err: %s' % (table_id, http_error))
is_success = False
return is_success
@@ -159,10 +160,10 @@ def insert_rows(big_query, project_id, dataset_id, table_id, rows_list):
body=body)
res = insert_req.execute(num_retries=NUM_RETRIES)
if res.get('insertErrors', None):
- print 'Error inserting rows! Response: %s' % res
+ print('Error inserting rows! Response: %s' % res)
is_success = False
except HttpError as http_error:
- print 'Error inserting rows to the table %s' % table_id
+ print('Error inserting rows to the table %s' % table_id)
is_success = False
return is_success
@@ -176,8 +177,8 @@ def sync_query_job(big_query, project_id, query, timeout=5000):
projectId=project_id,
body=query_data).execute(num_retries=NUM_RETRIES)
except HttpError as http_error:
- print 'Query execute job failed with error: %s' % http_error
- print http_error.content
+ print('Query execute job failed with error: %s' % http_error)
+ print(http_error.content)
return query_job
diff --git a/benchmarks/util/run_and_upload.py b/benchmarks/util/run_and_upload.py
index ae22a668..43c9fa2d 100755
--- a/benchmarks/util/run_and_upload.py
+++ b/benchmarks/util/run_and_upload.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+from __future__ import absolute_import
import argparse
import os
import re
@@ -5,7 +7,7 @@ import copy
import uuid
import calendar
import time
-import big_query_utils
+from . import big_query_utils
import datetime
import json
# This import depends on the automake rule protoc_middleman, please make sure
@@ -255,7 +257,7 @@ def upload_result(result_list, metadata):
if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET,
_TABLE + "$" + _NOW,
[row]):
- print 'Error when uploading result', new_result
+ print('Error when uploading result', new_result)
if __name__ == "__main__":
@@ -280,11 +282,11 @@ if __name__ == "__main__":
parse_go_result(args.go_input_file)
metadata = get_metadata()
- print "uploading cpp results..."
+ print("uploading cpp results...")
upload_result(cpp_result, metadata)
- print "uploading java results..."
+ print("uploading java results...")
upload_result(java_result, metadata)
- print "uploading python results..."
+ print("uploading python results...")
upload_result(python_result, metadata)
- print "uploading go results..."
+ print("uploading go results...")
upload_result(go_result, metadata)
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 4294949f..e3386047 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -33,5 +33,7 @@
<file src="..\src\google\protobuf\timestamp.proto" target="tools\google\protobuf" />
<file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf" />
<file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf" />
+ <file src="Google.Protobuf.Tools.targets" target="buildCrossTargeting" />
+ <file src="Google.Protobuf.Tools.targets" target="build" />
</files>
</package>
diff --git a/csharp/Google.Protobuf.Tools.targets b/csharp/Google.Protobuf.Tools.targets
new file mode 100644
index 00000000..0d0b6725
--- /dev/null
+++ b/csharp/Google.Protobuf.Tools.targets
@@ -0,0 +1,16 @@
+<Project>
+ <PropertyGroup>
+ <protoc_linux64>$(MSBuildThisFileDirectory)..\tools\linux_x64\protoc</protoc_linux64>
+ <protoc_linux86>$(MSBuildThisFileDirectory)..\tools\linux_x86\protoc</protoc_linux86>
+ <protoc_macosx64>$(MSBuildThisFileDirectory)..\tools\macosx_x64\protoc</protoc_macosx64>
+ <protoc_macosx86>$(MSBuildThisFileDirectory)..\tools\macosx_x86\protoc</protoc_macosx86>
+ <protoc_windows64>$(MSBuildThisFileDirectory)..\tools\windows_x64\protoc.exe</protoc_windows64>
+ <protoc_windows86>$(MSBuildThisFileDirectory)..\tools\windows_x86\protoc.exe</protoc_windows86>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(Linux))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X64'">$(protoc_linux64)</protoc>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(Linux))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X86'">$(protoc_linux86)</protoc>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(OSX))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X64'">$(protoc_macosx64)</protoc>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(OSX))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X86'">$(protoc_macosx86)</protoc>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(Windows))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X64'">$(protoc_windows64)</protoc>
+ <protoc Condition="'$([MSBuild]::IsOsPlatform(Windows))' And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)'=='X86'">$(protoc_windows86)</protoc>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index d8282e40..7109ed5b 100755
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -3477,7 +3477,8 @@ void Generator::GenerateFile(const GeneratorOptions& options,
GenerateExtension(options, printer, *it);
}
- if (options.import_style == GeneratorOptions::kImportCommonJs) {
+ // if provided is empty, do not export anything
+ if (options.import_style == GeneratorOptions::kImportCommonJs && !provided.empty()) {
printer->Print("goog.object.extend(exports, $package$);\n",
"package", GetFilePath(options, file));
}
diff --git a/src/google/protobuf/stubs/platform_macros.h b/src/google/protobuf/stubs/platform_macros.h
index c3a64dd2..ff4dea7b 100644
--- a/src/google/protobuf/stubs/platform_macros.h
+++ b/src/google/protobuf/stubs/platform_macros.h
@@ -99,6 +99,7 @@ GOOGLE_PROTOBUF_PLATFORM_ERROR
#if defined(__APPLE__)
#define GOOGLE_PROTOBUF_OS_APPLE
+#include <Availability.h>
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#define GOOGLE_PROTOBUF_OS_IPHONE
@@ -125,4 +126,9 @@ GOOGLE_PROTOBUF_PLATFORM_ERROR
#define GOOGLE_PROTOBUF_NO_THREADLOCAL
#endif
+#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+// __thread keyword requires at least 10.7
+#define GOOGLE_PROTOBUF_NO_THREADLOCAL
+#endif
+
#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_
diff --git a/src/google/protobuf/util/json_util.cc b/src/google/protobuf/util/json_util.cc
index f81a7a30..9ad073d8 100644
--- a/src/google/protobuf/util/json_util.cc
+++ b/src/google/protobuf/util/json_util.cc
@@ -127,7 +127,8 @@ class StatusErrorListener : public converter::ErrorListener {
virtual void InvalidName(const converter::LocationTrackerInterface& loc,
StringPiece unknown_name, StringPiece message) {
status_ = util::Status(util::error::INVALID_ARGUMENT,
- loc.ToString() + ": " + string(message));
+ loc.ToString() + ": invalid name " +
+ string(unknown_name) + ": " + string(message));
}
virtual void InvalidValue(const converter::LocationTrackerInterface& loc,