I can extract java compile options for a project using something like project.getTasks().getByName("JavaCompile")
. I can also query out the sourcesets, dependency jars, compilation task name etc. relatively easily via the Project
instance.
Is there a way to extract this information for the build definition itself? Some kind of meta Project
instance that has a sourceset that points to all the build.gradle(.kts)
files. That lists all the Gradle jars required to compile the build.gradle
files. That tells me what Groovy/Kotlin compiler options are used and also what is the task name for compiling the build definition.
I can edit the build.gradle.kts
files in Intellij and it will navigate to the gradle-api-8.6.jar
if I click on the Task
class so I assume this information is available somewhere.
The only things I’ve been able to find are the Project#getBuildFile
method to point to the relevant build.gradle
file and the Project#getBuildscript
method but that returns empty lists for ScriptHandler#getDependencies
.