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

Unified Diff: build/config/android/rules.gni

Issue 525533003: Add content_shell_test_apk and a several dependencies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-content-shell-apk
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/config/android/internal_rules.gni ('k') | build/toolchain/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/rules.gni
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index 510f516f47d3532544d8be43333bc274a6dc8294..e6df98b6e9bf369c57536aa6bb47ca5920f47733 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -620,6 +620,11 @@ template("android_apk") {
} else if (defined(invoker.apk_name)) {
_final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk"
}
+ _dist_jar_path_list = process_file_template(
+ [ _final_apk_path ],
+ "$root_build_dir/test.lib.java/{{source_name_part}}.jar"
+ )
+ _dist_jar_path = _dist_jar_path_list[0]
_native_libs = []
if (defined(invoker.native_libs)) {
@@ -627,6 +632,12 @@ template("android_apk") {
_native_libs_dir = base_path + "/libs"
}
+ _has_java = (
+ defined(invoker.java_files)
+ || defined(invoker.DEPRECATED_java_in_dir)
+ || _native_libs != []
+ )
+
_keystore_path = android_default_keystore_path
_keystore_name = android_default_keystore_name
_keystore_password = android_default_keystore_password
@@ -707,25 +718,63 @@ template("android_apk") {
_srcjar_deps += [ ":${_template_name}__native_libraries_java" ]
}
- final_deps += [":${_template_name}__java"]
- android_java_library("${_template_name}__java") {
- android_manifest = invoker.android_manifest
- if (defined(invoker.java_files)) {
- java_files = invoker.java_files
- } else {
- DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
+ if (_has_java) {
+ final_deps += [ ":${_template_name}__java" ]
+ android_java_library("${_template_name}__java") {
+ android_manifest = invoker.android_manifest
+ if (defined(invoker.java_files)) {
+ java_files = invoker.java_files
+ } else if (defined(invoker.DEPRECATED_java_in_dir)) {
+ DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
+ } else {
+ assert(_srcjar_deps != [])
+ java_files = []
+ }
+ srcjar_deps = _srcjar_deps
+ dex_path = base_path + ".dex.jar"
+ }
+ } else {
+ assert(_srcjar_deps == [])
+ }
+
+ if (_dist_jar_path != "") {
+ # TODO(cjhopman): This is only ever needed to calculate the list of tests to
+ # run. See build/android/pylib/instrumentation/test_jar.py. We should be
+ # able to just do that calculation at build time instead.
+ action("${_template_name}__create_dist_jar") {
+ script = "//build/android/gyp/create_dist_jar.py"
+ depfile = "$target_gen_dir/$target_name.d"
+ inputs = [ build_config ]
+ outputs = [
+ depfile,
+ _dist_jar_path,
+ ]
+ args = [
+ "--depfile", rebase_path(depfile, root_build_dir),
+ "--output", rebase_path(_dist_jar_path, root_build_dir),
+ "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)",
+ ]
+ if (_has_java) {
+ inputs += [ jar_path ]
+ _rebased_jar_path = rebase_path([ jar_path ], root_build_dir)
+ args += [
+ "--inputs=$_rebased_jar_path",
+ ]
+ }
}
- srcjar_deps = _srcjar_deps
- dex_path = base_path + ".dex.jar"
}
final_deps += [":${_template_name}__final_dex"]
dex("${_template_name}__final_dex") {
- sources = [jar_path]
- inputs = [build_config]
+ sources = []
+ if (_has_java) {
+ deps = [ ":${_template_name}__java" ]
+ sources += [ jar_path ]
+ }
+ inputs = [ build_config ]
output = final_dex_path
dex_arg_key = "${_rebased_build_config}:apk_dex:dependency_dex_files"
- args = ["--inputs=@FileArg($dex_arg_key)"]
+ args = [ "--inputs=@FileArg($dex_arg_key)" ]
}
if (_native_libs != []) {
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | build/toolchain/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698