Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: components/wug/generator/wug.gypi

Issue 928163002: Initial implementation of WebUI generator (WUG) toolkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Owners updated. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..096966e3fd52d4e0b03d76672db2b4a1ea62992a
--- /dev/null
+++ b/components/wug/generator/wug.gypi
@@ -0,0 +1,103 @@
+# 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
+# '_', 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)',
+ },
+ 'target_name': '<!(<(helper_cl) --output=target_name)',
+ 'type': 'static_library',
+ 'sources': [
+ '<(view_cc)',
+ '<(view_h)',
+ '<(model_cc)',
+ '<(model_h)',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'gen_files',
+ 'inputs': [
+ '<(generator_path)',
+ '<(generator_dir)/declaration.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)',
+ ],
+ '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_strings.gyp:components_strings',
+ '<(DEPTH)/components/components.gyp:wug',
+ '<!@(<(helper_cl) --output=import_dependencies)',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)',
+ '<(out_dir)',
+ ],
+ 'all_dependent_settings': {
+ 'include_dirs': [
+ '<(DEPTH)',
+ '<(out_dir)',
+ ],
+ },
+ 'export_dependent_settings': [
+ ],
+ # This target exports a hard dependency because it generates header
+ # files.
+ 'hard_dependency': 1,
+}

Powered by Google App Engine
This is Rietveld 408576698