thestig | c8cf02a2 | 2015-05-21 23:22:20 | [diff] [blame] | 1 | # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | # This file should be identical to js_compile.gypi except it passes jscomp_error |
| 6 | # flags to the compiler. One should prefer this over js_compile.gypi once the |
| 7 | # JS code being compiled are error free. |
| 8 | # |
| 9 | # This file should be eventually deprecated in favor of |
| 10 | # third_party/closure_compiler/compile_js.gypi once they have the same set of |
| 11 | # jscomp_error flags enabled. See http://crbug.com/487804 |
| 12 | { |
| 13 | 'variables': { |
| 14 | 'closure_compiler_path': '<(DEPTH)/third_party/closure_compiler/compiler/compiler.jar', |
| 15 | 'compile_javascript%': 1, |
| 16 | }, |
| 17 | 'conditions': [ |
| 18 | ['compile_javascript==1', { |
| 19 | 'rules': [ |
| 20 | { |
| 21 | 'rule_name': 'jscompilation', |
| 22 | 'extension': 'js', |
| 23 | 'inputs': [ |
| 24 | '<(closure_compiler_path)', |
| 25 | ], |
| 26 | 'outputs': [ |
| 27 | '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME)', |
| 28 | ], |
| 29 | 'action': [ |
| 30 | 'java', |
| 31 | '-jar', |
| 32 | '<(closure_compiler_path)', |
| 33 | '--compilation_level', |
| 34 | 'SIMPLE_OPTIMIZATIONS', |
| 35 | '--jscomp_error=accessControls', |
| 36 | '--jscomp_error=ambiguousFunctionDecl', |
thestig | c8cf02a2 | 2015-05-21 23:22:20 | [diff] [blame] | 37 | # '--jscomp_error=checkTypes', |
| 38 | # '--jscomp_error=checkVars', |
| 39 | '--jscomp_error=constantProperty', |
| 40 | '--jscomp_error=deprecated', |
| 41 | '--jscomp_error=externsValidation', |
| 42 | '--jscomp_error=globalThis', |
| 43 | '--jscomp_error=invalidCasts', |
| 44 | # '--jscomp_error=missingProperties', |
| 45 | # '--jscomp_error=missingReturn', |
| 46 | '--jscomp_error=nonStandardJsDocs', |
| 47 | '--jscomp_error=suspiciousCode', |
| 48 | '--jscomp_error=undefinedNames', |
| 49 | # '--jscomp_error=undefinedVars', |
| 50 | '--jscomp_error=unknownDefines', |
| 51 | '--jscomp_error=uselessCode', |
| 52 | '--jscomp_error=visibility', |
| 53 | '--js', |
| 54 | '<(RULE_INPUT_PATH)', |
| 55 | '--js_output_file', |
| 56 | '<@(_outputs)', |
| 57 | ], |
| 58 | 'message': 'Running closure compiler on <(RULE_INPUT_NAME)', |
| 59 | } # rule_name: jscompilation |
| 60 | ]}, |
| 61 | { # else |
| 62 | 'rules': [ |
| 63 | { |
| 64 | 'rule_name': 'jscompilation', |
| 65 | 'extension': 'js', |
| 66 | 'outputs': [ |
| 67 | '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME)', |
| 68 | ], |
| 69 | 'action': [ |
| 70 | 'cp', |
| 71 | '<(RULE_INPUT_PATH)', |
| 72 | '<@(_outputs)', |
| 73 | ], |
| 74 | } |
| 75 | ]} # rule_name: jscompilation |
| 76 | ] # condition: compile_javascript |
| 77 | ] # conditions |
| 78 | } |