rules_android icon indicating copy to clipboard operation
rules_android copied to clipboard

Support customizing toolchain level jvm_flags

Open Bencodes opened this issue 2 years ago • 3 comments

Users are unable to easily customize the jvm_flags backing some of the tools in toolchain.bzl as they are all being passed as their raw deploy jars instead of their executable Bazel types.

This means that JVM resource tuning changes like https://github.com/bazelbuild/rules_android/pull/140 will always need to be checked into rules_android or kept in forks rather than leveraging the existing attributes that Bazel provides.

Bencodes avatar Sep 13 '23 21:09 Bencodes

Some refactoring will need to be done but something like this would add some flexibility:

java_binary(
    name = "r8",
    main_class = "com.android.tools.r8.R8",
    visibility = ["//visibility:public"],
    jvm_flags = ["-Xmx8G",  "-XX:ThreadStackSize=2048", ...]
    runtime_deps = ["@android_gmaven_r8//jar"],
)
    r8 = attr.label(
        cfg = "exec",
        default = "//tools/android:r8", # Use the R8 runnable target instead of the deploy jar
        executable = True,
        allow_files = True,
    ),

Bencodes avatar Sep 13 '23 21:09 Bencodes