I’m curious how to inspect a build to programmatically access script plugins defined in a build.gradle? This is useful for us trying to extract the build definition when setting up external programs to watch gradle. It looks like the IDEA plugin is figuring this out but searching through the codebase is giving me a giant headache, and I can’t find any real documentation for this.
build.gradle
...
apply from: "somescript.gradle"
...
how can I access this somescript.gradle reference from the org.gradle.api.Project object?
I’m really looking for an answer here, I’ve already tested a significant amount of the API. Anyway, since I already have a test project, the output is:
If course you are, and I’m trying to help but don’t have a laptop in front of me. I was hoping that gradle would add some sort of ScriptPlugin to the plugin container. It seems that’s not the case so I’m not sure you can do it.
Perhaps if you explain a bit more your end goal, there might be a workaround
I need a task that can output all the gradle files I need to watch so I can trigger a re-evaluation of the project from an external program.
task whatever {
print all the files (build.gradle, some-script.gradle, gradle.properties etc) that define the build
}
file watcher on output of whatever, if anything changes, re-evaluate the build.
It’s basically the cycle that the gradle-idea plugin uses on gradle builds: change to build definition -> resync the build. Since intellij is able to do it with script plugins, I’m assuming there is some programmatic access to this list of script plugin dependencies, I just can’t find them.