Tooling API & groovy.lang.Binding

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tooling API & groovy.lang.Binding

Marian Stránecký
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:



[CODE - 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





Reply | Threaded
Open this post in threaded view
|

Re: Tooling API & groovy.lang.Binding

Luke Daley-2
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:[hidden email]>
> 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 | Threaded
Open this post in threaded view
|

Re: Tooling API & groovy.lang.Binding

Marian Stránecký
Hi Luke,

I was just trying to adapt gradle-maven-plugin (which acts good on its
own) to be aware of maven "parent".

The desperade idea was to use all the properties (versions, etc.) from
"parent" (multimodule) maven project.

I wanted to solve all that spaghetti (antrun etc.) forced by maven
shortcomings by moving smoothly toward gradle, to which I can't switch
nowadays (too big effort, out of scope, lack of team experience etc.)

Anyway, thank you for the information...
(and also for the hint...)

M.


Dne 19.2.2014 1:32, Luke Daley napsal(a):

> 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:[hidden email]>
>> 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
>
>


---
Tato zpráva neobsahuje viry ani jiný škodlivý kód - avast! Antivirus je aktivní.
http://www.avast.com


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

    http://xircles.codehaus.org/manage_email