MCPcopy Index your code
hub / github.com/ampproject/amphtml / CompileWithClosure

Function CompileWithClosure

validator/build.py:264–290  ·  view source on GitHub ↗

Compiles the arguments with AMP's Closure compiler for transpilation to ES5. Args: js_files: list of files to compile definitions: list of definitions flags to closure compiler entry_points: entry points (these won't be minimized) output_file: name of the Javascript output file

(js_files, definitions, entry_points, output_file)

Source from the content-addressed store, hash-verified

262
263
264def CompileWithClosure(js_files, definitions, entry_points, output_file):
265 """Compiles the arguments with AMP's Closure compiler for transpilation to ES5.
266
267 Args:
268 js_files: list of files to compile
269 definitions: list of definitions flags to closure compiler
270 entry_points: entry points (these won't be minimized)
271 output_file: name of the Javascript output file
272 """
273
274 cmd = [
275 'java', '-jar',
276 './node_modules/google-closure-compiler-java/compiler.jar',
277 '--language_out=ES5_STRICT', '--dependency_mode=PRUNE',
278 '--js_output_file=%s' % output_file
279 ]
280 cmd += ['--entry_point=%s' % e for e in entry_points]
281 cmd += ['--output_manifest=%s' % ('%s.manifest' % output_file)]
282 cmd += [
283 '../node_modules/google-closure-library/closure/**.js',
284 '!../node_modules/google-closure-library/closure/**_test.js',
285 '../node_modules/google-closure-library/third_party/closure/**.js',
286 '!../node_modules/google-closure-library/third_party/closure/**_test.js'
287 ]
288 cmd += js_files
289 cmd += definitions
290 subprocess.check_call(cmd)
291
292
293def CompileValidatorMinified(out_dir):

Calls

no outgoing calls

Tested by

no test coverage detected