diff options
author | 2017-04-14 21:16:19 +0200 | |
---|---|---|
committer | 2017-04-14 21:16:19 +0200 | |
commit | 8ff0d0d436b4fd9fd4199d313f708377c7a668af (patch) | |
tree | 1d0060d271adb3d6bac605c2a10768be80e09203 /third_party/protobuf/js/commonjs | |
parent | 5235d06159ba6fee412bee261ea7867d061252b0 (diff) |
Revert "protobuf: Update protobuf to @laszlocsomor's master at commit 421d909."
This reverts commit 5235d06159ba6fee412bee261ea7867d061252b0.
Unfortunately, we noticed several build errors / test failures internally due this
change.
Diffstat (limited to 'third_party/protobuf/js/commonjs')
-rw-r--r-- | third_party/protobuf/js/commonjs/export.js | 31 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/export_asserts.js | 41 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/export_testdeps.js | 23 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/import_test.js | 52 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/jasmine.json | 9 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/rewrite_tests_for_commonjs.js | 97 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/test6/test6.proto | 40 | ||||
-rw-r--r-- | third_party/protobuf/js/commonjs/test7/test7.proto | 42 |
8 files changed, 0 insertions, 335 deletions
diff --git a/third_party/protobuf/js/commonjs/export.js b/third_party/protobuf/js/commonjs/export.js deleted file mode 100644 index a93ee928ff..0000000000 --- a/third_party/protobuf/js/commonjs/export.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @fileoverview Export symbols needed by generated code in CommonJS style. - * - * This effectively is our canonical list of what we publicly export from - * the google-protobuf.js file that we build at distribution time. - */ - -// Include a dummy provide statement so that closurebuilder.py does not skip over this -// file. -goog.provide('jspb.Export'); - -goog.require('goog.object'); -goog.require('jspb.BinaryReader'); -goog.require('jspb.BinaryWriter'); -goog.require('jspb.ExtensionFieldBinaryInfo'); -goog.require('jspb.ExtensionFieldInfo'); -goog.require('jspb.Message'); -goog.require('jspb.Map'); - -exports.Map = jspb.Map; -exports.Message = jspb.Message; -exports.BinaryReader = jspb.BinaryReader; -exports.BinaryWriter = jspb.BinaryWriter; -exports.ExtensionFieldInfo = jspb.ExtensionFieldInfo; -exports.ExtensionFieldBinaryInfo = jspb.ExtensionFieldBinaryInfo; - -// These are used by generated code but should not be used directly by clients. -exports.exportSymbol = goog.exportSymbol; -exports.inherits = goog.inherits; -exports.object = {extend: goog.object.extend}; -exports.typeOf = goog.typeOf; diff --git a/third_party/protobuf/js/commonjs/export_asserts.js b/third_party/protobuf/js/commonjs/export_asserts.js deleted file mode 100644 index ad9446c74a..0000000000 --- a/third_party/protobuf/js/commonjs/export_asserts.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @fileoverview Exports symbols needed only by tests. - * - * This file exports several Closure Library symbols that are only - * used by tests. It is used to generate a file - * closure_asserts_commonjs.js that is only used at testing time. - */ - -// Include a dummy provide statement so that closurebuilder.py does not skip over this -// file. -goog.provide('jspb.ExportAsserts'); - -goog.require('goog.testing.asserts'); - -var global = Function('return this')(); - -// All of the closure "assert" functions are exported at the global level. -// -// The Google Closure assert functions start with assert, eg. -// assertThrows -// assertNotThrows -// assertTrue -// ... -// -// The one exception is the "fail" function. -function shouldExport(str) { - return str.lastIndexOf('assert') === 0 || str == 'fail'; -} - -for (var key in global) { - if ((typeof key == "string") && global.hasOwnProperty(key) && - shouldExport(key)) { - exports[key] = global[key]; - } -} - -// The COMPILED variable is set by Closure compiler to "true" when it compiles -// JavaScript, so in practice this is equivalent to "exports.COMPILED = true". -// This will disable some debugging functionality in debug.js. We could -// investigate whether this can/should be enabled in CommonJS builds. -exports.COMPILED = COMPILED diff --git a/third_party/protobuf/js/commonjs/export_testdeps.js b/third_party/protobuf/js/commonjs/export_testdeps.js deleted file mode 100644 index 6f5cd0839b..0000000000 --- a/third_party/protobuf/js/commonjs/export_testdeps.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @fileoverview Export symbols needed by tests in CommonJS style. - * - * This file is like export.js, but for symbols that are only used by tests. - * However we exclude assert functions here, because they are exported into - * the global namespace, so those are handled as a special case in - * export_asserts.js. - */ - -// Include a dummy provide statement so that closurebuilder.py does not skip over this -// file. -goog.provide('jspb.ExportTestDeps'); - -goog.require('goog.crypt.base64'); -goog.require('jspb.arith.Int64'); -goog.require('jspb.arith.UInt64'); -goog.require('jspb.BinaryEncoder'); -goog.require('jspb.BinaryDecoder'); -goog.require('jspb.BinaryWriter'); -goog.require('jspb.utils'); - -exports.goog = goog; -exports.jspb = jspb; diff --git a/third_party/protobuf/js/commonjs/import_test.js b/third_party/protobuf/js/commonjs/import_test.js deleted file mode 100644 index ffa34fea61..0000000000 --- a/third_party/protobuf/js/commonjs/import_test.js +++ /dev/null @@ -1,52 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2016 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. - -// Test suite is written using Jasmine -- see http://jasmine.github.io/ - - - -var googleProtobuf = require('google-protobuf'); -var asserts = require('closure_asserts_commonjs'); -var global = Function('return this')(); - -// Bring asserts into the global namespace. -googleProtobuf.object.extend(global, asserts); -googleProtobuf.exportSymbol('jspb.Message', googleProtobuf.Message, global); - -var test7_pb = require('./test7/test7_pb'); -googleProtobuf.exportSymbol('proto.jspb.test.framing.FramingMessage', test7_pb.FramingMessage, global); - -describe('Import test suite', function() { - it('testImportedMessage', function() { - var framing1 = new proto.jspb.test.framing.FramingMessage([]); - var framing2 = new proto.jspb.test.framing.FramingMessage([]); - assertObjectEquals(framing1.toObject(), framing2.toObject()); - }); -}); diff --git a/third_party/protobuf/js/commonjs/jasmine.json b/third_party/protobuf/js/commonjs/jasmine.json deleted file mode 100644 index 666b8edbf8..0000000000 --- a/third_party/protobuf/js/commonjs/jasmine.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "spec_dir": "", - "spec_files": [ - "*_test.js", - "binary/proto_test.js" - ], - "helpers": [ - ] -} diff --git a/third_party/protobuf/js/commonjs/rewrite_tests_for_commonjs.js b/third_party/protobuf/js/commonjs/rewrite_tests_for_commonjs.js deleted file mode 100644 index b6d90d287d..0000000000 --- a/third_party/protobuf/js/commonjs/rewrite_tests_for_commonjs.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @fileoverview Utility to translate test files to CommonJS imports. - * - * This is a somewhat hacky tool designed to do one very specific thing. - * All of the test files in *_test.js are written with Closure-style - * imports (goog.require()). This works great for running the tests - * against Closure-style generated code, but we also want to run the - * tests against CommonJS-style generated code without having to fork - * the tests. - * - * Closure-style imports import each individual type by name. This is - * very different than CommonJS imports which are by file. So we put - * special comments in these tests like: - * - * // CommonJS-LoadFromFile: test_pb - * goog.require('proto.jspb.test.CloneExtension'); - * goog.require('proto.jspb.test.Complex'); - * goog.require('proto.jspb.test.DefaultValues'); - * - * This script parses that special comment and uses it to generate proper - * CommonJS require() statements so that the tests can run and pass using - * CommonJS imports. The script will change the above statements into: - * - * var test_pb = require('test_pb'); - * googleProtobuf.exportSymbol('proto.jspb.test.CloneExtension', test_pb.CloneExtension, global); - * googleProtobuf.exportSymbol('proto.jspb.test.Complex', test_pb.Complex, global); - * googleProtobuf.exportSymbol('proto.jspb.test.DefaultValues', test_pb.DefaultValues, global); - * - * (The "exportSymbol" function will define the given names in the global - * namespace, taking care not to overwrite any previous value for - * "proto.jspb.test"). - */ - -var lineReader = require('readline').createInterface({ - input: process.stdin, - output: process.stdout -}); - -function tryStripPrefix(str, prefix) { - if (str.lastIndexOf(prefix) !== 0) { - throw "String: " + str + " didn't start with: " + prefix; - } - return str.substr(prefix.length); -} - -function camelCase(str) { - var ret = ''; - var ucaseNext = false; - for (var i = 0; i < str.length; i++) { - if (str[i] == '-') { - ucaseNext = true; - } else if (ucaseNext) { - ret += str[i].toUpperCase(); - ucaseNext = false; - } else { - ret += str[i]; - } - } - return ret; -} - -var module = null; -var pkg = null; - -// Header: goes in every file at the top. -console.log("var global = Function('return this')();"); -console.log("var googleProtobuf = require('google-protobuf');"); -console.log("var testdeps = require('testdeps_commonjs');"); -console.log("global.goog = testdeps.goog;"); -console.log("global.jspb = testdeps.jspb;"); -console.log("var asserts = require('closure_asserts_commonjs');"); -console.log(""); -console.log("// Bring asserts into the global namespace."); -console.log("googleProtobuf.object.extend(global, asserts);"); - -lineReader.on('line', function(line) { - var isRequire = line.match(/goog\.require\('([^']*)'\)/); - var isLoadFromFile = line.match(/CommonJS-LoadFromFile: (\S*) (.*)/); - var isSetTestOnly = line.match(/goog.setTestOnly()/); - if (isRequire) { - if (module) { // Skip goog.require() lines before the first directive. - var fullSym = isRequire[1]; - var sym = tryStripPrefix(fullSym, pkg); - console.log("googleProtobuf.exportSymbol('" + fullSym + "', " + module + sym + ', global);'); - } - } else if (isLoadFromFile) { - var module_path = isLoadFromFile[1].split('/'); - module = camelCase(module_path[module_path.length - 1]); - pkg = isLoadFromFile[2]; - - if (module != "googleProtobuf") { // We unconditionally require this in the header. - console.log("var " + module + " = require('./" + isLoadFromFile[1] + "');"); - } - } else if (!isSetTestOnly) { // Remove goog.setTestOnly() lines. - console.log(line); - } -}); diff --git a/third_party/protobuf/js/commonjs/test6/test6.proto b/third_party/protobuf/js/commonjs/test6/test6.proto deleted file mode 100644 index a060925f2d..0000000000 --- a/third_party/protobuf/js/commonjs/test6/test6.proto +++ /dev/null @@ -1,40 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2016 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. - -syntax = "proto3"; - -option java_package = "com.google.apps.jspb.proto"; -option java_multiple_files = true; - -package jspb.test.importing; - -message ImportedMessage { - string string_value = 1; -} diff --git a/third_party/protobuf/js/commonjs/test7/test7.proto b/third_party/protobuf/js/commonjs/test7/test7.proto deleted file mode 100644 index f5574a3dd3..0000000000 --- a/third_party/protobuf/js/commonjs/test7/test7.proto +++ /dev/null @@ -1,42 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2016 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. - -syntax = "proto3"; - -option java_package = "com.google.apps.jspb.proto"; -option java_multiple_files = true; - -package jspb.test.framing; - -import "test6/test6.proto"; - -message FramingMessage { - jspb.test.importing.ImportedMessage imported_message = 1; -} |