On 06/05/2011, at 3:18 PM, Marco Hunsicker wrote:

> Howdy,
> 
> I'm trying to use the tooling API to write integration tests, but running 
> into a severe problem with the daemon (see my other post 
> http://gradle.1045684.n5.nabble.com/Gradle-daemon-and-3rd-party-plugin-classloading-issues-td4371935.html).
> 
> To make things work, I need to either disable the use of the daemon 
> altogether. Or stop the daemon programmatically. Is there any way to achieve 
> either goal?

Depending on what your integration test does, you might be better off with the 
ProjectBuilder. This simply creates instances of Project which you can apply 
your plugins to to test them. It has the advantage that everything runs 
in-process and you don't need a Gradle distribution to make it work at runtime.

If you want to actually run a build, you're pretty much stuck with the tooling 
API for now. It might be useful for us to add some kind of test fixture for the 
tooling API, so that your test can create a light-weight implementation of 
ProjectConnection or perhaps BuildLauncher.

In the meantime, a workaround you can use is to switch the tooling API to 
'embedded' mode, via an internal API. This will run the build in the test jvm, 
rather than using the daemon:

DefaultGradleConnector connector = (DefaultGradleConnector) 
GradleConnector.newConnector();
connector.embedded(true);
// configure and use as per normal



> 
> I can create a DaemonConnector and should be able to send a stop command, but 
> I did not manage to do the same. Can anyone help? Thanks.
> 
> File home = new File(System.getProperty("user.home"), ".gradle");
> DaemonConnector connector = new  DaemonConnector(home);
> Connection<Object> connection = connector.maybeConnect();
> if (connection != null) {
>  // how to send stop command?
> }
> 
> 
> Cheers,
> 
> Marco
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>   http://xircles.codehaus.org/manage_email
> 
> 


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com

Reply via email to