Hey everyone, I'm trying to create my first plugin...
# arrow
d
Hey everyone, I'm trying to create my first plugin with Arrow Meta. If I understand it correctly, a plugin with Arrow Meta can intercept at each step of the compiler. Therefore I should be able to change the AST before any annotation processing takes places by other third party libraries, is that correct? If so, is there any example on how to achieve this? I tried something like the following, currently with no success:
Copy code
val Meta.injectProperty: CliPlugin
    get() = "Inject new property" {
        meta(
            classBody(this, { true }, fun ClassBody.(c: KtClassBody): Transform<KtClassBody> {
                if (c.name?.contains("User") == true) {

                    return Transform.replace(
                        replacing = c,
                        newDeclaration = """
                            | 
                            | @ColumnInfo(name = "name")
                            | var name: String = ""
                            |
                            | @ColumnInfo(name = "nameabc")
                            | var nameABC: String = ""
                            | }""".classBody
                    )
                }
                else {
                    return Transform.empty
                }
            })
        )
    }
r
Hi @Dutch, that api is going away because it will be replaced by FIR when it’s stable. There is currently no stable solution in arrow meta for source codegen or tree manipulation in the analysis phase until FIR lands in the compiler
The usable parts are just the handlers for analysis and the IR backend but the quote system will be removed.
We plan on releasing the first meta release stable when FIR is also stable probably in the first or second quarter in 2022
🤞 1
d
Ah okay, bummer. I was planning to use arrow meta in my bachelor thesis, which needs to be finished til february. Thanks anyway for the amazing work you guys are doing with Arrow.
👍 1
😍 1