Chromium Code Reviews| Index: build/config/android/internal_rules.gni |
| diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni |
| index d68125ac505e693378abcd4094a98a31c91fe2be..56e42c2d47c74c0811e99d38affc9612f7d28280 100644 |
| --- a/build/config/android/internal_rules.gni |
| +++ b/build/config/android/internal_rules.gni |
| @@ -62,6 +62,7 @@ template("write_build_config") { |
| if (type == "android_library" || type == "android_apk") { |
| args += [ |
| "--jar-path", rebase_path(invoker.jar_path, root_build_dir), |
| + "--dex-path", rebase_path(invoker.dex_path, root_build_dir), |
| ] |
| } |
| @@ -110,6 +111,40 @@ template("zip") { |
| } |
| } |
| +template("dex") { |
| + 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 |
| + outputs = [depfile, invoker.output] |
| + if (defined(invoker.inputs)) { |
| + inputs = invoker.inputs |
| + } |
| + |
| + rebase_output = rebase_path(invoker.output, root_build_dir) |
|
newt (away)
2014/07/18 21:19:18
s/rebase/rebased
cjhopman
2014/07/28 21:58:52
Done.
|
| + |
| + args = [ |
| + "--depfile", rebase_path(depfile, root_build_dir), |
| + "--android-sdk-tools", rebased_android_sdk_build_tools, |
| + "--dex-path", rebase_output, |
| + ] |
| + |
| + if (defined(invoker.no_locals) && invoker.no_locals) { |
| + args += [ |
| + "--no-locals=1" |
| + ] |
| + } |
| + |
| + if (defined(invoker.args)) { |
| + args += invoker.args |
| + } |
| + |
| + args += rebase_path(invoker.sources, root_build_dir) |
| + } |
| +} |
| + |
| # Compiles and jars a set of java files. |
| # |
| # Outputs: |
| @@ -230,8 +265,10 @@ template("android_java_library") { |
| assert(defined(invoker.java_files)) |
| assert(defined(invoker.build_config)) |
| assert(defined(invoker.jar_path)) |
| + assert(defined(invoker.dex_path)) |
| jar_path = invoker.jar_path |
| + dex_path = invoker.dex_path |
| java_library("${target_name}__java_library") { |
| if (defined(invoker.jar_excluded_patterns)) { |
| @@ -246,11 +283,17 @@ template("android_java_library") { |
| } |
| # TODO(cjhopman): lint |
| - # TODO(cjhopman): dex |
| + |
| + |
| + dex("${target_name}__dex") { |
|
newt (away)
2014/07/18 21:19:18
I didn't realize we generated a dex file for each
cjhopman
2014/07/28 21:58:52
Dexing is slow. Doing it this way makes it so that
|
| + sources = [jar_path] |
| + output = dex_path |
| + } |
| group(target_name) { |
| deps = [ |
| - ":${target_name}__java_library" |
| + ":${target_name}__java_library", |
| + ":${target_name}__dex", |
| ] |
| } |
| } |