1load("@rules_android//rules:rules.bzl", "android_binary", "android_library") 2 3# Placeholder manifest is required to build the android library below. 4genrule( 5 name = "gen_placeholdermanifest", 6 outs = ["AndroidManifest.xml"], 7 cmd = """ 8echo '<manifest xmlns:android="http://schemas.android.com/apk/res/android" 9 package="com.android.Music" 10 android:versionCode="1" 11 android:versionName="1.0" > 12 13 <uses-sdk 14 android:minSdkVersion="21" 15 android:targetSdkVersion="21" /> 16</manifest> 17 18' > $@""", 19) 20 21# Workaround a bug where including resources at the top-level android_binary fails, 22# it seems due to the resource folder being nested. Instead, we create this 23# library to hold the resources and make the android_binary target depend on it. 24android_library( 25 name = "MusicResources", 26 srcs = [], 27 custom_package = "com.android.music", 28 manifest = "AndroidManifest.xml", 29 resource_files = glob(["res/**"]), 30 visibility = ["//visibility:public"], 31) 32