OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 { | 5 { |
6 'variables': { | 6 'variables': { |
7 # When including this gypi, the following variables must be set: | 7 # When including this gypi, the following variables must be set: |
8 # schema_files: | 8 # schema_files: |
9 # An array of json or idl files that comprise the api model. | 9 # An array of json or idl files that comprise the api model. |
| 10 # schema_include_rules (optional): |
| 11 # An array of paths to include when searching for referenced objects, |
| 12 # with the namespace separated by a :. |
| 13 # Example: |
| 14 # [ '/foo/bar:Foo::Bar::%(namespace)s' ] |
10 # cc_dir: | 15 # cc_dir: |
11 # The directory to put the generated code in. | 16 # The directory to put the generated code in. |
12 # root_namespace: | 17 # root_namespace: |
13 # A Python string substituion pattern used to generate the C++ | 18 # A Python string substituion pattern used to generate the C++ |
14 # namespace for each API. Use %(namespace)s to replace with the API | 19 # namespace for each API. Use %(namespace)s to replace with the API |
15 # namespace, like "toplevel::%(namespace)s_api". | 20 # namespace, like "toplevel::%(namespace)s_api". |
16 # | 21 # |
17 # Functions and namespaces can be excluded by setting "nocompile" to true. | 22 # Functions and namespaces can be excluded by setting "nocompile" to true. |
18 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', | 23 'api_gen_dir': '<(DEPTH)/tools/json_schema_compiler', |
19 'api_gen': '<(api_gen_dir)/compiler.py', | 24 'api_gen': '<(api_gen_dir)/compiler.py', |
| 25 'schema_include_rules': [], |
20 }, | 26 }, |
21 'rules': [ | 27 'rules': [ |
22 { | 28 { |
23 # GN version: //extensions/generated_extensions_api.gni | 29 # GN version: //extensions/generated_extensions_api.gni |
24 'rule_name': 'genapi', | 30 'rule_name': 'genapi', |
25 'msvs_external_rule': 1, | 31 'msvs_external_rule': 1, |
26 'extension': 'json', | 32 'extension': 'json', |
27 'inputs': [ | 33 'inputs': [ |
28 '<(api_gen_dir)/cc_generator.py', | 34 '<(api_gen_dir)/cc_generator.py', |
29 '<(api_gen_dir)/code.py', | 35 '<(api_gen_dir)/code.py', |
(...skipping 17 matching lines...) Expand all Loading... |
47 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT
_ROOT).h', | 53 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT
_ROOT).h', |
48 ], | 54 ], |
49 'action': [ | 55 'action': [ |
50 'python', | 56 'python', |
51 '<(api_gen)', | 57 '<(api_gen)', |
52 '<(RULE_INPUT_PATH)', | 58 '<(RULE_INPUT_PATH)', |
53 '--root=<(DEPTH)', | 59 '--root=<(DEPTH)', |
54 '--destdir=<(SHARED_INTERMEDIATE_DIR)', | 60 '--destdir=<(SHARED_INTERMEDIATE_DIR)', |
55 '--namespace=<(root_namespace)', | 61 '--namespace=<(root_namespace)', |
56 '--generator=cpp', | 62 '--generator=cpp', |
| 63 '--include-rules=<(schema_include_rules)' |
57 ], | 64 ], |
58 'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files', | 65 'message': 'Generating C++ code from <(RULE_INPUT_PATH) json files', |
59 'process_outputs_as_sources': 1, | 66 'process_outputs_as_sources': 1, |
60 }, | 67 }, |
61 { | 68 { |
62 'rule_name': 'genapi_idl', | 69 'rule_name': 'genapi_idl', |
63 'msvs_external_rule': 1, | 70 'msvs_external_rule': 1, |
64 'extension': 'idl', | 71 'extension': 'idl', |
65 'inputs': [ | 72 'inputs': [ |
66 '<(api_gen_dir)/cc_generator.py', | 73 '<(api_gen_dir)/cc_generator.py', |
(...skipping 18 matching lines...) Expand all Loading... |
85 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT
_ROOT).h', | 92 '<(SHARED_INTERMEDIATE_DIR)/<(cc_dir)/<(RULE_INPUT_DIRNAME)/<(RULE_INPUT
_ROOT).h', |
86 ], | 93 ], |
87 'action': [ | 94 'action': [ |
88 'python', | 95 'python', |
89 '<(api_gen)', | 96 '<(api_gen)', |
90 '<(RULE_INPUT_PATH)', | 97 '<(RULE_INPUT_PATH)', |
91 '--root=<(DEPTH)', | 98 '--root=<(DEPTH)', |
92 '--destdir=<(SHARED_INTERMEDIATE_DIR)', | 99 '--destdir=<(SHARED_INTERMEDIATE_DIR)', |
93 '--namespace=<(root_namespace)', | 100 '--namespace=<(root_namespace)', |
94 '--generator=cpp', | 101 '--generator=cpp', |
| 102 '--include-rules=<(schema_include_rules)' |
95 ], | 103 ], |
96 'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files', | 104 'message': 'Generating C++ code from <(RULE_INPUT_PATH) IDL files', |
97 'process_outputs_as_sources': 1, | 105 'process_outputs_as_sources': 1, |
98 }, | 106 }, |
99 ], | 107 ], |
100 'include_dirs': [ | 108 'include_dirs': [ |
101 '<(SHARED_INTERMEDIATE_DIR)', | 109 '<(SHARED_INTERMEDIATE_DIR)', |
102 '<(DEPTH)', | 110 '<(DEPTH)', |
103 ], | 111 ], |
104 'dependencies':[ | 112 'dependencies':[ |
105 '<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util', | 113 '<(DEPTH)/tools/json_schema_compiler/api_gen_util.gyp:api_gen_util', |
106 ], | 114 ], |
107 'direct_dependent_settings': { | 115 'direct_dependent_settings': { |
108 'include_dirs': [ | 116 'include_dirs': [ |
109 '<(SHARED_INTERMEDIATE_DIR)', | 117 '<(SHARED_INTERMEDIATE_DIR)', |
110 ] | 118 ] |
111 }, | 119 }, |
112 # This target exports a hard dependency because it generates header | 120 # This target exports a hard dependency because it generates header |
113 # files. | 121 # files. |
114 'hard_dependency': 1, | 122 'hard_dependency': 1, |
115 } | 123 } |
OLD | NEW |