Tooling API appears to ignore gradleUserHomeDir when downloading


(Justin Ryan) #1

I’m trying to call the Tooling API from Jenkins, which enforces a read-only home directory. I can’t just leave GRADLE_USER_DIR along, because of the read-only shared home directory, so I set it to $WORKSPACE, which works fine for gradlew. When I get into my test code and it goes to make a connection using the tooling API, I run into a similar problem, so I go to set DefaultGradleConnector.useGradleUserHomeDir.

That doesn’t work though. I traced it through, and it looks like DefaultGradleConnector.connect() is calling distributionFactory.getDefaultDistribution without passing in connectionParameters.useGradleUserHomeDir. Digging deeper, it looks like DistributionFactory is solely configured in its constructor from ConnectorServices. The value is the default home directory .gradle dir and there isn’t a way for the DefaultGradleConnector.connectionParameters.useGradleUserHomeDir to get to DistributionFactory.

Can someone confirm that what I’m talking about (tooling api ignoring DefaultGradleConnector.connectionParameters.useGradleUserHomeDir)? If someone confirms this, I can submit a pull request. Am I missing something? Without a configurable distribution download the subsequent connectionFactory.create doesn’t really make sense.


(Szczepan Faber) #2

Hey Justin,

You’re right - it is a problem. Tooling api uses the gradleUserHome dir by passing it via the start parameters to the build. However, it is not used for the getting the distro. Please submit a ticket & pull request :wink:

Thanks a lot for this report!


(Szczepan Faber) #3

Exported to jira: GRADLE-2414