@@ -12,17 +12,17 @@ import time
1212#=======================================================================================================================
1313# Project paths
1414#=======================================================================================================================
15+ COMPILER_VERSION = '20161024'
1516PROJECT_PATH = os .path .abspath (os .path .dirname (__file__ ))
1617CONTRIB_PATH = os .path .join (PROJECT_PATH , 'contrib' )
17- COMPILER_PATH = os .path .join (CONTRIB_PATH , 'compiler' , 'compiler.jar' )
18+ COMPILER_PATH = os .path .join (CONTRIB_PATH , 'compiler' , 'closure- compiler-v%s .jar' % COMPILER_VERSION )
1819SRC_PATH = os .path .join (PROJECT_PATH , 'src' )
1920OUT_PATH = os .path .join (PROJECT_PATH , 'out' )
2021CLOSURE_LIBRARY_PATH = os .path .join (CONTRIB_PATH , 'closure-library' )
2122CLOSURE_SOURCE_PATH = os .path .join (CLOSURE_LIBRARY_PATH , 'closure' , 'goog' )
2223CLOSURE_LINTER_WRAPPER_PATH = os .path .join (CONTRIB_PATH , 'closure-linter-wrapper' )
2324CLOSURE_BIN_PATH = os .path .join (CLOSURE_LIBRARY_PATH , 'closure' , 'bin' )
2425DEPS_WRITER_PATH = os .path .join (CLOSURE_BIN_PATH , 'build' , 'depswriter.py' )
25- EXTERNS_PATH = os .path .join (PROJECT_PATH , 'externs.js' )
2626
2727PYTHON = 'python'
2828if not (platform .system () == 'Windows' ):
@@ -74,10 +74,10 @@ def __sync_contrib():
7474
7575 #Download closure compiler
7676 if not os .path .exists (COMPILER_PATH ):
77- print 'Downloading Google Closure Compiler v.20151216'
77+ print 'Downloading Google Closure Compiler v.' + COMPILER_VERSION
7878 try :
7979 __download_and_unzip_from_http (
80- ' http://dl.google.com/closure-compiler/compiler-20151216 .zip' ,
80+ " http://dl.google.com/closure-compiler/compiler-%s .zip" % COMPILER_VERSION ,
8181 'compiler'
8282 )
8383 except StandardError as e :
@@ -151,54 +151,59 @@ def __getNotOptimizedCompilerArgs():
151151
152152def __getOptimizedCompilerArgs ():
153153 compilerArgs = [
154+ # '--variable_renaming_report out/vars.txt',
155+ # '--property_renaming_report out/props.txt',
156+ # '--output_manifest out/involved.txt',
154157 '--compilation_level ADVANCED_OPTIMIZATIONS' ,
155- '--warning_level VERBOSE' ,
156158 '--output_wrapper "(function(){%output%})();"' ,
159+ '--assume_function_wrapper' ,
160+ # '--new_type_inf',
161+ '--env BROWSER' ,
162+ '--warning_level VERBOSE' ,
157163 '--jscomp_warning accessControls' ,
158164 '--jscomp_warning ambiguousFunctionDecl' ,
159- '--jscomp_warning checkDebuggerStatement' ,
160165 '--jscomp_warning checkEventfulObjectDisposal' ,
161166 '--jscomp_warning checkRegExp' ,
162167 '--jscomp_warning checkTypes' ,
163168 '--jscomp_warning checkVars' ,
164- '--jscomp_warning closureDepMethodUsageChecks ' ,
169+ '--jscomp_warning commonJsModuleLoad ' ,
165170 '--jscomp_warning conformanceViolations' ,
166171 '--jscomp_warning const' ,
167172 '--jscomp_warning constantProperty' ,
168173 '--jscomp_warning deprecated' ,
169174 '--jscomp_warning deprecatedAnnotations' ,
170- '--jscomp_warning duplicate' ,
171175 '--jscomp_warning duplicateMessage' ,
172176 '--jscomp_warning es3' ,
173177 '--jscomp_warning es5Strict' ,
174- '--jscomp_warning externsValidation' ,
175- '--jscomp_warning extraRequire' ,
178+ #'--jscomp_warning externsValidation',
176179 '--jscomp_warning fileoverviewTags' ,
180+ '--jscomp_warning functionParams' ,
177181 '--jscomp_warning globalThis' ,
178- '--jscomp_warning inferredConstCheck' ,
179182 '--jscomp_warning internetExplorerChecks' ,
180183 '--jscomp_warning invalidCasts' ,
181184 '--jscomp_warning misplacedTypeAnnotation' ,
182185 '--jscomp_warning missingGetCssName' ,
186+ # '--jscomp_warning missingOverride',
187+ '--jscomp_warning missingPolyfill' ,
183188 '--jscomp_warning missingProperties' ,
184189 '--jscomp_warning missingProvide' ,
185190 '--jscomp_warning missingRequire' ,
186191 '--jscomp_warning missingReturn' ,
192+ '--jscomp_warning msgDescriptions' ,
187193 '--jscomp_warning newCheckTypes' ,
188- #'--jscomp_warning msgDescriptionsNewCheckTypes',
189194 '--jscomp_warning nonStandardJsDocs' ,
190- #'--jscomp_warning reportUnknownTypes',
195+ # '--jscomp_warning reportUnknownTypes',
191196 '--jscomp_warning suspiciousCode' ,
192197 '--jscomp_warning strictModuleDepCheck' ,
193- '--jscomp_warning tweakValidation' ,
194198 '--jscomp_warning typeInvalidation' ,
195199 '--jscomp_warning undefinedNames' ,
196200 '--jscomp_warning undefinedVars' ,
197201 '--jscomp_warning unknownDefines' ,
198- #+'--jscomp_warning unnecessaryCasts',
202+ '--jscomp_warning unusedLocalVariables' ,
203+ # '--jscomp_warning unusedPrivateMembers',
199204 '--jscomp_warning uselessCode' ,
200- #+ '--jscomp_warning useOfGoogBase',
201- '--jscomp_warning violatedModuleDep ' ,
205+ # '--jscomp_warning useOfGoogBase',
206+ '--jscomp_warning underscore ' ,
202207 '--jscomp_warning visibility' ,
203208 ]
204209 return compilerArgs
@@ -208,13 +213,15 @@ def __getDefaultCompilerArgs(outputFile):
208213 result = [
209214 'java -jar' ,
210215 COMPILER_PATH ,
211- '--charset UTF-8' ,
212- '--only_closure_dependencies' ,
213- '--externs ' + EXTERNS_PATH ,
214216 '--js="%s"' % os .path .join (SRC_PATH , '**.js' ),
215217 '--js="%s"' % os .path .join (CLOSURE_LIBRARY_PATH , '**.js' ),
216- '--closure_entry_point acgraph' ,
217- '--js_output_file ' + outputFile
218+ '--define "goog.DEBUG=false"' ,
219+ '--js_output_file ' + outputFile ,
220+ '--language_in ECMASCRIPT3' ,
221+ '--charset UTF-8' ,
222+ '--dependency_mode=STRICT' ,
223+ '--entry_point acgraph' ,
224+ '--hide_warnings_for="goog"'
218225 ]
219226 return result
220227
0 commit comments