Chromium Code Reviews| Index: build/config/android/rules.gni |
| diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni |
| index 9ce9747908ad04171534faf1380dc7accff329e7..284257ccc768236da3b3ab46ed10b480d8dae5b5 100644 |
| --- a/build/config/android/rules.gni |
| +++ b/build/config/android/rules.gni |
| @@ -2497,4 +2497,68 @@ if (enable_java_templates) { |
| ] |
| } |
| } |
| + |
| + # Declare an Android library target for a prebuilt aar |
| + # |
| + # This target creates an Android library containing java code and Android |
| + # resources. |
| + # |
| + # Variables |
| + # aar_path: Path to the aar. |
| + # custom_package: Custom package name to be used for the resource |
| + # directory. |
| + # skip_jar: If true do not include classes.jar |
| + # skip_res: If true do not include the resource directory |
| + # |
| + # Example |
| + # android_aar_prebuilt("foo_aar") { |
| + # aar_path = "foo.aar" |
| + # } |
| + template("android_aar_prebuilt") { |
| + set_sources_assignment_filter([]) |
|
agrieve
2016/06/16 02:00:04
no need for this since you aren't using "sources"
|
| + |
| + assert(defined(invoker.aar_path)) |
| + |
| + build_config = "${root_out_dir}/${target_name}.build_config" |
| + |
| + _output_path = "${root_out_dir}/unpacked_aar/${target_name}" |
| + _copied_aar_path = "${_output_path}/${target_name}.aar" |
| + |
| + _unpack_target_name = "${target_name}__unpack_aar" |
| + _copy_target_name = "${target_name}__copy" |
| + |
| + action(_unpack_target_name) { |
| + script = "//build/config/android/unpack_aar.py" # Unzips the AAR |
| + args = [ |
| + rebase_path(invoker.aar_path, root_build_dir), |
| + rebase_path(_output_path, root_build_dir), |
| + ] |
| + outputs = [ |
| + "${_output_path}/AndroidManifest.xml", |
| + "${_output_path}/classes.jar", |
| + "${_output_path}/R.txt", |
| + ] |
| + } |
| + |
| + copy(_copy_target_name) { |
|
agrieve
2016/06/16 02:00:04
Why copy it?
|
| + sources = [ |
| + rebase_path(invoker.aar_path, root_build_dir), |
| + ] |
| + outputs = [ |
| + _copied_aar_path, |
| + ] |
| + } |
| + |
| + write_build_config(target_name) { |
| + deps = [ |
| + ":$_copy_target_name", |
| + ":$_unpack_target_name", |
| + ] |
| + |
| + type = "android_aar" |
| + jar_path = "${_output_path}/classes.jar" |
| + r_text = "${_output_path}/R.txt" |
| + resources_zip = _copied_aar_path |
| + } |
| + } |
| } |