OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 # "android/java/src/org/chromium/foo/FooUtil.java", | 27 # "android/java/src/org/chromium/foo/FooUtil.java", |
28 # ] | 28 # ] |
29 # jni_package = "foo" | 29 # jni_package = "foo" |
30 # } | 30 # } |
31 template("generate_jni") { | 31 template("generate_jni") { |
32 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 32 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
33 | 33 |
34 assert(defined(invoker.sources)) | 34 assert(defined(invoker.sources)) |
35 assert(defined(invoker.jni_package)) | 35 assert(defined(invoker.jni_package)) |
36 jni_package = invoker.jni_package | 36 jni_package = invoker.jni_package |
37 base_output_dir = "${root_gen_dir}/${target_name}/${jni_package}" | 37 base_output_dir = "${target_gen_dir}/${target_name}" |
38 jni_output_dir = "${base_output_dir}/jni" | 38 package_output_dir = "${base_output_dir}/${jni_package}" |
| 39 jni_output_dir = "${package_output_dir}/jni" |
39 | 40 |
40 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" | 41 jni_generator_include = "//base/android/jni_generator/jni_generator_helper.h" |
41 | 42 |
42 foreach_target_name = "${target_name}__jni_gen" | 43 foreach_target_name = "${target_name}__jni_gen" |
43 action_foreach(foreach_target_name) { | 44 action_foreach(foreach_target_name) { |
44 script = "//base/android/jni_generator/jni_generator.py" | 45 script = "//base/android/jni_generator/jni_generator.py" |
45 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" | 46 depfile = "$target_gen_dir/$target_name.{{source_name_part}}.d" |
46 sources = invoker.sources | 47 sources = invoker.sources |
47 inputs = [ jni_generator_include ] | 48 inputs = [ jni_generator_include ] |
48 outputs = [ | 49 outputs = [ |
(...skipping 10 matching lines...) Expand all Loading... |
59 "--includes", rebase_path(jni_generator_include, "//"), | 60 "--includes", rebase_path(jni_generator_include, "//"), |
60 ] | 61 ] |
61 if (defined(invoker.jni_generator_jarjar_file)) { | 62 if (defined(invoker.jni_generator_jarjar_file)) { |
62 args += [ | 63 args += [ |
63 "--jarjar", rebase_path(jni_generator_jarjar_file, root_build_dir), | 64 "--jarjar", rebase_path(jni_generator_jarjar_file, root_build_dir), |
64 ] | 65 ] |
65 } | 66 } |
66 } | 67 } |
67 | 68 |
68 config("jni_includes_${target_name}") { | 69 config("jni_includes_${target_name}") { |
69 include_dirs = [ base_output_dir ] | 70 # TODO(cjhopman): #includes should probably all be relative to |
| 71 # base_output_dir. Remove that from this config once the includes are |
| 72 # updated. |
| 73 include_dirs = [ |
| 74 base_output_dir, |
| 75 package_output_dir, |
| 76 ] |
70 } | 77 } |
71 | 78 |
72 group(target_name) { | 79 group(target_name) { |
73 deps = [ ":$foreach_target_name" ] | 80 deps = [ ":$foreach_target_name" ] |
74 public_configs = [ ":jni_includes_${target_name}" ] | 81 public_configs = [ ":jni_includes_${target_name}" ] |
75 | 82 |
76 if (defined(invoker.deps)) { | 83 if (defined(invoker.deps)) { |
77 deps += invoker.deps | 84 deps += invoker.deps |
78 } | 85 } |
79 if (defined(invoker.public_deps)) { | 86 if (defined(invoker.public_deps)) { |
80 public_deps = invoker.public_deps | 87 public_deps = invoker.public_deps |
81 } | 88 } |
| 89 |
| 90 if (defined(invoker.visibility)) { visibility = invoker.visibility } |
82 } | 91 } |
83 } | 92 } |
84 | 93 |
85 | 94 |
86 # Declare a jni target for a prebuilt jar | 95 # Declare a jni target for a prebuilt jar |
87 # | 96 # |
88 # This target generates the native jni bindings for a set of classes in a .jar. | 97 # This target generates the native jni bindings for a set of classes in a .jar. |
89 # | 98 # |
90 # See base/android/jni_generator/jni_generator.py for more info about the | 99 # See base/android/jni_generator/jni_generator.py for more info about the |
91 # format of generating JNI bindings. | 100 # format of generating JNI bindings. |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 984 |
976 android_apk(target_name) { | 985 android_apk(target_name) { |
977 _apk_name = test_suite_name | 986 _apk_name = test_suite_name |
978 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" | 987 final_apk_path = "$root_build_dir/${_apk_name}_apk/${_apk_name}-debug.apk" |
979 java_files = [ | 988 java_files = [ |
980 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" | 989 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" |
981 ] | 990 ] |
982 android_manifest = "//testing/android/java/AndroidManifest.xml" | 991 android_manifest = "//testing/android/java/AndroidManifest.xml" |
983 unittests_outputs = [ unittests_binary ] | 992 unittests_outputs = [ unittests_binary ] |
984 native_libs = [unittests_outputs[0]] | 993 native_libs = [unittests_outputs[0]] |
| 994 deps = [ "//base:base_java" ] |
985 if (defined(invoker.deps)) { | 995 if (defined(invoker.deps)) { |
986 deps = invoker.deps | 996 deps += invoker.deps |
987 } | 997 } |
988 datadeps = [ | 998 datadeps = [ |
989 "//tools/android/md5sum", | 999 "//tools/android/md5sum", |
990 ] | 1000 ] |
991 } | 1001 } |
992 } | 1002 } |
993 | 1003 |
994 # Generate .java files from .aidl files. | 1004 # Generate .java files from .aidl files. |
995 # | 1005 # |
996 # This target will store the .java files in a srcjar and should be included in | 1006 # This target will store the .java files in a srcjar and should be included in |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 } | 1196 } |
1187 | 1197 |
1188 android_library(target_name) { | 1198 android_library(target_name) { |
1189 java_files = [] | 1199 java_files = [] |
1190 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 1200 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
1191 deps = [ | 1201 deps = [ |
1192 "//third_party/android_protobuf:protobuf_nano_javalib", | 1202 "//third_party/android_protobuf:protobuf_nano_javalib", |
1193 ] | 1203 ] |
1194 } | 1204 } |
1195 } | 1205 } |
OLD | NEW |