natario1
05/23/2024, 10:35 AM@ImportantForInitialization.
• I provide a function called initialize(). Its body, IR-generated, should use info from all declarations above.
If we provide initialize() via a companion runtime library, there’s no way for my plugin to modify its IR.
If we have the user provide an empty @Initializer fun initialize() = Unit it works. But I struggle to make this work in multimodule
or even multiplatform setups.
• multimodule: there’ll be a graph of initialize functions, ideally they should be calling each other. It may be possible because there’s IrModuleFragment.descriptor.allDependencyModules. But descriptor.stableName is nullable for dependencies - I think - so it’s hard to provide/retrieve a stable FQN for the initialize function.
• multiplatform: no problem in K1, but I read that in K2 common sources are compiled on their own, so basically I’d have to require an initializer in common (collecting @ImportantForInitialization in that unit) and another for each platform. It sucks.
I also know I can write metadata in annotations but I still need the FQN of something in order to read any annotation on it.Tóth István Zoltán
05/23/2024, 10:41 AMTóth István Zoltán
05/23/2024, 10:45 AMJavier
05/23/2024, 11:28 AMnatario1
05/23/2024, 11:31 AMTóth István Zoltán
05/23/2024, 12:30 PMnatario1
05/23/2024, 12:40 PMTóth István Zoltán
05/23/2024, 12:43 PM