Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / devtools / devtools.gyp
blob9068497343dc1ccecf27df8349955d63f421ae65
2 # Copyright (C) 2013 Google Inc. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
8 #         * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 #         * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
13 # distribution.
14 #         * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32     'includes': [
33       'devtools.gypi',
34     ],
35     'targets': [
36         {
37             'target_name': 'devtools_frontend_resources',
38             'type': 'none',
39             'dependencies': [
40                 'supported_css_properties',
41                 'frontend_protocol_sources',
42                 'build_applications',
43             ],
44             'conditions': [
45                 ['debug_devtools==0', {
46                     'dependencies': [
47                         'concatenated_inspector_css',
48                         'concatenated_toolbox_css',
49                     ],
50                 }],
51             ],
52             'copies': [
53                 {
54                     'destination': '<(PRODUCT_DIR)/resources/inspector/Images',
55                     'files': [
56                         '<@(devtools_image_files)',
57                     ],
58                 },
59                 {
60                     'destination': '<(PRODUCT_DIR)/resources/inspector/emulated_devices',
61                     'files': [
62                         '<@(devtools_emulated_devices_images)',
63                     ],
64                 },
65                 {
66                     'destination': '<(PRODUCT_DIR)/resources/inspector/',
67                     'files': [
68                         '<@(devtools_compatibility_scripts)',
69                     ],
70                 },
71             ],
72         },
73         {
74             'target_name': 'devtools_extension_api',
75             'type': 'none',
76             'actions': [{
77                 'action_name': 'devtools_extension_api',
78                 'script_name': 'scripts/generate_devtools_extension_api.py',
79                 'inputs': [
80                     '<@(_script_name)',
81                     '<@(devtools_extension_api_files)',
82                 ],
83                 'outputs': ['<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js'],
84                 'action': ['python', '<@(_script_name)', '<@(_outputs)', '<@(devtools_extension_api_files)'],
85             }],
86         },
87         {
88             'target_name': 'generate_devtools_grd',
89             'type': 'none',
90             'dependencies': [
91                 'devtools_extension_api',
92                 'devtools_frontend_resources',
93             ],
94             'conditions': [
95                 ['debug_devtools==0', {
96                     'actions': [{
97                         'action_name': 'generate_devtools_grd',
98                         'script_name': 'scripts/generate_devtools_grd.py',
99                         'relative_path_dirs': [
100                             '<(PRODUCT_DIR)/resources/inspector',
101                             'front_end'
102                         ],
103                         'static_files': [
104                             # Intentionally empty. Should get rebuilt when switching from debug_devtools==1.
105                         ],
106                         'devtools_static_files_list': '<|(devtools_static_grd_files.tmp <@(_static_files))',
107                         'generated_files': [
108                             # Core and remote modules should not be listed here.
109                             '<(PRODUCT_DIR)/resources/inspector/inspector.css',
110                             '<(PRODUCT_DIR)/resources/inspector/inspector.html',
111                             '<(PRODUCT_DIR)/resources/inspector/inspector.js',
112                             '<(PRODUCT_DIR)/resources/inspector/toolbox.css',
113                             '<(PRODUCT_DIR)/resources/inspector/toolbox.html',
114                             '<(PRODUCT_DIR)/resources/inspector/toolbox.js',
115                             '<(PRODUCT_DIR)/resources/inspector/accessibility_module.js',
116                             '<(PRODUCT_DIR)/resources/inspector/animation_module.js',
117                             '<(PRODUCT_DIR)/resources/inspector/audits_module.js',
118                             '<(PRODUCT_DIR)/resources/inspector/components_lazy_module.js',
119                             '<(PRODUCT_DIR)/resources/inspector/console_module.js',
120                             '<(PRODUCT_DIR)/resources/inspector/devices_module.js',
121                             '<(PRODUCT_DIR)/resources/inspector/diff_module.js',
122                             '<(PRODUCT_DIR)/resources/inspector/elements_module.js',
123                             '<(PRODUCT_DIR)/resources/inspector/heap_snapshot_worker_module.js',
124                             '<(PRODUCT_DIR)/resources/inspector/layers_module.js',
125                             '<(PRODUCT_DIR)/resources/inspector/network_module.js',
126                             '<(PRODUCT_DIR)/resources/inspector/profiler_module.js',
127                             '<(PRODUCT_DIR)/resources/inspector/promises_module.js',
128                             '<(PRODUCT_DIR)/resources/inspector/resources_module.js',
129                             '<(PRODUCT_DIR)/resources/inspector/security_module.js',
130                             '<(PRODUCT_DIR)/resources/inspector/script_formatter_worker_module.js',
131                             '<(PRODUCT_DIR)/resources/inspector/settings_module.js',
132                             '<(PRODUCT_DIR)/resources/inspector/snippets_module.js',
133                             '<(PRODUCT_DIR)/resources/inspector/source_frame_module.js',
134                             '<(PRODUCT_DIR)/resources/inspector/sources_module.js',
135                             '<(PRODUCT_DIR)/resources/inspector/temp_storage_shared_worker_module.js',
136                             '<(PRODUCT_DIR)/resources/inspector/timeline_module.js',
137                             '<(PRODUCT_DIR)/resources/inspector/ui_lazy_module.js',
138                             '<(PRODUCT_DIR)/resources/inspector/devtools_extension_api.js',
139                         ],
140                         'inputs': [
141                             '<@(_script_name)',
142                             '<@(_static_files)',
143                             '<@(devtools_compatibility_scripts)',
144                             '<@(_generated_files)',
145                             '<@(devtools_image_files)',
146                             '<(_devtools_static_files_list)',
147                         ],
148                         'images_path': [
149                             'front_end/Images',
150                         ],
151                         'outputs': ['<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd'],
152                         'action': ['python', '<@(_script_name)', '<@(_generated_files)', '<@(devtools_compatibility_scripts)', '--static_files_list', '<(_devtools_static_files_list)', '--relative_path_dirs', '<@(_relative_path_dirs)', '--images', '<@(_images_path)', '--output', '<@(_outputs)'],
153                     }],
154                 },
155                 {
156                     # If we're not concatenating devtools files, we want to
157                     # run after the original files have been copied to
158                     # <(PRODUCT_DIR)/resources/inspector.
159                     'dependencies': ['devtools_frontend_resources'],
160                     'actions': [{
161                         'action_name': 'generate_devtools_grd',
162                         'script_name': 'scripts/generate_devtools_grd.py',
163                         'relative_path_dirs': [
164                             'front_end',
165                             '<(PRODUCT_DIR)/resources/inspector',
166                         ],
167                         'static_files': [
168                             '<@(all_devtools_files)',
169                             'front_end/Runtime.js',
170                         ],
171                         'devtools_static_files_list': '<|(devtools_static_grd_files.tmp <@(_static_files))',
172                         'generated_files': [
173                             '<(PRODUCT_DIR)/resources/inspector/InspectorBackendCommands.js',
174                             '<(PRODUCT_DIR)/resources/inspector/SupportedCSSProperties.js',
175                             '<(PRODUCT_DIR)/resources/inspector/inspector.html',
176                             '<(PRODUCT_DIR)/resources/inspector/toolbox.html',
177                         ],
178                         'inputs': [
179                             '<@(_script_name)',
180                             '<@(_static_files)',
181                             '<@(devtools_compatibility_scripts)',
182                             '<@(_generated_files)',
183                             '<@(devtools_image_files)',
184                             '<(_devtools_static_files_list)',
185                         ],
186                         'images_path': [
187                             'front_end/Images',
188                         ],
189                         # Note that other files are put under /devtools directory, together with declared devtools_resources.grd
190                         'outputs': ['<(SHARED_INTERMEDIATE_DIR)/devtools/devtools_resources.grd'],
191                         'action': ['python', '<@(_script_name)', '<@(_generated_files)', '<@(devtools_compatibility_scripts)', '--static_files_list', '<(_devtools_static_files_list)', '--relative_path_dirs', '<@(_relative_path_dirs)', '--images', '<@(_images_path)', '--output', '<@(_outputs)'],
192                     }],
193                 }],
194             ],
195         },
196         {
197           'target_name': 'frontend_protocol_sources',
198           'type': 'none',
199           'actions': [
200             {
201               'action_name': 'generateInspectorProtocolFrontendSources',
202               'inputs': [
203                 # The python script in action below.
204                 'scripts/CodeGeneratorFrontend.py',
205                 # Input file for the script.
206                 'protocol.json',
207               ],
208               'outputs': [
209                 '<(PRODUCT_DIR)/resources/inspector/InspectorBackendCommands.js',
210               ],
211               'action': [
212                 'python',
213                 'scripts/CodeGeneratorFrontend.py',
214                 'protocol.json',
215                 '--output_js_dir', '<(PRODUCT_DIR)/resources/inspector/',
216               ],
217               'message': 'Generating Inspector protocol frontend sources from protocol.json',
218             },
219           ]
220         },
221         {
222           'target_name': 'supported_css_properties',
223           'type': 'none',
224           'actions': [
225             {
226               'action_name': 'generateSupportedCSSProperties',
227               'inputs': [
228                 # The python script in action below.
229                 'scripts/generate_supported_css.py',
230                 # Input files for the script.
231                 '../core/css/CSSProperties.in',
232               ],
233               'outputs': [
234                 '<(PRODUCT_DIR)/resources/inspector/SupportedCSSProperties.js',
235               ],
236               'action': [
237                 'python',
238                 '<@(_inputs)',
239                 '<@(_outputs)',
240               ],
241               'message': 'Generating supported CSS properties for front end',
242             },
243           ]
244         },
246         # Frontend applications and modules.
247         {
248             'target_name': 'build_applications',
249             'type': 'none',
250             'dependencies': [
251                 'supported_css_properties',
252                 'frontend_protocol_sources',
253             ],
254             'output_path': '<(PRODUCT_DIR)/resources/inspector/',
255             'actions': [{
256                 'action_name': 'build_applications',
257                 'script_name': 'scripts/build_applications.py',
258                 'helper_scripts': [
259                     'scripts/modular_build.py',
260                     'scripts/concatenate_application_code.py',
261                 ],
262                 'inputs': [
263                     '<@(_script_name)',
264                     '<@(_helper_scripts)',
265                     '<@(all_devtools_files)',
266                     'front_end/inspector.html',
267                     'front_end/toolbox.html',
268                     '<(_output_path)/InspectorBackendCommands.js',
269                     '<(_output_path)/SupportedCSSProperties.js',
270                 ],
271                 'action': ['python', '<@(_script_name)', 'inspector', 'toolbox', '--input_path', 'front_end', '--output_path', '<@(_output_path)', '--debug', '<@(debug_devtools)'],
272                 'conditions': [
273                     ['debug_devtools==0', { # Release
274                         'outputs': [
275                             '<(_output_path)/inspector.html',
276                             '<(_output_path)/inspector.js',
277                             '<(_output_path)/toolbox.html',
278                             '<(_output_path)/toolbox.js',
279                             '<(_output_path)/accessibility_module.js',
280                             '<(_output_path)/animation_module.js',
281                             '<(_output_path)/audits_module.js',
282                             '<(_output_path)/cm_modes_module.js',
283                             '<(_output_path)/components_lazy_module.js',
284                             '<(_output_path)/console_module.js',
285                             '<(_output_path)/devices_module.js',
286                             '<(_output_path)/diff_module.js',
287                             '<(_output_path)/elements_module.js',
288                             '<(_output_path)/emulated_devices_module.js',
289                             '<(_output_path)/heap_snapshot_worker_module.js',
290                             '<(_output_path)/layers_module.js',
291                             '<(_output_path)/network_module.js',
292                             '<(_output_path)/profiler_module.js',
293                             '<(_output_path)/promises_module.js',
294                             '<(_output_path)/resources_module.js',
295                             '<(_output_path)/security_module.js',
296                             '<(_output_path)/screencast_module.js',
297                             '<(_output_path)/script_formatter_worker_module.js',
298                             '<(_output_path)/settings_module.js',
299                             '<(_output_path)/snippets_module.js',
300                             '<(_output_path)/source_frame_module.js',
301                             '<(_output_path)/sources_module.js',
302                             '<(_output_path)/temp_storage_shared_worker_module.js',
303                             '<(_output_path)/timeline_module.js',
304                             '<(_output_path)/ui_lazy_module.js',
305                         ],
306                     },
307                     { # Debug
308                         'outputs': [
309                             '<(_output_path)/inspector.html',
310                             '<(_output_path)/toolbox.html',
311                         ]
312                     }]
313                 ]
314             }],
315             'conditions': [
316                 ['debug_devtools==0', { # Release
317                 },
318                 { # Debug
319                   # Copy runtime core and non-module directories here.
320                     'copies': [
321                         {
322                             'destination': '<(_output_path)',
323                             'files': [
324                                 '<@(devtools_core_base_files)',
325                                 '<@(devtools_core_css_files)',
326                             ],
327                         },
328                         {
329                             'destination': '<(_output_path)/acorn',
330                             'files': [
331                                 '<@(devtools_acorn_files)',
332                             ],
333                         },
334                         {
335                             'destination': '<(_output_path)/cm',
336                             'files': [
337                                 '<@(devtools_cm_js_files)',
338                                 '<@(devtools_cm_css_files)',
339                             ],
340                         },
341                     ]
342                 }]
343             ]
344         },
345     ], # targets
346     'conditions': [
347         ['debug_devtools==0', {
348             'targets': [
349                 {
350                     'target_name': 'concatenated_inspector_css',
351                     'type': 'none',
352                     'actions': [{
353                         'action_name': 'concatenate_inspector_css',
354                         'script_name': 'scripts/concatenate_css_files.py',
355                         'input_stylesheet': 'front_end/inspector.css',
356                         'inputs': [
357                             '<@(_script_name)',
358                             '<@(_input_stylesheet)',
359                             '<@(devtools_core_css_files)',
360                         ],
361                         'search_path': [ 'front_end' ],
362                         'outputs': ['<(PRODUCT_DIR)/resources/inspector/inspector.css'],
363                         'action': ['python', '<@(_script_name)', '<@(_input_stylesheet)', '<@(_outputs)'],
364                     }],
365                 },
366                 {
367                     'target_name': 'concatenated_toolbox_css',
368                     'type': 'none',
369                     'actions': [{
370                         'action_name': 'concatenate_toolbox_css',
371                         'script_name': 'scripts/concatenate_css_files.py',
372                         'input_stylesheet': 'front_end/toolbox.css',
373                         'inputs': [
374                             '<@(_script_name)',
375                             '<@(_input_stylesheet)',
376                             '<@(devtools_core_css_files)',
377                         ],
378                         'search_path': [ 'front_end' ],
379                         'outputs': ['<(PRODUCT_DIR)/resources/inspector/toolbox.css'],
380                         'action': ['python', '<@(_script_name)', '<@(_input_stylesheet)', '<@(_outputs)'],
381                     }],
382                 },
383             ],
384         }],
385     ], # conditions