@@ -12,9 +12,10 @@ 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' )
@@ -74,10 +75,10 @@ def __sync_contrib():
7475
7576 #Download closure compiler
7677 if not os .path .exists (COMPILER_PATH ):
77- print 'Downloading Google Closure Compiler v.20151216'
78+ print 'Downloading Google Closure Compiler v.' + COMPILER_VERSION
7879 try :
7980 __download_and_unzip_from_http (
80- ' http://dl.google.com/closure-compiler/compiler-20151216 .zip' ,
81+ " http://dl.google.com/closure-compiler/compiler-%s .zip" % COMPILER_VERSION ,
8182 'compiler'
8283 )
8384 except StandardError as e :
@@ -152,53 +153,56 @@ def __getNotOptimizedCompilerArgs():
152153def __getOptimizedCompilerArgs ():
153154 compilerArgs = [
154155 '--compilation_level ADVANCED_OPTIMIZATIONS' ,
155- '--warning_level VERBOSE' ,
156156 '--output_wrapper "(function(){%output%})();"' ,
157+ '--assume_function_wrapper' ,
158+ # '--output_manifest',
159+ # '--new_type_inf',
160+ '--env BROWSER' ,
161+ '--warning_level VERBOSE' ,
157162 '--jscomp_warning accessControls' ,
158163 '--jscomp_warning ambiguousFunctionDecl' ,
159- '--jscomp_warning checkDebuggerStatement' ,
160164 '--jscomp_warning checkEventfulObjectDisposal' ,
161165 '--jscomp_warning checkRegExp' ,
162166 '--jscomp_warning checkTypes' ,
163167 '--jscomp_warning checkVars' ,
164- '--jscomp_warning closureDepMethodUsageChecks ' ,
168+ '--jscomp_warning commonJsModuleLoad ' ,
165169 '--jscomp_warning conformanceViolations' ,
166170 '--jscomp_warning const' ,
167171 '--jscomp_warning constantProperty' ,
168172 '--jscomp_warning deprecated' ,
169173 '--jscomp_warning deprecatedAnnotations' ,
170- '--jscomp_warning duplicate' ,
171174 '--jscomp_warning duplicateMessage' ,
172175 '--jscomp_warning es3' ,
173176 '--jscomp_warning es5Strict' ,
174177 '--jscomp_warning externsValidation' ,
175- '--jscomp_warning extraRequire' ,
176178 '--jscomp_warning fileoverviewTags' ,
179+ '--jscomp_warning functionParams' ,
177180 '--jscomp_warning globalThis' ,
178- '--jscomp_warning inferredConstCheck' ,
179181 '--jscomp_warning internetExplorerChecks' ,
180182 '--jscomp_warning invalidCasts' ,
181183 '--jscomp_warning misplacedTypeAnnotation' ,
182184 '--jscomp_warning missingGetCssName' ,
185+ # '--jscomp_warning missingOverride',
186+ '--jscomp_warning missingPolyfill' ,
183187 '--jscomp_warning missingProperties' ,
184188 '--jscomp_warning missingProvide' ,
185189 '--jscomp_warning missingRequire' ,
186190 '--jscomp_warning missingReturn' ,
191+ '--jscomp_warning msgDescriptions' ,
187192 '--jscomp_warning newCheckTypes' ,
188- #'--jscomp_warning msgDescriptionsNewCheckTypes',
189193 '--jscomp_warning nonStandardJsDocs' ,
190- #'--jscomp_warning reportUnknownTypes',
194+ # '--jscomp_warning reportUnknownTypes',
191195 '--jscomp_warning suspiciousCode' ,
192196 '--jscomp_warning strictModuleDepCheck' ,
193- '--jscomp_warning tweakValidation' ,
194197 '--jscomp_warning typeInvalidation' ,
195198 '--jscomp_warning undefinedNames' ,
196199 '--jscomp_warning undefinedVars' ,
197200 '--jscomp_warning unknownDefines' ,
198- #+'--jscomp_warning unnecessaryCasts',
201+ '--jscomp_warning unusedLocalVariables' ,
202+ # '--jscomp_warning unusedPrivateMembers',
199203 '--jscomp_warning uselessCode' ,
200- #+ '--jscomp_warning useOfGoogBase',
201- '--jscomp_warning violatedModuleDep ' ,
204+ # '--jscomp_warning useOfGoogBase',
205+ '--jscomp_warning underscore ' ,
202206 '--jscomp_warning visibility' ,
203207 ]
204208 return compilerArgs
@@ -208,13 +212,14 @@ def __getDefaultCompilerArgs(outputFile):
208212 result = [
209213 'java -jar' ,
210214 COMPILER_PATH ,
211- '--charset UTF-8' ,
212- '--only_closure_dependencies' ,
213215 '--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+ '--js_output_file ' + outputFile ,
219+ '--charset UTF-8' ,
220+ '--dependency_mode=STRICT' ,
221+ '--entry_point acgraph' ,
222+ '--hide_warnings_for="contrib"'
218223 ]
219224 return result
220225
0 commit comments