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 | |
22 # name by removing extension and adding '_wug_generated' prefix, e.g. for | |
23 # declaration file named 'some_type.json' will be created target named | |
24 # 'some_type_wug_generated'. This is needed to properly handle dependencies | |
25 # between declaration files and their imports. | |
26 # | |
27 # For declaration file with a full path 'src/full/path/some_type.json' 5 files | |
28 # will be generated and compiled: | |
29 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/some_type_export.h | |
30 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/some_type_view.h | |
31 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/some_type_view_model.cc | |
32 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/some_type_view_model.h | |
33 # <(SHARED_INTERMEDIATE_DIR)/wug/full/path/some_type_webui_view.cc | |
34 | |
35 { | |
36 'variables': { | |
37 'generator_dir': '<(DEPTH)/components/webui_generator/generator', | |
38 'helper_path': '<(generator_dir)/build_helper.py', | |
39 'generator_path': '<(generator_dir)/gen_sources.py', | |
40 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/wug', | |
41 'helper_cl': 'python <(helper_path) --root=<(DEPTH) <(declaration_file)', | |
42 'dirname': '<(out_dir)/<!(<(helper_cl) --output=dirname)', | |
43 'view_cc': '<(dirname)/<!(<(helper_cl) --output=view_cc)', | |
44 'view_h': '<(dirname)/<!(<(helper_cl) --output=view_h)', | |
45 'model_cc': '<(dirname)/<!(<(helper_cl) --output=model_cc)', | |
46 'model_h': '<(dirname)/<!(<(helper_cl) --output=model_h)', | |
47 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', | |
48 'impl_macro': '<!(<(helper_cl) --output=impl_macro)', | |
49 }, | |
50 'target_name': '<!(<(helper_cl) --output=target_name)', | |
51 'type': '<(component)', | |
52 'sources': [ | |
53 '<(view_cc)', | |
54 '<(view_h)', | |
55 '<(model_cc)', | |
56 '<(model_h)', | |
57 '<(export_h)', | |
58 ], | |
59 'defines': [ | |
60 '<(impl_macro)', | |
61 ], | |
62 'actions': [ | |
63 { | |
64 'action_name': 'gen_files', | |
65 'inputs': [ | |
66 '<(generator_path)', | |
67 '<(generator_dir)/declaration.py', | |
68 '<(generator_dir)/export_h.py', | |
69 '<(generator_dir)/html_view.py', | |
70 '<(generator_dir)/util.py', | |
71 '<(generator_dir)/view_model.py', | |
72 '<(generator_dir)/web_ui_view.py', | |
73 '<(declaration_file)', | |
74 ], | |
75 'outputs': [ | |
76 '<(view_cc)', | |
77 '<(view_h)', | |
78 '<(model_cc)', | |
79 '<(model_h)', | |
80 '<(export_h)', | |
81 ], | |
82 'action': [ | |
83 'python', | |
84 '<(generator_path)', | |
85 '--root=<(DEPTH)', | |
86 '--destination=<(out_dir)', | |
87 '<(declaration_file)' | |
88 ], | |
89 'message': 'Generating C++ code from <(declaration_file).', | |
90 }, | |
91 ], | |
92 'dependencies': [ | |
93 '<(DEPTH)/base/base.gyp:base', | |
94 '<(DEPTH)/components/components.gyp:login', | |
95 '<(DEPTH)/components/components.gyp:webui_generator', | |
96 '<(DEPTH)/components/components_strings.gyp:components_strings', | |
97 '<(DEPTH)/skia/skia.gyp:skia', | |
98 '<!@(<(helper_cl) --output=import_dependencies)', | |
99 ], | |
100 'include_dirs': [ | |
101 '<(DEPTH)', | |
102 '<(out_dir)', | |
103 ], | |
104 'all_dependent_settings': { | |
105 'include_dirs': [ | |
106 '<(DEPTH)', | |
107 '<(out_dir)', | |
108 ], | |
109 }, | |
110 'export_dependent_settings': [ | |
111 '<(DEPTH)/components/components.gyp:webui_generator', | |
112 '<(DEPTH)/components/components.gyp:login', | |
113 ], | |
114 # This target exports a hard dependency because it generates header | |
115 # files. | |
116 'hard_dependency': 1, | |
117 } | |
OLD | NEW |