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

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

Issue 2069273002: [NOT FOR COMMIT] Added GN support for Android .AAR packaged libraries (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Trying a different route from editing build configs Created 4 years, 6 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/android/gyp/unpack_aar.py ('k') | no next file » | 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 4cb5b4d6bce6cdba26e10600cd815ca603f9fd11..ebca5a9c93fdc72ad39e646e8182c295e28eee99 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -2499,4 +2499,72 @@ 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.
+ #
+ # Example
+ # android_aar_prebuilt("foo_aar") {
+ # aar_path = "foo.aar"
+ # }
+ template("android_aar_prebuilt") {
+ assert(defined(invoker.aar_path))
+
+ _output_path = "${root_out_dir}/unpacked_aar/${target_name}"
agrieve 2016/06/28 19:36:05 nit: should use "$target_gen_dir/$target_name"
+ _unpack_target_name = "${target_name}__unpack_aar"
+ _jar_target_name = "${target_name}__jar"
+ _res_target_name = "${target_name}__res"
+
+ action(_unpack_target_name) {
+ script = "//build/android/gyp/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",
+ ]
+
+ _resource_files =
+ exec_script("//build/android/gyp/find.py",
agrieve 2016/06/28 19:36:05 this runs at gn gen time, so won't actually find a
+ rebase_path([ "${_output_path}/res" ], root_out_dir),
+ "list lines")
+
+ outputs += get_path_info(rebase_path(_resource_files, "", root_out_dir),
+ "abspath")
+ }
+
+ java_prebuilt_impl(_jar_target_name) {
agrieve 2016/06/28 19:36:05 would android_rebuilt() work here?
+ deps = [
+ ":$_unpack_target_name",
+ ]
+ jar_path = "${_output_path}/classes.jar"
+ supports_android = true
+ requires_android = true
+ strip_resource_classes = true
+ }
+
+ android_resources(_res_target_name) {
+ deps = [
+ ":$_unpack_target_name",
+ ]
+ resource_dirs = [ "${_output_path}/res" ]
agrieve 2016/06/28 19:36:06 This also results in a find.py at gn gen time. I t
+ android_manifest = "${_output_path}/AndroidManifest.xml"
+ v14_skip = true
+ }
+
+ java_group(target_name) {
+ deps = [
+ ":$_jar_target_name",
+ ":$_res_target_name",
+ ]
+ }
+ }
}
« no previous file with comments | « build/android/gyp/unpack_aar.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698