Open artem-zinnatullin opened 1 year ago
@Bencodes pointed me to a draft PR https://github.com/bazelbuild/rules_jvm_external/pull/807 by @shs96c which uses Gradle dependency resolver, I wonder if as a side-effect of it rules_jvm_external
will get support for Gradle Module Metadata and cover such cases as this issue?
It’s possible the new resolver will be able to use the gradle module files, but Google should also fix their pom files so that they’re correct for people who use something other than just gradle (such as maven or sbt)On 31 May 2023, at 21:51, Artem Zinnatullin @.***> wrote: @Bencodes pointed me to a draft PR #807 by @shs96c which uses Gradle dependency resolver, I wonder if as a side-effect of it rules_jvm_external will get support for Gradle Module Metadata and cover such cases as this issue?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
Totally agree, pom
files should be fixed by Google.
But also going forward we might want compatibility with Gradle Module Metadata .module
files in the future for better support of Kotlin Multiplatform artifacts, I think that module file better indicates different platform (JVM, Android, iOS, JS, Common) specific artifacts than the POM files can.
Filed an issue against Google to fix pom files https://issuetracker.google.com/issues/285353844
It looks like Google fixed the pom issue, but still rules_jvm_external is trying to fetch aar when no <package>
is specified for androidx dependencies: https://issuetracker.google.com/issues/285353844#comment39
@shs96c @Bencodes Is there a possible workaround on bazel side to fix the issue? It's not possible to upgrade to Jetpack Compose 1.5.x for now using normal dependencies.
androidx.annotation:annotation:1.6.0
(2/22/2023) is published with gradle module metadata:
https://maven.google.com/web/index.html?q=annotation#androidx.annotation:annotation:1.6.0
and rules_jvm_external will download and use the "empty" jar there, making it look like you've depended on the right thing but javac not finding it. This is a very common dependency, and very common transitive dependency, so even if you try to use 1.5.0, something might easily upgrade you to 1.6.0 or later.
w.r.t androidx.annotation
issue, this can be temporarily worked around by adding a override_target
that maps annotation
to annotation-jvm
Like done here
override_targets = {
"androidx.annotation:annotation": "@maven//:androidx_annotation_annotation_jvm",
},
Hi team, we've faced an issue with upgrade of androidx dependencies from
1.5.0-alpha04
to1.5.0-beta01
, looks like now instead of publishing Android.aar
files directly, there is now additional-android
artifact published which should be used to get.aar
files.The
.pom
files don't point to-android
artifacts, however Gradle Module Metadata.module
files do!rules_jvm_external
might need to add support for Gradle Module Metadata files to resolve such artifacts correctly or Google needs to fix.pom
s, but supporting Gradle Module Metadata files might be more sustainable for future Kotlin Multiplatform artifacts in general.A bit more detailed debugging on an example artifact foundation-layout:1.5.0-beta01
Previous version of it foundation-layout:1.5.0-alpha04 had
.aar
published directly.New version foundation-layout:1.5.0-beta01 has no
.aar
, instead it has.jar
that only contains Kotlin Multiplatform META-INF.However for new version there is now
-android
artifact foundation-layout-android:1.5.0-beta01 which has correct.aar
..pom
files of androidx dependencies that depend onfoundation-layout:1.5.0-beta01
like androidx.compose.animation:animation:1.5.0-beta01 don't point to-android
artifact correctlySo just relying on
.pom
files will get us nowhere...However, there is additional Gradle Module Metadata file published for each artifact which correctly points to
-android
artifact.1) Download https://dl.google.com/android/maven2/androidx/compose/foundation/foundation-layout/1.5.0-beta01/foundation-layout-1.5.0-beta01.module
2) Note that it has bunch of
-published
entries which point tofoundation-layout-android
(-android
).module
file3) Download https://dl.google.com/android/maven2/androidx/compose/foundation/foundation-layout-android/1.5.0-beta01/foundation-layout-android-1.5.0-beta01.module
4) This file now points to correct
-android.aar
It seems like
rules_jvm_external
needs to add support for.module
files to resolve Kotlin Multiplatform artifacts correctly :/