realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

Skip accessor manipulation based on user supplied rules

Open rorbech opened this issue 2 years ago • 1 comments

We don't control the order of compiler plugins and cannot guarantee that code transformations won't interfeer with other compiler plugins. We should therefore provide a way for users to mark non-source code attributes to be skipped when modifying code during compilation.

See #1296 for an example where compose adds a property that shouldn't be processed by our compiler plugin.

The above could be done with a class annotation with list of names or regular expressions of property names to skip. But there could be other scenarios that could call for more flexibility, so we could also consider passing compiler plugin parameters from command line or through gradle plugin extensions.

Other similar issues to consider when approaching this is #1251

rorbech avatar Mar 13 '23 13:03 rorbech

➤ cmelchior commented:

Realistically we are not going to implement this for the Kotlin 1.*

In K2 there is the concept of a GeneratedDeclarationKey which we can use to check if code is being generated by other plugins

https://github.com/realm/realm-kotlin/blob/c08a3d370df97d0833f27d463dd759d651f5164b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/fir/RealmPluginGeneratorKey.kt#L24

sync-by-unito[bot] avatar Jan 25 '24 07:01 sync-by-unito[bot]