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

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, 3 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
« no previous file with comments | « build/android/gyp/java_cpp_enum_tests.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5fd26f3dc0a34d2ad99847a1540bafc071f274a8
--- /dev/null
+++ b/build/android/java_cpp_enum.gypi
@@ -0,0 +1,59 @@
+# 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 an action
+# to generate Java source files from a C++ header file containing annotated
+# enum definitions using a Python script.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'bitmap_format_java',
+# 'type': 'none',
+# 'variables': {
+# 'source_file': 'ui/android/bitmap_format.h',
+# },
+# 'includes': [ '../build/android/java_cpp_enum.gypi' ],
+# },
+#
+# Then have the gyp target which compiles the java code depend on the newly
+# created target.
+
+{
+ 'variables': {
+ # Location where all generated Java sources will be placed.
+ 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/enums',
+ 'generator_path': '<(DEPTH)/build/android/gyp/java_cpp_enum.py',
+ 'generator_args': '--output_dir=<(output_dir) <(source_file)',
+ },
+ '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)/',
+ ],
+ },
+ },
+ 'actions': [
+ {
+ 'action_name': 'generate_java_constants',
+ 'inputs': [
+ '<(DEPTH)/build/android/gyp/util/build_utils.py',
+ '<(generator_path)',
+ '<(source_file)',
+ ],
+ 'outputs': [
+ # This is the main reason this is an action and not a rule. Gyp doesn't
+ # properly expand RULE_INPUT_PATH here and so it's impossible to
+ # calculate the list of outputs.
+ '<!@pymod_do_main(java_cpp_enum --print_output_only '
+ '<@(generator_args))',
+ ],
+ 'action': [
+ 'python', '<(generator_path)', '<@(generator_args)'
+ ],
+ 'message': 'Generating Java from cpp header <(source_file)',
+ },
+ ],
+}
« no previous file with comments | « build/android/gyp/java_cpp_enum_tests.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698