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            'chromevox2',
30          ],
31        },
32        {
33          'target_name': 'chromevox_resources',
34          'type': 'none',
35          'dependencies': [
36            'chromevox_assets',
37            'chromevox_static_files',
38            'chromevox_strings',
39            'chromevox_uncompiled_js_files',
40            '<(chromevox_third_party_dir)/chromevox.gyp:chromevox_third_party_resources',
41            '../braille_ime/braille_ime.gyp:braille_ime_manifest',
42          ],
43          'conditions': [
44            ['disable_nacl==0 and disable_nacl_untrusted==0', {
45              'dependencies': [
46                '<(DEPTH)/third_party/liblouis/liblouis_nacl.gyp:liblouis_nacl_wrapper_nacl',
47              ],
48            }],
49            ['use_migrated_chromevox==1 and chromevox_compress_js==1', {
50              'dependencies': [
51                'chromevox_content_script',
52                'chromevox_background_script',
53                'chromevox_options_script',
54                'chromevox_kbexplorer_script',
55              ],
56            }],
57            ['use_migrated_chromevox==1 and chromevox_compress_js==0', {
58              'dependencies': [
59                'chromevox_copied_scripts',
60              ],
61            }],
62          ],
63        },
64        {
65          'target_name': 'chromevox_assets',
66          'type': 'none',
67          'includes': [
68            'chromevox_assets.gypi',
69          ],
70        },
71        {
72          'target_name': 'chromevox_manifest',
73          'type': 'none',
74          'variables': {
75            'output_manifest_path': '<(chromevox_dest_dir)/manifest.json',
76          },
77          'includes': [ 'generate_manifest.gypi', ],
78        },
79        {
80          'target_name': 'chromevox_guest_manifest',
81          'type': 'none',
82          'variables': {
83            'output_manifest_path': '<(chromevox_dest_dir)/manifest_guest.json',
84            'is_guest_manifest': 1,
85          },
86          'includes': [ 'generate_manifest.gypi', ],
87        },
88        {
89          'target_name': 'chromevox_static_files',
90          'type': 'none',
91          'copies': [
92            {
93              'destination': '<(chromevox_dest_dir)/chromevox/background',
94              'files': [
95                'chromevox/background/background.html',
96                'chromevox/background/kbexplorer.html',
97                'chromevox/background/options.html',
98              ],
99            },
100          ],
101        },
102        {
103          # JavaScript files that are always directly included into the
104          # destination directory.
105          'target_name': 'chromevox_uncompiled_js_files',
106          'type': 'none',
107          'copies': [
108            {
109              'destination': '<(chromevox_dest_dir)/closure',
110              'files': [
111                'closure/closure_preinit.js',
112              ],
113              'conditions': [
114                ['use_migrated_chromevox==0 or chromevox_compress_js==1', {
115                  'files': [ '<(closure_goog_dir)/base.js' ],
116                }],
117              ]
118            },
119            {
120              'destination': '<(chromevox_dest_dir)/chromevox/injected',
121              'files': [
122                'chromevox/injected/api.js',
123                'chromevox/injected/api_util.js',
124              ],
125            },
126          ],
127        },
128        {
129          'target_name': 'chromevox_strings',
130          'type': 'none',
131          'actions': [
132            {
133              'action_name': 'chromevox_strings',
134              'variables': {
135                'grit_grd_file': 'strings/chromevox_strings.grd',
136                'grit_out_dir': '<(chromevox_dest_dir)',
137                # We don't generate any RC files, so no resource_ds file is needed.
138                'grit_resource_ids': '',
139              },
140              'includes': [ '../../../../../build/grit_action.gypi' ],
141            },
142          ],
143        },
144        {
145          'target_name': 'chromevox2',
146          'type': 'none',
147          'dependencies': [
148            'chromevox2_copied_scripts',
149            'chromevox2_deps',
150            'chromevox2_manifest',
151            'chromevox2_guest_manifest',
152            'chromevox2_resources',
153          ],
154        },
155        {
156          'target_name': 'chromevox2_copied_scripts',
157          'type': 'none',
158          'variables': {
159            'dest_dir': '<(chromevox_dest_dir)',
160          },
161          'sources': [
162            'cvox2/background/loader.js',
163          ],
164          'includes': [ 'copy_js.gypi', ],
165        },
166        {
167          'target_name': 'chromevox2_deps',
168          'type': 'none',
169          'variables': {
170            'deps_js_output_file': '<(chromevox_dest_dir)/deps.js',
171          },
172          'sources': [
173            'cvox2/background/loader.js',
174          ],
175          'includes': ['generate_deps.gypi'],
176        },
177        {
178          'target_name': 'chromevox2_resources',
179          'type': 'none',
180          'copies': [
181            {
182              'destination': '<(PRODUCT_DIR)/resources/chromeos/chromevox/cvox2/background',
183              'files': [
184                'cvox2/background/background.html',
185              ],
186            },
187          ],
188        },
189        {
190          'target_name': 'chromevox2_manifest',
191          'type': 'none',
192          'variables': {
193            'output_manifest_path': '<(chromevox_dest_dir)/manifest_next.json',
194'use_chromevox_next': 1,
195          },
196          'includes': [ 'generate_manifest.gypi', ],
197        },
198        {
199          'target_name': 'chromevox2_guest_manifest',
200          'type': 'none',
201          'variables': {
202            'output_manifest_path': '<(chromevox_dest_dir)/manifest_next_guest.json',
203            'is_guest_manifest': 1,
204            'use_chromevox_next': 1,
205          },
206          'includes': [ 'generate_manifest.gypi', ],
207        },
208      ],
209      'conditions': [
210        ['use_migrated_chromevox==1 and chromevox_compress_js==1', {
211          'targets': [
212            {
213              'target_name': 'chromevox_content_script',
214              'type': 'none',
215              'variables': {
216                'output_file': '<(chromevox_dest_dir)/chromeVoxChromePageScript.js',
217              },
218              'sources': [ '<(content_script_loader_file)' ],
219              'includes': [ 'compress_js.gypi', ],
220            },
221            {
222              'target_name': 'chromevox_background_script',
223              'type': 'none',
224              'variables': {
225                'output_file': '<(chromevox_dest_dir)/chromeVoxChromeBackgroundScript.js',
226              },
227              'sources': [ '<(background_script_loader_file)' ],
228              'includes': [ 'compress_js.gypi', ],
229            },
230            {
231              'target_name': 'chromevox_options_script',
232              'type': 'none',
233              'variables': {
234                'output_file': '<(chromevox_dest_dir)/chromeVoxChromeOptionsScript.js',
235              },
236              'sources': [ '<(options_script_loader_file)' ],
237              'includes': [ 'compress_js.gypi', ],
238            },
239            {
240              'target_name': 'chromevox_kbexplorer_script',
241              'type': 'none',
242              'variables': {
243                'output_file': '<(chromevox_dest_dir)/chromeVoxKbExplorerScript.js',
244              },
245              'sources': [ '<(kbexplorer_loader_file)' ],
246              'includes': [ 'compress_js.gypi', ],
247            },
248          ],
249        },
250        ],
251        ['use_migrated_chromevox==1 and chromevox_compress_js==0', {
252          'targets': [
253            {
254              'target_name': 'chromevox_copied_scripts',
255              'type': 'none',
256              'variables': {
257                'dest_dir': '<(chromevox_dest_dir)',
258              },
259              'sources': [
260                '<(background_script_loader_file)',
261                '<(content_script_loader_file)',
262                '<(kbexplorer_loader_file)',
263                '<(options_script_loader_file)',
264              ],
265              'includes': [ 'copy_js.gypi', ],
266            },
267          ],
268        }],
269      ],
270    }],
271  ],
272}
273