Anyone ever setup an artifact transform so that yo...
# dependency-management
t
Anyone ever setup an artifact transform so that you can consume an android AAR from a regular JVM project? Usecase: writing a KSP processor that I want the tests to be able to compile using some androidx api's on those classpaths
everything i've done thus far doesn't seem to trigger my transform for unpacking the jar from the aar file. I've got a separate
androidDependencies
configuration that I have
testImplementation
doing
extendsFrom
and the dep report from
androidDependencies
looks good. but resolution is still failing on the aar files I assume because attributes don't match up right. So I guess the question I might be asking is how to best debug why a transform isn't getting ran?
I think I see it now. no matching variant found. Hmm more to read...
v
From the top of my head, I'd say you might need https://github.com/gradle/gradle/issues/8386. For an artifact transform to be considered, you first have to actually match a variant. Then for the matched variant an artifact transform can be used to transform the artifacts to the needed set of attributes.
t
I believe you are correct since there is two variants here that should match up to the transform
Ok so I guess i'll see if I can cook up a task to do the transform and depend on those outputs. No clue if that is workable but I'll try it
yeah some hacky manual classpath building to feed kotlin-compile-testing seems to work. Thanks again.
👌 1
j
I made a demo project for such things a while back: https://github.com/jjohannes/gradle-demos/tree/main/gmm-java-ecosystem Don't know how valid that still. Here is an example of Java using AAR: https://github.com/jjohannes/gradle-demos/blob/main/gmm-java-ecosystem/consumer/java-app/build.gradle.kts
👌 1
❤️ 1