Justin Tullgren

04/08/2021, 8:26 PM
is IR fed to each plugin consecutively or is there a merge strategy involved? im wondering how the android jetpack compose plugin is successfully wrapping my IR modifications. it seems to imply my plugin went first

Youssef Shoaib [MOD]

04/08/2021, 9:36 PM
Basically, by default if you're just using
your extension gets a
as it's order. To change that, you can go through a few hoops (namely just doing `
Copy code
project.extensionArea.getExtensionPoint(IrGenerationExtension.extensionPointName).registerExtension(extension, LoadingOrder.XX project)
). If you are using the default though (like literally every other plugin), then the order of the plugins running is basically undetermined and it just depends on what order the compiler decided to run your ComponentRegistrars. I'm guessing it probably then by extension depend on what order the gradle plugins were applied. That all doesn't matter though, because what you haven't noticed in your example is that when your plugin adds that modified call, it's adding that depending on how the user's code is structured (as in you're probably taking an already-existing call and modifying it) and so what happens is that if your plugin goes first it changes the user's initial code and then compose puts that in the else, and if compose goes first then your plugin changes what it's meant to change, and the only place where that exists is in that else block
👌 1

Justin Tullgren

04/08/2021, 10:50 PM
awesome answer thank you! I'l look more into the order to have a little bit more control in some scenarios