How does the tooling api work in detail? Does it r...
# community-support
p
How does the tooling api work in detail? Does it reuse the Gradle daemon or the host JVM? And what Gradle version will be used? The one specified in the Wrapper?
👀 1
Use-case: Does the tooling API respect the Gradle version attribute? GRADLE_PLUGIN_API_VERSION_ATTRIBUTE
s
By default, the TAPI uses / respectes the Gradle version as declared in the wrapper in the project it connects to. However, that Gradle version can be overridden on the connector like e.g. done here.
Is there is no Gradle wrapper in the connected project, and none specified on the connector, then I believe a globally installed Gradle version will be used.
v
Globally installed, are you sure? I would have expected that the version of the tooling api is used then
s
Globally installed, are you sure?
No, I'm not, hence I write "I believe" 😉 But does the TAPI actually come with a Gradle version? I thought it does not, and thus it could also not be used.
v
It does not "come with", but it "has a" version. So if the TAPI is "8.14.3" and neither the build you drive nor the TAPI user specified any version it could behave like if
useGradleVersion("8.14.3")
was called. 🤷‍♂️
Also not sure which is the case, especially as I consider any build without Gradle wrapper files to have a build bug 😄
s
And where / how would it get the artifacts for that version from, if the wrapper is not available?
v
The TAPI is like the Gradle wrapper you check into the project. Just a thin layer that provisions the Gradle version if necessary and uses that to drive the build.
So it would download the version just like the wrapper would do
And my suspicion was right, I just tried with
Copy code
GradleConnector
    .newConnector()
    .forProjectDirectory(layout.buildDirectory.dir("bar").get().asFile)
    .connect()
    .use {
        it.newBuild().forTasks("help").setStandardOutput(System.out).run()
    }
in my play build, it uses the version of the TAPI
1
bar
just had an empty settings script