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

Unified Diff: build/android/java_cpp_enum.gypi

Issue 484603004: New C++ -> Java enum build rule + parser/generator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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: build/android/java_cpp_enum.gypi
diff --git a/build/android/java_cpp_enum.gypi b/build/android/java_cpp_enum.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..602431ccdfb6004146f5c10d00492dfaa96aadf5
--- /dev/null
+++ b/build/android/java_cpp_enum.gypi
@@ -0,0 +1,69 @@
+# Copyright 2014 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
Yaron 2014/08/20 05:52:02 Could use a little more description as it's more s
mkosiba (inactive) 2014/09/02 16:00:57 Done.
+# through a Python script.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'android_net_java_constants',
Yaron 2014/08/20 05:52:02 The first example of this, isn't using this struct
mkosiba (inactive) 2014/09/02 16:00:57 Done.
+# 'type': 'none',
+# 'sources': [
+# 'net/base/certificate_mime_type_list.h'
+# ],
+# 'variables': [
+# 'package_name': 'org/chromium/ui',
Yaron 2014/08/20 05:52:02 Maybe this is copied from elsewhere, but this shou
mkosiba (inactive) 2014/09/02 16:00:57 Done.
+# 'class_name': 'CertificateMimeTypeList',
+# ],
+# 'includes': [ '../build/android/java_cpp_enum.gypi' ],
+# },
+#
+
+{
+ # Location where all generated Java sources will be placed.
+ 'variables': {
+ 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/templates/<(package_name)',
+ },
+ 'direct_dependent_settings': {
+ 'variables': {
+ # Ensure that the output directory is used in the class path
+ # when building targets that depend on this one.
+ 'generated_src_dirs': [
+ '<(output_dir)/',
+ ],
+ # Ensure dependents are rebuilt when sources for this rule change.
+ 'additional_input_paths': [
+ '<@(_sources)',
+ ],
+ },
+ },
+ # Define a single rule that will be apply to each file listed in 'sources'.
+ 'rules': [
+ {
+ 'rule_name': 'generate_java_constants',
+ 'extension': 'h',
+ 'variables': {
+ 'output_path': '<(output_dir)/<(class_name).java',
+ },
+ 'inputs': [
+ '<(DEPTH)/build/android/gyp/util/build_utils.py',
+ '<(DEPTH)/build/android/gyp/enum_preprocess.py',
+ '<@(_sources)',
+ ],
+ 'outputs': [
+ '<(output_path)',
+ ],
+ 'action': [
+ 'python', '<(DEPTH)/build/android/gyp/enum_preprocess.py',
+ '--output=<(output_path)',
+ '--package=<(package_name)',
+ '--class_name=<(class_name)',
+ '<(RULE_INPUT_PATH)',
+ ],
+ 'message': 'Generating Java from cpp header <(RULE_INPUT_PATH)',
+ }
+ ],
+}
+

Powered by Google App Engine
This is Rietveld 408576698