Javier
11/14/2025, 3:07 PMFqName, right? So the only workaround about this is that the Gradle Plugin uses something like Classgraph to find those references and pass them to the compiler when syncing/building?Liam
11/17/2025, 10:33 AMCompilerConfiguration you get in the CompilerPluginRegistrar also gives you the list of classpath roots, so you can also run classgraph directly in the compiler plugin without needing to pass a list of external names to the plugin from gradle. Of course the downside with this is that gradle doesn't handle the caching, so you have to figure that out yourself.
This builds the list of files for all classpath elements:
val elements = buildList {
addAll(configuration.jvmClasspathRoots.map { it })
addAll(configuration.jvmModularRoots.map { it })
// The output directory is also in the classpath roots, might make sense to remove
// it or at least handle it in a special way:
configuration.outputDirectory?.let { outputDir ->
removeIf { it.startsWith(outputDir) }
}
}
val result = ClassGraph()
.overrideClasspath(elements)
.enableClassInfo()
.enableAnnotationInfo()
.scan()
For me this works when running the compiler through Gradle, but there is also stuff like VirtualJvmClasspathRoot, and intellij might use that instead for example, I haven't tried that yet.Javier
11/17/2025, 10:34 AMLiam
11/17/2025, 10:40 AMLiam
11/17/2025, 10:42 AMCompilerPluginRegistrar, I pass the list of elements to a FirExtensionSessionComponent which then handles all the caching.Liam
11/17/2025, 10:48 AMJavier
11/17/2025, 12:28 PM