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# Pre-caching steps used internally by the IDL compiler
6#
7# Design doc: http://www.chromium.org/developers/design-documents/idl-build
8
9{
10  'includes': [
11    'scripts.gypi',
12    '../bindings.gypi',
13    '../templates/templates.gypi',
14  ],
15
16  'targets': [
17################################################################################
18  {
19    # A separate pre-caching step is *not required* to use lex/parse table
20    # caching in PLY, as the caches are concurrency-safe.
21    # However, pre-caching ensures that all compiler processes use the cached
22    # files (hence maximizing speed), instead of early processes building the
23    # tables themselves (as they've not yet been written when they start).
24    #
25    # GN version: //third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables
26    'target_name': 'cached_lex_yacc_tables',
27    'type': 'none',
28    'actions': [{
29      'action_name': 'cache_lex_yacc_tables',
30      'inputs': [
31        '<@(idl_lexer_parser_files)',
32      ],
33      'outputs': [
34        '<(bindings_scripts_output_dir)/lextab.py',
35        '<(bindings_scripts_output_dir)/parsetab.pickle',
36      ],
37      'action': [
38        'python',
39        'blink_idl_parser.py',
40        '<(bindings_scripts_output_dir)',
41      ],
42      'message': 'Caching PLY lex & yacc lex/parse tables',
43    }],
44  },
45################################################################################
46  {
47    # A separate pre-caching step is *required* to use bytecode caching in
48    # Jinja (which improves speed significantly), as the bytecode cache is
49    # not concurrency-safe on write; details in code_generator_v8.py.
50    #
51    # GN version: //third_party/WebKit/Source/bindings/scripts:cached_jinja_templates
52    'target_name': 'cached_jinja_templates',
53    'type': 'none',
54    'actions': [{
55      'action_name': 'cache_jinja_templates',
56      'inputs': [
57        '<@(jinja_module_files)',
58        'code_generator_v8.py',
59        '<@(code_generator_template_files)',
60      ],
61      'outputs': [
62        '<(bindings_scripts_output_dir)/cached_jinja_templates.stamp',  # Dummy to track dependency
63      ],
64      'action': [
65        'python',
66        'code_generator_v8.py',
67        '<(bindings_scripts_output_dir)',
68        '<(bindings_scripts_output_dir)/cached_jinja_templates.stamp',
69      ],
70      'message': 'Caching bytecode of Jinja templates',
71    }],
72  },
73################################################################################
74  ],  # targets
75}
76