From 8f0cd82b892b10bb5b71f054656702356a0298e7 Mon Sep 17 00:00:00 2001 From: Jos van den Oever Date: Mon, 18 Jul 2016 15:27:15 +0200 Subject: [PATCH] Upgrade to latest Closure Compiler --- CMakeLists.txt | 6 +++--- webodf/CMakeLists.txt | 9 +++++++-- webodf/tests/odf/OdfContainerTests.js | 3 ++- webodf/tools/externs.js | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f811fb44..54a56fe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,13 +96,13 @@ MESSAGE ( STATUS "external downloads will be stored/expected in: ${EXTERNALS_DOW ExternalProject_Add( ClosureCompiler DOWNLOAD_DIR ${EXTERNALS_DOWNLOAD_DIR} - URL "http://dl.google.com/closure-compiler/compiler-20160713.tar.gz" - URL_MD5 5e29d367d8310d568ada6b8df1260bab + URL "http://dl.google.com/closure-compiler/compiler-20160911.tar.gz" + URL_MD5 7e85253436e492aa580ce3c3b8f585e7 CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" ) -set(CLOSURE_JAR ${CMAKE_BINARY_DIR}/ClosureCompiler-prefix/src/ClosureCompiler/closure-compiler-v20160713.jar) +set(CLOSURE_JAR ${CMAKE_BINARY_DIR}/ClosureCompiler-prefix/src/ClosureCompiler/closure-compiler-v20160911.jar) # Rhino ExternalProject_Add( diff --git a/webodf/CMakeLists.txt b/webodf/CMakeLists.txt index 828dc653..a3deff67 100644 --- a/webodf/CMakeLists.txt +++ b/webodf/CMakeLists.txt @@ -99,6 +99,11 @@ add_custom_target(webodf.css.js-target DEPENDS webodf.css.js) # Windows has a command-line limit of around 8,000 chars, so files to be compiled are supplied to CC using the --flagfile # option to help keep the length of the compilation command as small as possible. SET(CLOSURE_ERROR_OPTION_LIST + "--language_in ECMASCRIPT3" + "--language_out ECMASCRIPT3" + "--use_types_for_optimization" + # "--new_type_inf" + "--hide_warnings_for=synthetic" "--jscomp_error accessControls" "--jscomp_error ambiguousFunctionDecl" "--jscomp_error checkEventfulObjectDisposal" @@ -122,11 +127,11 @@ SET(CLOSURE_ERROR_OPTION_LIST "--jscomp_error missingGetCssName" "--jscomp_error missingProperties" "--jscomp_error missingProvide" - "--jscomp_off missingRequire" + "--jscomp_off missingRequire" "--jscomp_error missingReturn" "--jscomp_error msgDescriptions" "--jscomp_error newCheckTypes" - "--jscomp_off nonStandardJsDocs" + "--jscomp_off nonStandardJsDocs" "--jscomp_error strictModuleDepCheck" "--jscomp_error suspiciousCode" "--jscomp_error typeInvalidation" diff --git a/webodf/tests/odf/OdfContainerTests.js b/webodf/tests/odf/OdfContainerTests.js index c14a3318..a457839d 100644 --- a/webodf/tests/odf/OdfContainerTests.js +++ b/webodf/tests/odf/OdfContainerTests.js @@ -159,7 +159,8 @@ odf.OdfContainerTests = function OdfContainerTests(runner) { * correctly. */ function checkMimeType(t, path, callback) { - runtime.readFile(path, "binary", function (err, bytes) { + runtime.readFile(path, "binary", function (err, bytes_array) { + var bytes = /**@type{!Uint8Array}*/(bytes_array); t.err = err; r.shouldBeNull(t, "t.err"); t.mimetype = runtime.byteArrayToString(bytes.subarray(30, 73), "utf8"); diff --git a/webodf/tools/externs.js b/webodf/tools/externs.js index 745af3a5..1dc9abe1 100644 --- a/webodf/tools/externs.js +++ b/webodf/tools/externs.js @@ -202,6 +202,20 @@ function readFile(path, encoding) {"use strict"; } * @return {undefined} */ function quit(exitCode) {"use strict"; } +/** + * @typedef {!Object} + */ +Packages.java; +/** + * @typedef {!Object} + */ +Packages.java.io; +/** + * @constructor + * @extends Packages.java.io.Reader + * @param {!string} path + */ +Packages.java.io.FileReader = function (path) {"use strict"; }; /** * @typedef {!Object} */