This adds a template for using the jni_generator. Creates the
base_jni_headers target and updates the base target to depend on it and
actually use the sources that required it.

Adds //third_party/android_tools:cpu_features required by one of the
base files that also required jni.

Disable a bunch of third_party targets for Android builds.

BUG=359249

Review URL: https://codereview.chromium.org/237973002

git-svn-id: http://src.chromium.org/svn/trunk/src/build@264695 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
cjhopman@chromium.org 2014-04-18 00:50:10 +00:00
Родитель e500a98327
Коммит aa2daa3f51
1 изменённых файлов: 61 добавлений и 0 удалений

61
config/android/rules.gni Normal file
Просмотреть файл

@ -0,0 +1,61 @@
# 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.
# Declare a jni target
#
# This target generates the native jni bindings for a set of .java files.
#
# See base/android/jni_generator/jni_generator.py for more info about the
# format of generating JNI bindings.
#
# Variables
# sources: list of .java files to generate jni for
# jni_package: subdirectory path for generated bindings
#
# Example
# generate_jni("foo_jni") {
# sources = [
# "android/java/src/org/chromium/foo/Foo.java",
# "android/java/src/org/chromium/foo/FooUtil.java",
# ]
# jni_package = "foo"
# }
template("generate_jni") {
assert(defined(invoker.sources))
assert(defined(invoker.jni_package))
jni_package = invoker.jni_package
base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}"
jni_output_dir = "${base_output_dir}/jni"
jni_generator_includes =
rebase_path("//base/android/jni_generator/jni_generator_helper.h")
config("jni_includes_${target_name}") {
include_dirs = [ base_output_dir ]
}
action_foreach(target_name) {
script = "//base/android/jni_generator/jni_generator.py"
direct_dependent_configs = [ ":jni_includes_${target_name}" ]
sources = invoker.sources
outputs = [
"${jni_output_dir}/{{source_name_part}}_jni.h"
]
args = [
"--input_file={{source}}",
"--optimize_generation=1",
"--ptr_type=long",
"--output_dir", rebase_path(jni_output_dir),
"--includes=${jni_generator_includes}",
]
if (defined(invoker.jni_generator_jarjar_file)) {
args += [
"--jarjar", rebase_path(jni_generator_jarjar_file)
]
}
hard_dep = true
}
}