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.
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.
14 # 'declaration_file': 'path/to/file.json'
16 # 'includes': ['path/to/this/file.gypi']
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.
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
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)',
50 'target_name': '<!(<(helper_cl) --output=target_name)',
51 'type': '<(component)',
64 'action_name': 'gen_files',
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)',
86 '--destination=<(out_dir)',
89 'message': 'Generating C++ code from <(declaration_file).',
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)',
104 'all_dependent_settings': {
110 'export_dependent_settings': [
111 '<(DEPTH)/components/components.gyp:webui_generator',
112 '<(DEPTH)/components/components.gyp:login',
114 # This target exports a hard dependency because it generates header
116 'hard_dependency': 1,