calebb2048
10/12/2026, 3:53 PMorg.objectweb.asm
• :compiler-plugin
◦ dependsOn(:common)
◦ ASM location: <http://org.jetbrains.org|org.jetbrains.org>.objectweb.asm
How do I make :compiler-plugin compile against a version of my :common project with every ASM reference relocated to the new location? I've tried an artifact transform, but I can't even tell if it's being executed.
I know this is brittle, but it's ASM; the API is literally never going to change.tony
10/12/2026, 3:56 PMtony
10/12/2026, 3:56 PM:common project and make the shadowed variant the only one that can be resolvedtony
10/12/2026, 4:00 PMcalebb2048
10/12/2026, 4:07 PMorg.objectweb.asm and <http://org.jetbrains.org|org.jetbrains.org>.objectweb.asm variants to be resolved by different projects, so making it where only the shadowed version can be resolved doesn't seem like it would work?calebb2048
10/12/2026, 4:08 PMtony
10/12/2026, 4:25 PMtony
10/12/2026, 4:25 PM:compiler-plugin) to select the shadowed variant of :commoncalebb2048
10/12/2026, 4:28 PMshadow to relocate the usages without actually embedding ASM into an uberjartony
10/12/2026, 4:28 PMtony
10/12/2026, 4:30 PMdependencies {
implementation(project(":lib")) {
attributes {
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
}
}
}
(that's copied directly, you'll have to modify it of course)calebb2048
10/12/2026, 5:07 PM// :compiler-plugin (consumer)
val embeddedRelocatingAsm by configurations.dependencyScope("embeddedRelocatingAsm") {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
attribute(jetbrainsAsm, true)
}
}
embedded.extendsFrom(embeddedRelocatingAsm)
dependencies {
attributesSchema {
attribute(jetbrainsAsm)
}
embeddedRelocatingAsm(project(":common-compiler-runtime"))
}calebb2048
10/12/2026, 5:08 PMcalebb2048
10/12/2026, 5:09 PMcalebb2048
10/12/2026, 5:09 PMproject(..., configuration=...), but I wish I could figure out this stupid attribute matching systemtony
10/12/2026, 5:14 PMimplementation or api and configure the attributes just for that one shadowed asm deptony
10/12/2026, 5:16 PMtony
10/12/2026, 5:17 PMcalebb2048
10/12/2026, 5:18 PM:compiler is targeting Kotlin's compiler, which already has ASM bundled under its namespace. :runtime is targeting the standard JVM, so I use the normal ASM namespace there.
:common has utilities for working with ASM on both fronts, so I need to essentially make it pretend that it's got org.jetbrains.asm when the compiler consumes it and org.objectweb.asm when the runtime consumes ittony
10/12/2026, 5:18 PMcalebb2048
10/12/2026, 5:19 PMcalebb2048
10/12/2026, 5:19 PMtony
10/12/2026, 5:21 PMcalebb2048
10/12/2026, 5:23 PMVampire
10/13/2026, 3:14 PMVampire
10/13/2026, 3:15 PMVampire
10/13/2026, 3:18 PMYou might think that after ten years of working with Gradle, I could get a simple cross-project variant consumption to work, but that would be a "no".
Yeah, the whole variant-aware resolution and attributes is unfortunately one of the most complex parts usage-wise. I also needed years to wrap my head around it completely and still am not confident I fully got it. With attributes that are on configuration and attributes that are only on artifacts, but being requested in the same spot, and artifact transforms being able to transform artifacts, but not influence the variant selection in the first place, ...
tony
10/13/2026, 4:53 PMbut not influence the variant selection in the first placethere's an API I don't understand at all, but I think it lets artifact views influence variant selection... https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/ArtifactView.ViewConfiguration.html#withVariantReselection()
Vampire
10/13/2026, 8:30 PM