chromevox.gyp revision 46d4c2bc3267f3f028f39e7e311b0f89aba2e4fd
1# Copyright 2014 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{
6  'conditions': [
7    ['chromeos==1', {
8      'variables': {
9        # Whether to compress the 4 main ChromeVox scripts.  Applicable if
10        # use_migrated_chromevox is true.
11        'chromevox_compress_js%': '1',
12        'background_script_loader_file': 'chromevox/background/loader.js',
13        'content_script_loader_file': 'chromevox/injected/loader.js',
14        'options_script_loader_file': 'chromevox/background/options_loader.js',
15        'kbexplorer_loader_file': 'chromevox/background/kbexplorer_loader.js',
16      },
17      'includes': [
18        'chromevox_tests.gypi',
19        'common.gypi',
20      ],
21      'targets': [
22        {
23          'target_name': 'chromevox',
24          'type': 'none',
25          'dependencies': [
26            'chromevox_resources',
27            'chromevox_manifest',
28            'chromevox_guest_manifest',
29          ],
30        },
31        {
32          'target_name': 'chromevox_resources',
33          'type': 'none',
34          'dependencies': [
35            'chromevox_assets',
36            'chromevox_static_files',
37            'chromevox_strings',
38            'chromevox_uncompiled_js_files',
39            '<(chromevox_third_party_dir)/chromevox.gyp:chromevox_third_party_resources',
40            '../braille_ime/braille_ime.gyp:braille_ime_manifest',
41          ],
42          'conditions': [
43            ['disable_nacl==0 and disable_nacl_untrusted==0', {
44              'dependencies': [
45                '<(DEPTH)/third_party/liblouis/liblouis_nacl.gyp:liblouis_nacl_wrapper_nacl',
46              ],
47            }],
48            ['use_migrated_chromevox==1 and chromevox_compress_js==1', {
49              'dependencies': [
50                'chromevox_content_script',
51                'chromevox_background_script',
52                'chromevox_options_script',
53                'chromevox_kbexplorer_script',
54              ],
55            }],
56            ['use_migrated_chromevox==1 and chromevox_compress_js==0', {
57              'dependencies': [
58                'chromevox_copied_scripts',
59              ],
60            }],
61          ],
62        },
63        {
64          'target_name': 'chromevox_assets',
65          'type': 'none',
66          'includes': [
67            'chromevox_assets.gypi',
68          ],
69        },
70        {
71          'target_name': 'chromevox_manifest',
72          'type': 'none',
73          'variables': {
74            'output_manifest_path': '<(chromevox_dest_dir)/manifest.json',
75          },
76          'includes': [ 'generate_manifest.gypi', ],
77        },
78        {
79          'target_name': 'chromevox_guest_manifest',
80          'type': 'none',
81          'variables': {
82            'output_manifest_path': '<(chromevox_dest_dir)/manifest_guest.json',
83            'is_guest_manifest': 1,
84          },
85          'includes': [ 'generate_manifest.gypi', ],
86        },
87        {
88          'target_name': 'chromevox_static_files',
89          'type': 'none',
90          'copies': [
91            {
92              'destination': '<(chromevox_dest_dir)/chromevox/background',
93              'files': [
94                'chromevox/background/background.html',
95                'chromevox/background/kbexplorer.html',
96                'chromevox/background/options.html',
97              ],
98            },
99          ],
100        },
101        {
102          # JavaScript files that are always directly included into the
103          # destination directory.
104          'target_name': 'chromevox_uncompiled_js_files',
105          'type': 'none',
106          'copies': [
107            {
108              'destination': '<(chromevox_dest_dir)/closure',
109              'files': [
110                'closure/closure_preinit.js',
111              ],
112              'conditions': [
113                ['use_migrated_chromevox==0 or chromevox_compress_js==1', {
114                  'files': [ '<(closure_goog_dir)/base.js' ],
115                }],
116              ]
117            },
118            {
119              'destination': '<(chromevox_dest_dir)/chromevox/injected',
120              'files': [
121                'chromevox/injected/api.js',
122                'chromevox/injected/api_util.js',
123              ],
124            },
125          ],
126        },
127        {
128          'target_name': 'chromevox_strings',
129          'type': 'none',
130          'actions': [
131            {
132              'action_name': 'chromevox_strings',
133              'variables': {
134                'grit_grd_file': 'strings/chromevox_strings.grd',
135                'grit_out_dir': '<(chromevox_dest_dir)',
136                # We don't generate any RC files, so no resource_ds file is needed.
137                'grit_resource_ids': '',
138              },
139              'includes': [ '../../../../../build/grit_action.gypi' ],
140            },
141          ],
142        },
143      ],
144      'conditions': [
145        ['use_migrated_chromevox==1 and chromevox_compress_js==1', {
146          'targets': [
147            {
148              'target_name': 'chromevox_content_script',
149              'type': 'none',
150              'variables': {
151                'output_file': '<(chromevox_dest_dir)/chromeVoxChromePageScript.js',
152              },
153              'sources': [ '<(content_script_loader_file)' ],
154              'includes': [ 'compress_js.gypi', ],
155            },
156            {
157              'target_name': 'chromevox_background_script',
158              'type': 'none',
159              'variables': {
160                'output_file': '<(chromevox_dest_dir)/chromeVoxChromeBackgroundScript.js',
161              },
162              'sources': [ '<(background_script_loader_file)' ],
163              'includes': [ 'compress_js.gypi', ],
164            },
165            {
166              'target_name': 'chromevox_options_script',
167              'type': 'none',
168              'variables': {
169                'output_file': '<(chromevox_dest_dir)/chromeVoxChromeOptionsScript.js',
170              },
171              'sources': [ '<(options_script_loader_file)' ],
172              'includes': [ 'compress_js.gypi', ],
173            },
174            {
175              'target_name': 'chromevox_kbexplorer_script',
176              'type': 'none',
177              'variables': {
178                'output_file': '<(chromevox_dest_dir)/chromeVoxKbExplorerScript.js',
179              },
180              'sources': [ '<(kbexplorer_loader_file)' ],
181              'includes': [ 'compress_js.gypi', ],
182            },
183          ],
184        },
185        ],
186        ['use_migrated_chromevox==1 and chromevox_compress_js==0', {
187          'targets': [
188            {
189              'target_name': 'chromevox_copied_scripts',
190              'type': 'none',
191              'variables': {
192                'dest_dir': '<(chromevox_dest_dir)',
193              },
194              'sources': [
195                '<(background_script_loader_file)',
196                '<(content_script_loader_file)',
197                '<(kbexplorer_loader_file)',
198                '<(options_script_loader_file)',
199              ],
200              'includes': [ 'copy_js.gypi', ],
201            },
202          ],
203        }],
204      ],
205    }],
206  ],
207}
208