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/wug/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 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', |
| 49 'impl_macro': '<!(<(helper_cl) --output=impl_macro)', |
| 50 }, |
| 51 'target_name': '<!(<(helper_cl) --output=target_name)', |
| 52 'type': '<(component)', |
| 53 'sources': [ |
| 54 '<(view_cc)', |
| 55 '<(view_h)', |
| 56 '<(model_cc)', |
| 57 '<(model_h)', |
| 58 '<(export_h)', |
| 59 ], |
| 60 'defines': [ |
| 61 '<(impl_macro)', |
| 62 ], |
| 63 'actions': [ |
| 64 { |
| 65 'action_name': 'gen_files', |
| 66 'inputs': [ |
| 67 '<(generator_path)', |
| 68 '<(generator_dir)/declaration.py', |
| 69 '<(generator_dir)/export_h.py', |
| 70 '<(generator_dir)/html_view.py', |
| 71 '<(generator_dir)/util.py', |
| 72 '<(generator_dir)/view_model.py', |
| 73 '<(generator_dir)/web_ui_view.py', |
| 74 '<(declaration_file)', |
| 75 ], |
| 76 'outputs': [ |
| 77 '<(view_cc)', |
| 78 '<(view_h)', |
| 79 '<(model_cc)', |
| 80 '<(model_h)', |
| 81 '<(export_h)', |
| 82 ], |
| 83 'action': [ |
| 84 'python', |
| 85 '<(generator_path)', |
| 86 '--root=<(DEPTH)', |
| 87 '--destination=<(out_dir)', |
| 88 '<(declaration_file)' |
| 89 ], |
| 90 'message': 'Generating C++ code from <(declaration_file).', |
| 91 }, |
| 92 ], |
| 93 'dependencies': [ |
| 94 '<(DEPTH)/base/base.gyp:base', |
| 95 '<(DEPTH)/components/components.gyp:login', |
| 96 '<(DEPTH)/components/components.gyp:wug', |
| 97 '<(DEPTH)/components/components_strings.gyp:components_strings', |
| 98 '<(DEPTH)/skia/skia.gyp:skia', |
| 99 '<!@(<(helper_cl) --output=import_dependencies)', |
| 100 ], |
| 101 'include_dirs': [ |
| 102 '<(DEPTH)', |
| 103 '<(out_dir)', |
| 104 ], |
| 105 'all_dependent_settings': { |
| 106 'include_dirs': [ |
| 107 '<(DEPTH)', |
| 108 '<(out_dir)', |
| 109 ], |
| 110 }, |
| 111 'export_dependent_settings': [ |
| 112 '<(DEPTH)/components/components.gyp:wug', |
| 113 '<(DEPTH)/components/components.gyp:login', |
| 114 ], |
| 115 # This target exports a hard dependency because it generates header |
| 116 # files. |
| 117 'hard_dependency': 1, |
| 118 } |
OLD | NEW |