PSI Tree from gradle plugin

Can I access the PSI tree from the Gradle plugin? How to do this, share an example

What PSI tree and what Gradle plugin are you talking about?

Do you mean the PSI tree of parsed Gradle files within an IntelliJ IDEA plugin?
I doubt this is the right place to ask about that.
The Gradle plugin is developed by JetBrains and built-into the IDE.
So you might need to ask them instead.

Thank you for your answer!
By PSI tree, I meant Program Structure Interface (PSI)
I am writing custom Gradle plugin and I want to analyze the annotations in the code of my project

Ah, ok, I only know the PSI tree from IntelliJ plugins, thus my assumption.
I’m not sure, but I don’t think you can get any PSI representation of your code from Gradle.
I might be wrong of course.
But in case I’m not, just use any source parsing library to parse your sources, for example JavaParser if you are talking about Java files.