diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 04:39:52 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 04:39:52 +0000 |
commit | 65208a08fd10dc98b4c21676d5113359303a12a6 (patch) | |
tree | b178d8ec34465c308f737a657936907a38a65fc0 /build | |
parent | 636295605fea1bf869738dc36315afbc3a2dfa28 (diff) | |
download | chromium_src-65208a08fd10dc98b4c21676d5113359303a12a6.zip chromium_src-65208a08fd10dc98b4c21676d5113359303a12a6.tar.gz chromium_src-65208a08fd10dc98b4c21676d5113359303a12a6.tar.bz2 |
Add templates for building java and running the jni_generator.
As requested in http://codereview.chromium.org/10073024/, I've created
templates for these two actions. I've also applied them to base.
Review URL: http://codereview.chromium.org/10081035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132537 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/java.gypi | 53 | ||||
-rw-r--r-- | build/jni_generator.gypi | 56 |
2 files changed, 109 insertions, 0 deletions
diff --git a/build/java.gypi b/build/java.gypi new file mode 100644 index 0000000..9a6a6ed --- /dev/null +++ b/build/java.gypi @@ -0,0 +1,53 @@ +# 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 build Java in a consistent manner. +# +# To use this, create a gyp target with the following form: +# { +# 'target_name': 'my-package_java', +# 'type': 'none', +# 'variables': { +# 'package_name': 'my-package', +# 'java_in_dir': 'path/to/package/root', +# }, +# 'includes': ['path/to/this/gypi/file'], +# } +# +# Note that this assumes that there's ant buildfile with package_name in +# java_in_dir. So if if you have package_name="base" and +# java_in_dir="base/android/java" you should have a directory structure like: +# +# base/android/java/base.xml +# base/android/java/org/chromium/base/Foo.java +# base/android/java/org/chromium/base/Bar.java +# +# Finally, the generated jar-file will be: +# <(PRODUCT_DIR)/chromium_base.jar +# +# TODO(yfriedman): The "finally" statement isn't entirely true yet, as we don't +# auto-generate the ant file yet. + +{ + 'actions': [ + { + 'action_name': 'ant_<(package_name)', + 'message': 'Building <(package_name) java sources.', + 'inputs': [ + '<(java_in_dir)/<(package_name).xml', + '<!@(find <(java_in_dir) -name "*.java")' + ], + 'outputs': [ + '<(PRODUCT_DIR)/chromium_<(package_name).jar', + ], + 'action': [ + 'ant', + '-DPRODUCT_DIR=<(PRODUCT_DIR)', + '-buildfile', + '<(java_in_dir)/<(package_name).xml', + ] + }, + ], +} diff --git a/build/jni_generator.gypi b/build/jni_generator.gypi new file mode 100644 index 0000000..b570026 --- /dev/null +++ b/build/jni_generator.gypi @@ -0,0 +1,56 @@ +# 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 jni bindings for Java-files in a consistent manner. +# +# To use this, create a gyp target with the following form: +# { +# 'target_name': 'base_jni_headers', +# 'type': 'none', +# 'variables': { +# 'java_sources': [ +# 'android/java/org/chromium/base/BuildInfo.java', +# 'android/java/org/chromium/base/PathUtils.java', +# 'android/java/org/chromium/base/SystemMessageHandler.java', +# ], +# 'jni_headers': [ +# '<(SHARED_INTERMEDIATE_DIR)/base/jni/build_info_jni.h', +# '<(SHARED_INTERMEDIATE_DIR)/base/jni/path_utils_jni.h', +# '<(SHARED_INTERMEDIATE_DIR)/base/jni/system_message_handler_jni.h', +# ], +# }, +# 'includes': [ '../build/jni_generator.gypi' ], +# } +# +# The ordering of the java_sources must match the ordering of jni_headers. The +# result is that for each Java file listed in java_sources, the corresponding +# entry in jni_headers contains the JNI bindings produced from running the +# jni_generator on the input file. +# +# See base/android/jni_generator/jni_generator.py for more info about the +# format of generating JNI bindings. + +{ + 'actions': [ + { + 'action_name': 'generate_jni_headers', + 'type': 'none', + 'inputs': [ + '<(DEPTH)/base/android/jni_generator/jni_generator.py', + '<@(java_sources)', + ], + 'outputs': [ + '<@(jni_headers)', + ], + 'action': [ + 'python', + '<(DEPTH)/base/android/jni_generator/jni_generator.py', + '-o', + '<@(_inputs)', + '<@(_outputs)', + ], + }, + ], +} |