OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2015 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 # This file included into a targets definition creates a target that generates | |
6 # native and HTML/JS supporting code for Web UI element from element's | |
7 # declaration JSON file. | |
8 # | |
9 # Example: | |
10 # 'targets': [ | |
11 # ... | |
12 # { | |
13 # 'variables': { | |
14 # 'declaration_file': 'path/to/file.json' | |
15 # } | |
16 # 'includes': ['path/to/this/file.gypi'] | |
17 # }, | |
18 # ... | |
19 # ] | |
20 # | |
21 # Such inclusion creates a target, which name is deduced from declaration file's | |
22 # full path (relative to src), by replacing every nonalphanumeric character with | |
Nikita (slow)
2015/02/25 18:21:59
nit: update comment
dzhioev (left Google)
2015/02/26 14:01:39
Done.
| |
23 # '_', e.g. for declaration file with full path 'full/path/to/file.json' target | |
24 # name will be 'full_path_to_file_json'. This is needed to properly handle | |
25 # dependencies between declaration files and their imports. | |
26 # | |
27 # Created target generates and compiles 4 files: | |
28 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_webui_view.h | |
29 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_webui_view.cc | |
30 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_view_model.h | |
31 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_view_model.cc | |
32 | |
33 { | |
34 'variables': { | |
35 'generator_dir': '<(DEPTH)/components/wug/generator', | |
36 'helper_path': '<(generator_dir)/build_helper.py', | |
37 'generator_path': '<(generator_dir)/gen_sources.py', | |
38 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/wug', | |
39 'helper_cl': 'python <(helper_path) --root=<(DEPTH) <(declaration_file)', | |
40 'dirname': '<(out_dir)/<!(<(helper_cl) --output=dirname)', | |
41 'view_cc': '<(dirname)/<!(<(helper_cl) --output=view_cc)', | |
42 'view_h': '<(dirname)/<!(<(helper_cl) --output=view_h)', | |
43 'model_cc': '<(dirname)/<!(<(helper_cl) --output=model_cc)', | |
44 'model_h': '<(dirname)/<!(<(helper_cl) --output=model_h)', | |
45 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', | |
46 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', | |
47 'impl_macro': '<!(<(helper_cl) --output=impl_macro)', | |
48 }, | |
49 'target_name': '<!(<(helper_cl) --output=target_name)', | |
50 'type': '<(component)', | |
51 'sources': [ | |
52 '<(view_cc)', | |
53 '<(view_h)', | |
54 '<(model_cc)', | |
55 '<(model_h)', | |
56 '<(export_h)', | |
57 ], | |
58 'defines': [ | |
59 '<(impl_macro)', | |
60 ], | |
61 'actions': [ | |
62 { | |
63 'action_name': 'gen_files', | |
64 'inputs': [ | |
65 '<(generator_path)', | |
66 '<(generator_dir)/declaration.py', | |
67 '<(generator_dir)/export_h.py', | |
68 '<(generator_dir)/html_view.py', | |
69 '<(generator_dir)/util.py', | |
70 '<(generator_dir)/view_model.py', | |
71 '<(generator_dir)/web_ui_view.py', | |
72 '<(declaration_file)', | |
73 ], | |
74 'outputs': [ | |
75 '<(view_cc)', | |
76 '<(view_h)', | |
77 '<(model_cc)', | |
78 '<(model_h)', | |
79 '<(export_h)', | |
80 ], | |
81 'action': [ | |
82 'python', | |
83 '<(generator_path)', | |
84 '--root=<(DEPTH)', | |
85 '--destination=<(out_dir)', | |
86 '<(declaration_file)' | |
87 ], | |
88 'message': 'Generating C++ code from <(declaration_file).', | |
89 }, | |
90 ], | |
91 'dependencies': [ | |
92 '<(DEPTH)/base/base.gyp:base', | |
93 '<(DEPTH)/components/components.gyp:login', | |
94 '<(DEPTH)/components/components.gyp:wug', | |
95 '<(DEPTH)/components/components_strings.gyp:components_strings', | |
96 '<(DEPTH)/skia/skia.gyp:skia', | |
97 '<!@(<(helper_cl) --output=import_dependencies)', | |
98 ], | |
99 'include_dirs': [ | |
100 '<(DEPTH)', | |
101 '<(out_dir)', | |
102 ], | |
103 'all_dependent_settings': { | |
104 'include_dirs': [ | |
105 '<(DEPTH)', | |
106 '<(out_dir)', | |
107 ], | |
108 }, | |
109 'export_dependent_settings': [ | |
110 '<(DEPTH)/components/components.gyp:wug', | |
111 '<(DEPTH)/components/components.gyp:login', | |
112 ], | |
113 # This target exports a hard dependency because it generates header | |
114 # files. | |
115 'hard_dependency': 1, | |
116 } | |
OLD | NEW |