Roll src/third_party/WebKit 049340a:b6c48e6 (svn 201128:201129)
[chromium-blink-merge.git] / build / json_to_struct.gypi
blob09c8e3e4574d540f7730a1bb863505514fcbf52f
1 # Copyright 2012 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.
6   'variables': {
7     # When including this gypi, the following variables must be set:
8     #   schema_file: a json file that comprise the structure model.
9     #   namespace: the C++ namespace that all generated files go under
10     #   cc_dir: path to generated files
11     # Functions and namespaces can be excluded by setting "nocompile" to true.
12     'struct_gen_dir': '<(DEPTH)/tools/json_to_struct',
13     'struct_gen%': '<(struct_gen_dir)/json_to_struct.py',
14     'output_filename%': '<(RULE_INPUT_ROOT)',
15   },
16   'rules': [
17     {
18       # GN version: //tools/json_to_struct/json_to_struct.gni
19       'rule_name': 'genstaticinit',
20       'extension': 'json',
21       'inputs': [
22         '<(struct_gen)',
23         '<(struct_gen_dir)/element_generator.py',
24         '<(struct_gen_dir)/json_to_struct.py',
25         '<(struct_gen_dir)/struct_generator.py',
26         '<(schema_file)',
27       ],
28       'outputs': [
29         '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(output_filename).cc',
30         '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(output_filename).h',
31       ],
32       'action': [
33         'python',
34         '<(struct_gen)',
35         '<(RULE_INPUT_PATH)',
36         '--destbase=<(SHARED_INTERMEDIATE_DIR)',
37         '--destdir=<(cc_dir)',
38         '--namespace=<(namespace)',
39         '--schema=<(schema_file)',
40         '--output=<(output_filename)',
41       ],
42       'message': 'Generating C++ static initializers from <(RULE_INPUT_PATH)',
43       'process_outputs_as_sources': 1,
44     },
45   ],
46   'include_dirs': [
47     '<(SHARED_INTERMEDIATE_DIR)',
48     '<(DEPTH)',
49   ],
50   # This target exports a hard dependency because it generates header
51   # files.
52   'hard_dependency': 1,