bazelbuild / rules_jvm_external

Bazel rules to resolve, fetch and export Maven artifacts
Apache License 2.0
316 stars 237 forks source link

Resolving Kotlin Multiplatform via Gradle Metadata (AndroidX) #864

Open cpsauer opened 1 year ago

cpsauer commented 1 year ago

Hi wonderful Bazelers,

It looks like some of Android's Jetpack libraries (androidx) are starting to switch over to to Kotlin Multiplatform, which involves publishing (nearly) empty jars to Maven and then relying on Gradle metadata to resolve the actual coordinates. This breaks builds upon updating the libraries, since naively pulling the next version will now pull down the now empty JARs. I figured I should report in as soon as I figured out what was breaking our build in case it would be useful to others.

The quick workaround is just to depend on the jvm variant of the coordinates. For example androidx.annotation:annotation -> androidx.annotation:annotation-jvm.

But it'd be nice to handle this automatically so that people can use the canonical version and aren't confused into the future. For this jvm-focused repo, probably that involves just seeing if there's a -jvm version of the coordinate and transparently aliasing to that.

Cheers, Chris

shs96c commented 1 year ago

This would be addressed by #807, since that delegates down to gradle's own resolver. Since that's not landed yet, the next place to address this is with the coursier project: https://github.com/coursier/coursier That's what we currently use as our resolver.

cpsauer commented 1 year ago

Oh, great! Thanks for the cross-ref and all your work on that, Simon! (And for Selenium, which has been super useful to me and to friends in the past!)

I assume that we anticipate #807 landing soon enough that we should just use the workaround for now, rather than in coursier?

Some questions about the PR with respect to this issue:

Thanks so much, Chris