[GRADLE-1979] Tooling API: Respect user-defined 'GradleConnector.installation' property Created: 02/Dec/11 Updated: 04/Jan/13 Resolved: 08/Dec/11 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.0-milestone-6 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Denis Zhdanov | Assignee: | Unassigned |
Resolution: | Not A Bug | Votes: | 0 |
Description |
The code as below for working with gradle tooling api: GradleConnector connector = GradleConnector.newConnector(); connector.useInstallation(customGradleHome); connector.forProjectDirectory(targetProjectDir); ProjectConnection connection = connector.connect(); connection.model(BasicIdeaProject.class); The problem is that only the first value of 'GradleConnector.installation' property is used if we do that more than one time within the same java process. I.e we have the following sequence:
|
Comments |
Comment by Adam Murdoch [ 02/Dec/11 ] |
The model() method creates a builder for fetching the model. It does't do any work until you call one of the get() methods on it: ModelBuilder<BasicIdeaProject> builder = connection.model(BasicIdeaProject) |
Comment by Denis Zhdanov [ 02/Dec/11 ] |
Am I right understanding that the tooling api uses correct gradle distribution if I work via ModelBuilder instead of 'connection.getModel()'? |
Comment by Adam Murdoch [ 04/Dec/11 ] |
They both use the correct distribution. The only difference is in when the distribution is actually used and verified: ProjectConnection connection = ... result = connection.getModel() // uses the distribution here. Will fail if incorrect version used ModelBuilder<BasicIdeaProject> builder = connection.model(BasicIdeaProject.class) // doesn't do anything yet. Won't fail. ... result = builder.get() // uses the distribution here. Will fail if incorrect version used You can use whichever method you prefer. |
Comment by Denis Zhdanov [ 08/Dec/11 ] |
Looks like it was my mistake - just created simple test and it shows that the tooling api behaves as expected. Please close the ticket |