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

Unified Diff: build/android/java_cpp_template.gypi

Issue 11415152: build/java_cpp_template.gypi: new build rules. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | net/android/java/NetError.template » ('j') | net/net.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/java_cpp_template.gypi
diff --git a/build/android/java_cpp_template.gypi b/build/android/java_cpp_template.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..a222e15d7d46ec3ef5f9f95fc90b5e5db59fd803
--- /dev/null
+++ b/build/android/java_cpp_template.gypi
@@ -0,0 +1,71 @@
+# Copyright (c) 2012 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 is meant to be included into a target to provide a rule
+# to generate Java source files from templates that are processed
+# through the host C pre-processor.
+#
+# This assumes a GNU-compatible pre-processor installed as 'cpp'.
+# Only tested on Linux.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'android_net_java_constants',
+# 'type': 'none',
+# 'sources': [
+# 'net/base/certificate_mime_type_list.h',
+# 'net/android/NetError.template',
+# ],
+# 'variables': {
+# 'package_name': 'org.chromium.net',
+# },
+# 'includes': [ '../build/android/java_constants.gypi' ],
+# },
+#
+# The 'sources' entry should list all input files. The template file
+# itself should use the 'ClassName.template' format, and will generate
+# 'gen/templates/<package-name>/ClassName.java. Other source files
+# are those typically included by the template. Any change to them
+# will force a rebuild of the template, and hence of any source that
+# depends on it.
+#
+
+{
+ # Location where all generated Java sources will be placed.
+ 'variables': {
+ 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(package_name)'
+ },
+ # Ensure that the output directory is used in the class path
+ # when building targets that depend on this one.
+ 'direct_dependent_settings': {
+ 'variables': {
+ 'generated_src_dirs': [
+ '<(output_dir)/',
+ ],
+ },
+ },
+ # Define a single rule that will be apply to each .template file
+ # listed in 'sources'.
+ 'rules': [
+ {
+ 'rule_name': 'generate_java_constants',
+ 'extension': 'template',
+ 'inputs': [
+ '<(RULE_INPUT_PATH)',
+ ],
+ 'outputs': [
+ '<(output_dir)/<(RULE_INPUT_ROOT).java'
+ ],
+ 'action': [
+ 'cpp', # invoke host pre-processor.
+ '-x', 'c-header', # treat sources as C header files
+ '-P', # disable line markers, i.e. '#line 309'
+ '-I', '<(DEPTH)', # Add project top-level to include path
+ '-o', '<@(_outputs)', # Specify output file
+ '<(RULE_INPUT_PATH)', # Specify input file
+ ],
+ 'message': 'Generating Java from cpp template <(RULE_INPUT_PATH)',
+ }
+ ],
+}
« no previous file with comments | « no previous file | net/android/java/NetError.template » ('j') | net/net.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698