bazelbuild / rules_kotlin

Bazel rules for Kotlin
Apache License 2.0
331 stars 206 forks source link

Can't add assets to kt_android_local_test #1133

Open pswaminathan opened 6 months ago

pswaminathan commented 6 months ago

In kt_android_local_test, the underlying _kt_android_artifact doesn't get manifest or manifest_values if they are provided. (link) As such, adding assets fails, because the underlying library gets the assets kwarg, but not the manifest.

Can repro with the examples:

kt_android_local_test(
    name = "SomeTest",
    srcs = ["SomeTest.kt"],
    associates = ["//libKtAndroid:my_kt_kt"],
    custom_package = "examples.android.lib",
    manifest = "AndroidManifest.xml",
    assets = ["assets/some_asset.txt"],
    assets_dir = "assets",
    deps = [
        "@maven//:junit_junit",
        "@robolectric//bazel:android-all",
    ],
)

This can be worked around by creating a kt_android_library and then making that a dep of the test, but that is fairly sub-optimal.

I can PR a fix for this, but first wanted to see if there were any concerns with passing those values.

Bencodes commented 5 months ago

@pswaminathan is this one fixed for you with https://github.com/bazelbuild/rules_kotlin/pull/1122 and if so can we close out this issue?

pswaminathan commented 5 months ago

@Bencodes no—this is about how the underlying _kt_android_artifact is instantiated. With or without #1122 this doesn't work.