diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-08-13 03:52:13 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-08-13 03:52:13 +0000 |
commit | 3a9c8f161d2f998518a2d2142f8136f253381c0a (patch) | |
tree | cbb3546d5c6eb60c2856d199f348b73c8b223fc0 | |
parent | 46d39a31649bece25b7cc0ae02cdbb07cbabdb83 (diff) | |
parent | 17ea98281bee0e5f5e753389a1ea10fcdadba6e1 (diff) | |
download | Music-3a9c8f161d2f998518a2d2142f8136f253381c0a.tar.gz |
Merge "Declare resources in a library under kotlin/ for Music app Bazel build." am: ca7f4e1cb7 am: 7695928d87 am: 17ea98281b
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Music/+/1794547
Change-Id: Ib79e86a6960e5d260a2a163a24577c00c9aa67d9
-rw-r--r-- | BUILD | 2 | ||||
-rw-r--r-- | kotlin/BUILD | 31 |
2 files changed, 32 insertions, 1 deletions
@@ -5,5 +5,5 @@ android_binary( srcs = glob(["src/**/*.java"]), custom_package = "com.android.music", manifest = "AndroidManifest.xml", - resource_files = glob(["kotlin/res/**"]), + deps = ["//packages/apps/Music/kotlin:MusicResources"], ) diff --git a/kotlin/BUILD b/kotlin/BUILD new file mode 100644 index 0000000..ab0691c --- /dev/null +++ b/kotlin/BUILD @@ -0,0 +1,31 @@ +load("@rules_android//rules:rules.bzl", "android_binary", "android_library") + +# Placeholder manifest is required to build the android library below. +genrule( + name = "gen_placeholdermanifest", + outs = ["AndroidManifest.xml"], + cmd = """ +echo '<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.Music" + android:versionCode="1" + android:versionName="1.0" > + + <uses-sdk + android:minSdkVersion="21" + android:targetSdkVersion="21" /> +</manifest> + +' > $@""", +) + +# Workaround a bug where including resources at the top-level android_binary fails, +# it seems due to the resource folder being nested. Instead, we create this +# library to hold the resources and make the android_binary target depend on it. +android_library( + name = "MusicResources", + srcs = [], + custom_package = "com.android.music", + manifest = "AndroidManifest.xml", + resource_files = glob(["res/**"]), + visibility = ["//visibility:public"], +) |