Chromium Code Reviews| Index: components/wug/generator/wug.gypi |
| diff --git a/components/wug/generator/wug.gypi b/components/wug/generator/wug.gypi |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3ebe86f6359287cbe106530f41b09af37dbdbdd8 |
| --- /dev/null |
| +++ b/components/wug/generator/wug.gypi |
| @@ -0,0 +1,116 @@ |
| +# Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# This file included into a targets definition creates a target that generates |
| +# native and HTML/JS supporting code for Web UI element from element's |
| +# declaration JSON file. |
| +# |
| +# Example: |
| +# 'targets': [ |
| +# ... |
| +# { |
| +# 'variables': { |
| +# 'declaration_file': 'path/to/file.json' |
| +# } |
| +# 'includes': ['path/to/this/file.gypi'] |
| +# }, |
| +# ... |
| +# ] |
| +# |
| +# Such inclusion creates a target, which name is deduced from declaration file's |
| +# 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.
|
| +# '_', e.g. for declaration file with full path 'full/path/to/file.json' target |
| +# name will be 'full_path_to_file_json'. This is needed to properly handle |
| +# dependencies between declaration files and their imports. |
| +# |
| +# Created target generates and compiles 4 files: |
| +# <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_webui_view.h |
| +# <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_webui_view.cc |
| +# <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_view_model.h |
| +# <(SHARED_INTERMEDIATE_DIR)/wug/full/path/to/file_view_model.cc |
| + |
| +{ |
| + 'variables': { |
| + 'generator_dir': '<(DEPTH)/components/wug/generator', |
| + 'helper_path': '<(generator_dir)/build_helper.py', |
| + 'generator_path': '<(generator_dir)/gen_sources.py', |
| + 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/wug', |
| + 'helper_cl': 'python <(helper_path) --root=<(DEPTH) <(declaration_file)', |
| + 'dirname': '<(out_dir)/<!(<(helper_cl) --output=dirname)', |
| + 'view_cc': '<(dirname)/<!(<(helper_cl) --output=view_cc)', |
| + 'view_h': '<(dirname)/<!(<(helper_cl) --output=view_h)', |
| + 'model_cc': '<(dirname)/<!(<(helper_cl) --output=model_cc)', |
| + 'model_h': '<(dirname)/<!(<(helper_cl) --output=model_h)', |
| + 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', |
| + 'export_h': '<(dirname)/<!(<(helper_cl) --output=export_h)', |
| + 'impl_macro': '<!(<(helper_cl) --output=impl_macro)', |
| + }, |
| + 'target_name': '<!(<(helper_cl) --output=target_name)', |
| + 'type': '<(component)', |
| + 'sources': [ |
| + '<(view_cc)', |
| + '<(view_h)', |
| + '<(model_cc)', |
| + '<(model_h)', |
| + '<(export_h)', |
| + ], |
| + 'defines': [ |
| + '<(impl_macro)', |
| + ], |
| + 'actions': [ |
| + { |
| + 'action_name': 'gen_files', |
| + 'inputs': [ |
| + '<(generator_path)', |
| + '<(generator_dir)/declaration.py', |
| + '<(generator_dir)/export_h.py', |
| + '<(generator_dir)/html_view.py', |
| + '<(generator_dir)/util.py', |
| + '<(generator_dir)/view_model.py', |
| + '<(generator_dir)/web_ui_view.py', |
| + '<(declaration_file)', |
| + ], |
| + 'outputs': [ |
| + '<(view_cc)', |
| + '<(view_h)', |
| + '<(model_cc)', |
| + '<(model_h)', |
| + '<(export_h)', |
| + ], |
| + 'action': [ |
| + 'python', |
| + '<(generator_path)', |
| + '--root=<(DEPTH)', |
| + '--destination=<(out_dir)', |
| + '<(declaration_file)' |
| + ], |
| + 'message': 'Generating C++ code from <(declaration_file).', |
| + }, |
| + ], |
| + 'dependencies': [ |
| + '<(DEPTH)/base/base.gyp:base', |
| + '<(DEPTH)/components/components.gyp:login', |
| + '<(DEPTH)/components/components.gyp:wug', |
| + '<(DEPTH)/components/components_strings.gyp:components_strings', |
| + '<(DEPTH)/skia/skia.gyp:skia', |
| + '<!@(<(helper_cl) --output=import_dependencies)', |
| + ], |
| + 'include_dirs': [ |
| + '<(DEPTH)', |
| + '<(out_dir)', |
| + ], |
| + 'all_dependent_settings': { |
| + 'include_dirs': [ |
| + '<(DEPTH)', |
| + '<(out_dir)', |
| + ], |
| + }, |
| + 'export_dependent_settings': [ |
| + '<(DEPTH)/components/components.gyp:wug', |
| + '<(DEPTH)/components/components.gyp:login', |
| + ], |
| + # This target exports a hard dependency because it generates header |
| + # files. |
| + 'hard_dependency': 1, |
| +} |