https://kotlinlang.org logo
Title
a

arnaud.giuliani

06/07/2022, 4:25 PM
Hello there 👋 is there a way to scan sources accross multiple gradle modules while using
resolver.getSymbolsWithAnnotation(...)
?
z

Zac Sweers

06/07/2022, 4:26 PM
that’s almost certainly not something you want to do 🤔
👍 1
👍🏼 1
incremental processing certainly wouldn’t be able to work with that
☝️ 1
a

arnaud.giuliani

06/07/2022, 4:39 PM
yeah, I believe this is more something like classpath scanning that would achieve such thing
j

Jiaxiang

06/07/2022, 5:09 PM
modules are treated as libraries in compiler, therefore it is not supported.
a

Anton Popov

06/07/2022, 5:14 PM
However, sometimes it is needed. Fox example: airbnb's Showkase library uses this technique (source code). Also, crab library
j

Jiaxiang

06/07/2022, 5:17 PM
the code you linked does not seem to be calling
getSymbolsWithAnnotation
equivalent? You can still try to access symbols from other modules, using indirect reference or fully qualified name. But still, that might also be a nightmare for incremental.
a

Anton Popov

06/07/2022, 5:21 PM
They are placing classes, annotated with useful info, in each module with the same package name, then collect them in the root module using
Resolver.getDeclarationsFromPackage
.
a

arnaud.giuliani

06/07/2022, 7:11 PM
thanks for your messages