Index: build/config/android/internal_rules.gni |
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
index ce6e4281883753a475433042f1727a28f64afdac..37727692965b6eb46ec368d23ab3bd5223129ca7 100644 |
--- a/build/config/android/internal_rules.gni |
+++ b/build/config/android/internal_rules.gni |
@@ -66,12 +66,13 @@ template("dex") { |
testonly = invoker.testonly |
} |
- assert(defined(invoker.sources)) |
assert(defined(invoker.output)) |
action(target_name) { |
script = "//build/android/gyp/dex.py" |
depfile = "$target_gen_dir/$target_name.d" |
- sources = invoker.sources |
+ if (defined(invoker.sources)) { |
+ sources = invoker.sources |
+ } |
outputs = [ |
depfile, |
invoker.output, |
@@ -103,7 +104,9 @@ template("dex") { |
args += invoker.args |
} |
- args += rebase_path(invoker.sources, root_build_dir) |
+ if (defined(invoker.sources)) { |
+ args += rebase_path(invoker.sources, root_build_dir) |
+ } |
} |
} |
@@ -163,7 +166,7 @@ template("write_build_config") { |
build_config = invoker.build_config |
assert(type == "android_apk" || type == "java_library" || |
- type == "android_resources") |
+ type == "android_resources" || type == "deps_dex") |
action(target_name) { |
script = "//build/android/gyp/write_build_config.py" |
@@ -201,11 +204,12 @@ template("write_build_config") { |
is_java_library = type == "java_library" |
is_apk = type == "android_apk" |
is_android_resources = type == "android_resources" |
+ is_deps_dex = type == "deps_dex" |
- supports_android = is_apk || is_android_resources || |
+ supports_android = is_apk || is_android_resources || is_deps_dex || |
(is_java_library && defined(invoker.supports_android) && |
invoker.supports_android) |
- requires_android = is_apk || is_android_resources || |
+ requires_android = is_apk || is_android_resources || is_deps_dex || |
(is_java_library && defined(invoker.requires_android) && |
invoker.requires_android) |
@@ -216,6 +220,7 @@ template("write_build_config") { |
assert(is_java_library || true) |
assert(is_apk || true) |
assert(is_android_resources || true) |
+ assert(is_deps_dex || true) |
if (is_java_library || is_apk) { |
args += [ |
@@ -224,7 +229,7 @@ template("write_build_config") { |
] |
} |
- if (is_apk || (is_java_library && supports_android)) { |
+ if (is_apk || is_deps_dex || (is_java_library && supports_android)) { |
args += [ |
"--dex-path", |
rebase_path(invoker.dex_path, root_build_dir), |
@@ -898,22 +903,6 @@ template("java_library_impl") { |
] |
output = _dex_path |
} |
- |
- if (defined(invoker.standalone_dex_path)) { |
- _final_deps += [ ":${_template_name}__standalone_dex" ] |
- _rebased_build_config = rebase_path(_build_config, root_build_dir) |
- dex("${_template_name}__standalone_dex") { |
- sources = [ |
- _jar_path, |
- ] |
- inputs = [ |
- _build_config, |
- ] |
- output = invoker.standalone_dex_path |
- dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
- args = [ "--inputs=@FileArg($dex_arg_key)" ] |
- } |
- } |
} |
group(target_name) { |
@@ -1061,3 +1050,25 @@ template("copy_ex") { |
} |
} |
} |
+ |
+# Produces a single .dex.jar out of a set of Java dependencies. |
+template("deps_dex") { |
+ build_config = "$target_gen_dir/${target_name}.build_config" |
+ write_build_config("${target_name}__build_config") { |
+ type = "deps_dex" |
+ deps = invoker.deps |
+ |
+ build_config = build_config |
+ dex_path = invoker.dex_path |
+ } |
+ |
+ rebased_build_config = rebase_path(build_config, root_build_dir) |
+ dex(target_name) { |
+ inputs = [ |
+ build_config, |
+ ] |
+ output = invoker.dex_path |
+ dex_arg_key = "${rebased_build_config}:final_dex:dependency_dex_files" |
+ args = [ "--inputs=@FileArg($dex_arg_key)" ] |
+ } |
+} |