bazelbuild/rules_android

Support bundling local resource from `resources/` dir into `android_library` and `android_binary`

ThomasCJY opened this issue · 1 comments

Background
In gradle, local resources located under resources folder, such as src/main/resources, will be automatically packaged under the generated aar/apk.

See code here:

Currently in bazel android rule, we only support regular res and asset and it's impossible to port any other type of resources into final apk as gradle does. One use case is to support ASAN android build https://developer.android.com/ndk/guides/asan#running which requires to bundle a wrap.sh under lib/ path of the final apk
Screenshot 2023-12-12 at 1 49 00 PM

This can be work around by using java_library to package resources

java_library(
    name = "res_generated_lib_java" ,
    srcs = [],
    resources = glob(
        ["lib/wrap.sh"],
    ),
    resource_strip_prefix = PARENT_DIR,
)