diff --git a/tests/runner.py b/tests/runner.py index 034b5c8d5806d..b7aa8e38a75af 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -450,8 +450,11 @@ def setUp(self): self.working_dir = tempfile.mkdtemp(prefix='emscripten_test_' + self.__class__.__name__ + '_', dir=self.temp_dir) os.chdir(self.working_dir) - # Use emscripten root for node module lookup - os.environ['NODE_PATH'] = path_from_root('node_modules') + # Include emscripten root for node module lookup (NODE_PATH may have other entries) + if len(os.environ['NODE_PATH']) > 0: + os.environ['NODE_PATH'] = os.environ['NODE_PATH'] + os.pathsep + path_from_root('node_modules') + else: + os.environ['NODE_PATH'] = path_from_root('node_modules') if not self.save_dir: self.has_prev_ll = False diff --git a/tests/test_sanity.py b/tests/test_sanity.py index 13c6280594172..459c8024b47e0 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -233,34 +233,6 @@ def make_executable(name): elif 'runner.py' not in ' '.join(command): self.assertContained('ERROR', output) # sanity check should fail - def test_closure_compiler(self): - CLOSURE_FATAL = 'fatal: closure compiler' - CLOSURE_WARNING = 'does not exist' - - # Sanity check should find closure - restore_and_set_up() - output = self.check_working(EMCC) - self.assertNotContained(CLOSURE_FATAL, output) - self.assertNotContained(CLOSURE_WARNING, output) - - # Append a bad path for closure, will warn - f = open(CONFIG_FILE, 'a') - f.write('CLOSURE_COMPILER = "/tmp/nowhere/nothingtoseehere/kjadsfkjwelkjsdfkqgas/nonexistent.txt"\n') - f.close() - output = self.check_working(EMCC, CLOSURE_WARNING) - - # And if you actually try to use the bad path, will be fatal - f = open(CONFIG_FILE, 'a') - f.write('CLOSURE_COMPILER = "/tmp/nowhere/nothingtoseehere/kjadsfkjwelkjsdfkqgas/nonexistent.txt"\n') - f.close() - output = self.check_working([EMCC, '-s', '--closure', '1'] + MINIMAL_HELLO_WORLD + ['-O2'], CLOSURE_FATAL) - - # With a working path, all is well - restore_and_set_up() - try_delete('a.out.js') - output = self.check_working([EMCC, '-s', '--closure', '1'] + MINIMAL_HELLO_WORLD + ['-O2'], '') - self.assertExists('a.out.js', output) - def test_llvm(self): LLVM_WARNING = 'LLVM version appears incorrect' diff --git a/third_party/closure-compiler/LICENSE b/third_party/closure-compiler/LICENSE deleted file mode 100644 index d645695673349..0000000000000 --- a/third_party/closure-compiler/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/third_party/closure-compiler/README.md b/third_party/closure-compiler/README.md deleted file mode 100644 index 923424a7fc808..0000000000000 --- a/third_party/closure-compiler/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# google-closure-compiler-java - -Java platform distribution of Closure Compiler. - -For cli scripts, build tool plugins and more see the [main distribution](https://www.npmjs.com/package/google-closure-compiler). diff --git a/third_party/closure-compiler/browser-externs/fileapi_synchronous.js b/third_party/closure-compiler/browser-externs/fileapi_synchronous.js deleted file mode 100644 index d1239680a23d2..0000000000000 --- a/third_party/closure-compiler/browser-externs/fileapi_synchronous.js +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright 2012 The Closure Compiler Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @fileoverview Definitions for objects in the synchronous File API, File - * Writer API, and File System API. Details of the API are at: - * http://www.w3.org/TR/FileAPI/ - * http://www.w3.org/TR/file-writer-api/ - * http://www.w3.org/TR/file-system-api/ - * - * @externs - * @author dpapad@google.com (Demetrios Papadopoulos) - */ - - -/** - * @see http://www.w3.org/TR/file-writer-api/#idl-def-FileWriterSync - * @constructor - */ -function FileWriterSync() {} - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-position - * @type {number} - * @const - */ -FileWriterSync.prototype.position; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-length - * @type {number} - * @const - */ -FileWriterSync.prototype.length; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriter-write - * @param {!Blob} blob - * @return {undefined} - */ -FileWriterSync.prototype.write = function(blob) {}; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-seek - * @param {number} offset - * @return {undefined} - */ -FileWriterSync.prototype.seek = function(offset) {}; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-truncate - * @param {number} size - * @return {undefined} - */ -FileWriterSync.prototype.truncate = function(size) {}; - -/** - * @see http://www.w3.org/TR/FileAPI/#FileReaderSyncSync - * @constructor - */ -function FileReaderSync() {} - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-readAsArrayBufferSync - * @param {!Blob} blob - * @return {!ArrayBuffer} - */ -FileReaderSync.prototype.readAsArrayBuffer = function(blob) {}; - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-readAsBinaryStringSync - * @param {!Blob} blob - * @return {string} - */ -FileReaderSync.prototype.readAsBinaryString = function(blob) {}; - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-readAsTextSync - * @param {!Blob} blob - * @param {string=} encoding - * @return {string} - */ -FileReaderSync.prototype.readAsText = function(blob, encoding) {}; - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-readAsDataURLSync - * @param {!Blob} blob - * @return {string} - */ -FileReaderSync.prototype.readAsDataURL = function(blob) {}; - -/** - * LocalFileSystemSync interface, implemented by WorkerGlobalScope. - * @see http://www.w3.org/TR/file-system-api/#idl-def-LocalFileSystemSync - * @constructor - */ -function LocalFileSystemSync() {} - -/** - * @see http://www.w3.org/TR/file-system-api/ - * #the-synchronous-filesystem-interface - * @constructor - */ -function FileSystemSync() {} - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileSystemSync-name - * @type {string} - * @const - */ -FileSystemSync.prototype.name; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileSystemSync-root - * @type {!DirectoryEntrySync} - * @const - */ -FileSystemSync.prototype.root; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-LocalFileSystemSync-requestFileSystemSync-FileSystemSync-unsigned-short-type-unsigned-long-long-size - * @param {number} type - * @param {number} size - * @return {!FileSystemSync} - */ -function requestFileSystemSync(type, size) {} - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-LocalFileSystemSync-requestFileSystemSync-FileSystemSync-unsigned-short-type-unsigned-long-long-size - * @param {number} type - * @param {number} size - * @return {!FileSystemSync} - */ -function webkitRequestFileSystemSync(type, size) {} - -/** - * @see http://www.w3.org/TR/file-system-api/#the-entrysync-interface - * @constructor - */ -function EntrySync() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-isFile - * @type {boolean} - * @const - */ -EntrySync.prototype.isFile; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-isDirectory - * @type {boolean} - * @const - */ -EntrySync.prototype.isDirectory; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-name - * @type {string} - * @const - */ -EntrySync.prototype.name; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-fullPath - * @type {string} - * @const - */ -EntrySync.prototype.fullPath; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-filesystem - * @type {!FileSystemSync} - * @const - */ -EntrySync.prototype.filesystem; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-moveTo - * @param {!DirectoryEntrySync} parent - * @param {string=} newName - * @return {!EntrySync} - */ -EntrySync.prototype.moveTo = function(parent, newName) {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-copyTo - * @param {!DirectoryEntrySync} parent - * @param {string=} newName - * @return {!EntrySync} - */ -EntrySync.prototype.copyTo = function(parent, newName) {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-toURL - * @param {string=} mimeType - * @return {string} - */ -EntrySync.prototype.toURL = function(mimeType) {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-remove - * @return {undefined} - */ -EntrySync.prototype.remove = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-getMetadata - * @return {!Metadata} - */ -EntrySync.prototype.getMetadata = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-getParent - * @return {!DirectoryEntrySync} - */ -EntrySync.prototype.getParent = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#the-directoryentrysync-interface - * @constructor - * @extends {EntrySync} - */ -function DirectoryEntrySync() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-createReader - * @return {!DirectoryReaderSync} - */ -DirectoryEntrySync.prototype.createReader = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-getFile - * @param {string} path - * @param {Object=} options - * @return {!FileEntrySync} - */ -DirectoryEntrySync.prototype.getFile = function(path, options) {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-getDirectory - * @param {string} path - * @param {Object=} options - * @return {!DirectoryEntrySync} - */ -DirectoryEntrySync.prototype.getDirectory = function(path, options) {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-removeRecursively - * @return {undefined} - */ -DirectoryEntrySync.prototype.removeRecursively = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#the-directoryreadersync-interface - * @constructor - */ -function DirectoryReaderSync() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryReaderSync-readEntries - * @return {!Array} - */ -DirectoryReaderSync.prototype.readEntries = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#the-fileentrysync-interface - * @constructor - * @extends {EntrySync} - */ -function FileEntrySync() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileEntrySync-createWriter - * @return {!FileWriterSync} - */ -FileEntrySync.prototype.createWriter = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileEntrySync-file - * @return {!File} - */ -FileEntrySync.prototype.file = function() {}; - -/** - * @see http://www.w3.org/TR/file-system-api/#the-fileexception-exception - * @constructor - */ -function FileException() {} - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-NOT_FOUND_ERR - * @type {number} - */ -FileException.prototype.NOT_FOUND_ERR = 1; - -/** @type {number} */ -FileException.NOT_FOUND_ERR = 1; - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-SECURITY_ERR - * @type {number} - */ -FileException.prototype.SECURITY_ERR = 2; - -/** @type {number} */ -FileException.SECURITY_ERR = 2; - -/** - * @see http://www.w3.org/TR/FileAPI/#widl-FileException-ABORT_ERR - * @type {number} - */ -FileException.prototype.ABORT_ERR = 3; - -/** @type {number} */ -FileException.ABORT_ERR = 3; - -/** - * @see http://www.w3.org/TR/FileAPI/#widl-FileException-NOT_READABLE_ERR - * @type {number} - */ -FileException.prototype.NOT_READABLE_ERR = 4; - -/** @type {number} */ -FileException.NOT_READABLE_ERR = 4; - -/** - * @see http://www.w3.org/TR/FileAPI/#widl-FileException-ENCODING_ERR - * @type {number} - */ -FileException.prototype.ENCODING_ERR = 5; - -/** @type {number} */ -FileException.ENCODING_ERR = 5; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-NO_MODIFICATION_ALLOWED_ERR - * @type {number} - */ -FileException.prototype.NO_MODIFICATION_ALLOWED_ERR = 6; - -/** @type {number} */ -FileException.NO_MODIFICATION_ALLOWED_ERR = 6; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-INVALID_STATE_ERR - * @type {number} - */ -FileException.prototype.INVALID_STATE_ERR = 7; - -/** @type {number} */ -FileException.INVALID_STATE_ERR = 7; - -/** - * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-SYNTAX_ERR - * @type {number} - */ -FileException.prototype.SYNTAX_ERR = 8; - -/** @type {number} */ -FileException.SYNTAX_ERR = 8; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileException-INVALID_MODIFICATION_ERR - * @type {number} - */ -FileException.prototype.INVALID_MODIFICATION_ERR = 9; - -/** @type {number} */ -FileException.INVALID_MODIFICATION_ERR = 9; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileException-QUOTA_EXCEEDED_ERR - * @type {number} - */ -FileException.prototype.QUOTA_EXCEEDED_ERR = 10; - -/** @type {number} */ -FileException.QUOTA_EXCEEDED_ERR = 10; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileException-TYPE_MISMATCH_ERR - * @type {number} - */ -FileException.prototype.TYPE_MISMATCH_ERR = 11; - -/** @type {number} */ -FileException.TYPE_MISMATCH_ERR = 11; - -/** - * @see http://www.w3.org/TR/file-system-api/#widl-FileException-PATH_EXISTS_ERR - * @type {number} - */ -FileException.prototype.PATH_EXISTS_ERR = 12; - -/** @type {number} */ -FileException.PATH_EXISTS_ERR = 12; - -/** - * @see http://www.w3.org/TR/FileAPI/#dfn-code-exception - * @type {number} - */ -FileException.prototype.code; diff --git a/third_party/closure-compiler/compiler.jar b/third_party/closure-compiler/compiler.jar deleted file mode 100644 index f754174888eba..0000000000000 Binary files a/third_party/closure-compiler/compiler.jar and /dev/null differ diff --git a/third_party/closure-compiler/index.js b/third_party/closure-compiler/index.js deleted file mode 100644 index bb8d6c9e638bb..0000000000000 --- a/third_party/closure-compiler/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2018 The Closure Compiler Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -module.exports = require.resolve('./compiler.jar'); diff --git a/third_party/closure-compiler/package.json b/third_party/closure-compiler/package.json deleted file mode 100644 index e45c5b7a7fc04..0000000000000 --- a/third_party/closure-compiler/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_from": "google-closure-compiler-java", - "_id": "google-closure-compiler-java@20190106.0.0", - "_inBundle": false, - "_integrity": "sha512-M/mrssfSTY7CQLzW9Zc1voGHvPCxMG2MK7Y1USY9/oBHBVzYRxDac3k0icjpglPu9/uIDw4BwpKTrGYfvv3O1Q==", - "_location": "/google-closure-compiler-java", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "google-closure-compiler-java", - "name": "google-closure-compiler-java", - "escapedName": "google-closure-compiler-java", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190106.0.0.tgz", - "_shasum": "10b89c17901bece749bc6f7f5ea5cfdedb0374ff", - "_spec": "google-closure-compiler-java", - "_where": "C:\\code\\emsdk\\emscripten\\incoming", - "author": { - "name": "Chad Killingsworth", - "email": "chadkillingsworth@gmail.com" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Check, compile, optimize and compress Javascript with Closure-Compiler using Java", - "files": [ - "compiler.jar", - "index.js", - "package.json", - "readme.md" - ], - "gitHead": "9187e0ebd3baf93635363bc09a32931499bba8f2", - "homepage": "https://developers.google.com/closure/compiler/", - "keywords": [ - "javascript", - "compiler", - "optimizer", - "minifier", - "closure", - "java" - ], - "license": "Apache-2.0", - "main": "index.js", - "name": "google-closure-compiler-java", - "repository": { - "type": "git", - "url": "https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler-java" - }, - "scripts": { - "build": "echo \"google-closure-compiler-java build\"", - "test": "./test.js" - }, - "version": "20190106.0.0" -} diff --git a/tools/settings_template.py b/tools/settings_template.py index 0af6b9d7cd1b9..aa102d19a13cc 100644 --- a/tools/settings_template.py +++ b/tools/settings_template.py @@ -33,7 +33,10 @@ JAVA = 'java' # executable -# CLOSURE_COMPILER = '..' # define this to not use the bundled version +# To install Closure compiler, either +# a) install via emsdk with "emsdk install closure-compiler-20191111-64bit" (check if there is an updated version with emsdk list) +# or b) install via npm with "npm install -g google-closure-compiler@20191111.0.0" (or just npm install -g google-closure-compiler to get a newer version) +CLOSURE_COMPILER = 'google-closure-compiler' + ('.cmd' if os.name == 'nt' else '') ################################################################################ # diff --git a/tools/shared.py b/tools/shared.py index 6e1c387e0f01a..522d09b4314c8 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -380,9 +380,6 @@ def parse_config_file(): if not JS_ENGINES: JS_ENGINES = [NODE_JS] - if CLOSURE_COMPILER is None: - CLOSURE_COMPILER = path_from_root('third_party', 'closure-compiler', 'compiler.jar') - if JAVA is None: logger.debug('JAVA not defined in ' + hint_config_file_location() + ', using "java"') JAVA = 'java' @@ -530,15 +527,22 @@ def check_node_version(): def check_closure_compiler(): - try: - run_process([JAVA, '-version'], stdout=PIPE, stderr=PIPE) - except Exception: - warning('java does not seem to exist, required for closure compiler, which is optional (define JAVA in ' + hint_config_file_location() + ' if you want it)') - return False if not os.path.exists(CLOSURE_COMPILER): warning('Closure compiler (%s) does not exist, check the paths in %s', CLOSURE_COMPILER, EM_CONFIG) return False - return True + try: + proc = subprocess.Popen([CLOSURE_COMPILER, '--version'], stdout=PIPE, stderr=PIPE) + output = proc.communicate() + if 'Closure Compiler (http://github.com/google/closure-compiler)' in output[0]: + return True + + warning('Unrecognized Closure compiler --version output:') + warning(output[0]) + warning(output[1]) + except Exception as e: + warning('Closure compiler ("%s --version") did not execute properly!' % CLOSURE_COMPILER) + warning(e) + return False def get_emscripten_version(path): @@ -581,11 +585,6 @@ def perform_sanify_checks(): if not os.path.exists(cmd) and not os.path.exists(cmd + '.exe'): # .exe extension required for Windows exit_with_error('Cannot find %s, check the paths in %s', cmd, EM_CONFIG) - # Sanity check passed! - with ToolchainProfiler.profile_block('sanity closure compiler'): - if not check_closure_compiler(): - warning('closure compiler will not be available') - def check_sanity(force=False): """Check that basic stuff we need (a JS engine to compile, Node.js, and Clang @@ -2427,8 +2426,8 @@ def calculate_reachable_functions(infile, initial_list, can_reach=True): def closure_compiler(filename, pretty=True, advanced=True, extra_closure_args=[]): with ToolchainProfiler.profile_block('closure_compiler'): if not check_closure_compiler(): - logger.error('Cannot run closure compiler') - raise Exception('closure compiler check failed') + logger.error('google-closure-compiler executable was not found: Cannot run closure compiler') + raise Exception('closure compiler lookup failed') # Closure annotations file contains suppressions and annotations to different symbols CLOSURE_ANNOTATIONS = [path_from_root('src', 'closure-annotations.js')] @@ -2472,20 +2471,24 @@ def closure_compiler(filename, pretty=True, advanced=True, extra_closure_args=[] # Web environment specific externs if Settings.target_environment_may_be('web') or Settings.target_environment_may_be('worker'): - BROWSER_EXTERNS_BASE = path_from_root('third_party', 'closure-compiler', 'browser-externs') - BROWSER_EXTERNS = os.listdir(BROWSER_EXTERNS_BASE) - BROWSER_EXTERNS = [os.path.join(BROWSER_EXTERNS_BASE, name) for name in BROWSER_EXTERNS - if name.endswith('.js')] - CLOSURE_EXTERNS += BROWSER_EXTERNS - - # Something like this (adjust memory as needed): - # java -Xmx1024m -jar CLOSURE_COMPILER --compilation_level ADVANCED_OPTIMIZATIONS --variable_map_output_file src.cpp.o.js.vars --js src.cpp.o.js --js_output_file src.cpp.o.cc.js + try: + BROWSER_EXTERNS_BASE = path_from_root('third_party', 'closure-compiler', 'browser-externs') + BROWSER_EXTERNS = os.listdir(BROWSER_EXTERNS_BASE) + BROWSER_EXTERNS = [os.path.join(BROWSER_EXTERNS_BASE, name) for name in BROWSER_EXTERNS + if name.endswith('.js')] + CLOSURE_EXTERNS += BROWSER_EXTERNS + except Exception: + # Currently we do not actually have any browser-externs files, so above will throw as + # git does not keep empty directories in repositories. But in future we are likely to add + # some, so keep this code around. + logger.debug('No browser-externs files found') + pass + outfile = filename + '.cc.js' - args = [JAVA, - '-Xmx' + (os.environ.get('JAVA_HEAP_SIZE') or '1024m'), # if you need a larger Java heap, use this environment variable - '-jar', CLOSURE_COMPILER, - '--compilation_level', 'ADVANCED_OPTIMIZATIONS' if advanced else 'SIMPLE_OPTIMIZATIONS', - '--language_in', 'ECMASCRIPT5'] + + args = [CLOSURE_COMPILER] + args += ['--compilation_level', 'ADVANCED_OPTIMIZATIONS' if advanced else 'SIMPLE_OPTIMIZATIONS', + '--language_in', 'ECMASCRIPT5'] for a in CLOSURE_ANNOTATIONS: args += ['--js', a] for e in CLOSURE_EXTERNS: