summaryrefslogtreecommitdiffstats
path: root/ios/web/js_compile.gypi
blob: aae69e6d5a88eea9c5141927722b60f0b61dbd77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This file should be deprecated in favor of js_compile_checked.gypi or
# eventually third_party/closure_compiler/compile_js.gypi as iOS JS code
# becomes error free. See http://crbug.com/487804
{
  'variables': {
    'closure_compiler_path': '<(DEPTH)/third_party/closure_compiler/compiler/compiler.jar',
    'compile_javascript%': 1,
  },
  'conditions': [
    ['compile_javascript==1', {
      'rules': [
        {
          'rule_name': 'jscompilation',
          'extension': 'js',
          'inputs': [
            '<(closure_compiler_path)',
          ],
          'outputs': [
            '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME)',
          ],
          'action': [
            'java',
            '-jar',
            '<(closure_compiler_path)',
            '--compilation_level',
            'SIMPLE_OPTIMIZATIONS',
            '--js',
            '<(RULE_INPUT_PATH)',
            '--js_output_file',
            '<@(_outputs)',
          ],
          'message': 'Running closure compiler on <(RULE_INPUT_NAME)',
        }  # rule_name: jscompilation
      ]},
     {  # else
      'rules': [
        {
          'rule_name': 'jscompilation',
          'extension': 'js',
          'outputs': [
            '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_NAME)',
          ],
          'action': [
            'cp',
            '<(RULE_INPUT_PATH)',
            '<@(_outputs)',
          ],
        }
      ]}  # rule_name: jscompilation
    ]  # condition: compile_javascript
  ]  # conditions
}