I have two questions when someone finds a moment t...
# arrow-meta
d
I have two questions when someone finds a moment to look: 1) What should I do to make sure the IDE uses my plugin during the analysis phase so everything is green even before the project has been built once? I've heard it's possible to avoid the "red until built once" issue at least? 2) I'm not sure if this is quite the right channel, but I've been running into an issue with Android Studio / IDEA not discovering compiler plugin generated classes that I'm importing from another gradle module (ie. A is the main module, and B is the secondary module, there are generated classes in B that IDEA doesn't find). The project builds perfectly fine but the IDE always complains about unresolved references for the generated classes that are imported from the other module (classes generated in the main module behave as expected-- red until the first build then everything is fine). If I should ask about this in the intellij channel that's fine.
r
Hi Derek! 1. Depending on the things you do with your plugin it may not be possible to avoid red lines unless you also provide an IDE plugin. The only safe op that supports IDE resolution without extra plugins in meta is Transform.newSources which will operate as kapt. This kind of integration does not exist because the compiler frontend is rapidly changing to be FIR and until that is stable we will not probably have IDE support for compiler plugins that either mutate in place or do more advanced things than code generation. We attempted to solve this with the Quote system but it turns out there is no strategy for line numbers and a bunch of other use cases that breaks the IDE and shows the user red lines all over. 2. We have historically heard similar complains not in meta but the behavior you describe and it’s usually associated to AS or the user having a special or different build folder or having to tell SA explicitly that /build/kapt/generated… or similar is also a source folder.
d
I am only using
Transform.newSources
for the above reasons, so this should be possible? What do I need to do? It's also worth noting again all the generated sources are in a different gradle module in case that matters. (the second gradle module fixes three issues: 1) it means Dagger / other apt in the main module can resolve the generated classes because I'm generating them in a second analysis phase which otherwise foils that 2) means that I only have to set kotlin.incremental.usePreciseJavaTracking=false for the submodule 3) limits the build performance implications since the plugin only needs to run on a smaller submodule For 2 I'm starting to think that it's an intellij issue/bug because everything else is working fine (can even build from within the IDE and it works fine). And I can see the generated classes in the submodule output jar as well.
I'm actually going to ask in the intellij channel about 2 to see if anyone has insight. It looks similar to https://youtrack.jetbrains.com/issue/KT-31069 except this isn't a KMP project.