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