When using the Tooling API, you have to assume that that client and the actual build are in different JVMs. Therefore you can't really just pass objects back and forth.

What are you trying to achieve?

BTW, this post would be better suited for http://forums.gradle.org. This list is for discussing the development of Gradle itself.

Marian Stránecký <mailto:marian.strane...@gmail.com>
19 February 2014 1:53 am
Hi all,

I would like to ask you for information if there is a way how to pass an object to embedded gradle using tooling API (as can be done for groovy if used directly):

The approach can be seen here:

https://github.com/if6was9/gradle-maven-plugin/blob/master/src/main/java/org/fortasoft/maven/plugin/gradle/GradleMojo.java


[CODE - embedding groovy]
// as in http://docs.codehaus.org/display/GROOVY/Embedding+Groovy
Binding bnd = new Binding();
bnd.setVariable("mavenProject", mavenProject);

GroovyShell gs = new GroovyShell(bnd);

Object retVal = gs.evaluate(someScript);
[/CODE - embedding groovy]

vs

[CODE - embedding gradle]

ProjectConnection connection = GradleConnector.newConnector()
    .forProjectDirectory(new File("someFolder"))
    .connect();

BuildLauncher build = connection.newBuild();

//select tasks to run:
build.forTasks("clean", "test");

//include some build arguments:
build.withArguments("--no-search-upward", "-i", "--project-dir", "someProjectDir");
...
[/CODE - embedding gradle]

I am currently not able to find a way how to pass any information without "serializing" it to an argument...

Thank you in advance,
Marian






---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to