[DISCUSSION] Best of both Groovy worlds: compile and on the fly

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[DISCUSSION] Best of both Groovy worlds: compile and on the fly

Jacques Le Roux
Administrator
Hi Devs,

While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.

Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.

I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
templates and Groovy Scripts.

We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.

I tried and it works. So here is the (simple) plan:

 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
 2. We add the necessary packages names
 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets

So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax or
alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.

I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as suggested
Mathieu.

I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.

Feedback welcome, thanks

Jacques

Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Paul Foxworthy-2
Thanks Jacques,

Yes, on the fly rebuild is very cool. This will encourage and accelerate
moving Java services to Groovy, I think.

Big +1 from me.

Cheers

Paul

On Mon, 16 Sep 2019 at 20:29, Jacques Le Roux <[hidden email]>
wrote:

> Hi Devs,
>
> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets"
> I discussed with Mathieu and we had some ideas.
>
> Mathieu suggested to move Groovy scripts from /groovyScripts/
> to/src/main/groovy/.
>
> I was initially reluctant because I love to be able to change things on
> the fly. That's why I liked Minilang and still like widgets, Freemarker
> templates and Groovy Scripts.
>
> We also know the advantages of compilation. But then I thought: why not
> have best of both Groovy worlds: compile and on the fly.
>
> I tried and it works. So here is the (simple) plan:
>
>  1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
>  2. We add the necessary packages names
>  3. Devs can then open "gradlew --continuous" in a terminal and let it
> like that. It will continuously build on any changes in Gradle sourcesets
>
> So, if you modify a Groovy scripts while running an OFBiz instance, the
> changes will be reflected in the instance and you can check possible syntax
> or
> alike issues in the terminal running the continuous build. It's very fast
> since only changes have an impact on the build.
>
> I'm sure there are other benefits to follow "the common convention of
> putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> suggested
> Mathieu.
>
> I see no disadvantages, do you? If nobody disagree with this idea, I'll
> create a Jira for that.
>
> Feedback welcome, thanks
>
> Jacques
>
>

--
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Australia

Phone: +61 3 9585 6788
Web: http://www.coherentsoftware.com.au/
Email: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Gil Portenseigne
In reply to this post by Jacques Le Roux
Hello Jacques,

I also discussed about it with Mathieu and i find it very interesting.

The main advantage I see is, beside compilation, the integration in your
IDE, that was not optimum, and the possibility to re-use methods from
these script migrated to explicit classes.

So +1

Gil


Le 12:28 - lundi 16 sept., Jacques Le Roux a écrit :

> Hi Devs,
>
> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
>
> Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
>
> I was initially reluctant because I love to be able to change things on the
> fly. That's why I liked Minilang and still like widgets, Freemarker
> templates and Groovy Scripts.
>
> We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
>
> I tried and it works. So here is the (simple) plan:
>
> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
> 2. We add the necessary packages names
> 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
>
> So, if you modify a Groovy scripts while running an OFBiz instance, the
> changes will be reflected in the instance and you can check possible syntax
> or alike issues in the terminal running the continuous build. It's very fast
> since only changes have an impact on the build.
>
> I'm sure there are other benefits to follow "the common convention of
> putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> suggested Mathieu.
>
> I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
>
> Feedback welcome, thanks
>
> Jacques
>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Jacques Le Roux
Administrator
In reply to this post by Jacques Le Roux
Thanks Paul, Gil, for your suggestions,

I have created OFBIZ-11205 for that

Jacques

Le 16/09/2019 à 12:28, Jacques Le Roux a écrit :

> Hi Devs,
>
> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
>
> Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
>
> I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
> templates and Groovy Scripts.
>
> We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
>
> I tried and it works. So here is the (simple) plan:
>
> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
> 2. We add the necessary packages names
> 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
>
> So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax
> or alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.
>
> I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> suggested Mathieu.
>
> I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
>
> Feedback welcome, thanks
>
> Jacques
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

taher
I'm not sure I understand the outcome from reading the JIRA and this
thread. What will happen exactly? Are you going to make groovy scripts
part of the call stack? Are you going to use @CompileStatic? Or are
you just going to move them to src/main/groovy?

On Fri, Sep 20, 2019 at 5:14 PM Jacques Le Roux
<[hidden email]> wrote:

>
> Thanks Paul, Gil, for your suggestions,
>
> I have created OFBIZ-11205 for that
>
> Jacques
>
> Le 16/09/2019 à 12:28, Jacques Le Roux a écrit :
> > Hi Devs,
> >
> > While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
> >
> > Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
> >
> > I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
> > templates and Groovy Scripts.
> >
> > We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
> >
> > I tried and it works. So here is the (simple) plan:
> >
> > 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
> > 2. We add the necessary packages names
> > 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
> >
> > So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax
> > or alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.
> >
> > I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> > suggested Mathieu.
> >
> > I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
> >
> > Feedback welcome, thanks
> >
> > Jacques
> >
> >
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Jacques Le Roux
Administrator
In a 1st time I intend to do only what I wrote in OFBIZ-10226, OFBIZ-10205 and this thread, ie indeed mostly "move them to src/main/groovy". That's
enough for my need.

Using @CompileStatic is out of my scope because I want to keep Groovy scripts dynamic.

Le 20/09/2019 à 16:27, Taher Alkhateeb a écrit :

> I'm not sure I understand the outcome from reading the JIRA and this
> thread. What will happen exactly? Are you going to make groovy scripts
> part of the call stack? Are you going to use @CompileStatic? Or are
> you just going to move them to src/main/groovy?
>
> On Fri, Sep 20, 2019 at 5:14 PM Jacques Le Roux
> <[hidden email]> wrote:
>> Thanks Paul, Gil, for your suggestions,
>>
>> I have created OFBIZ-11205 for that
>>
>> Jacques
>>
>> Le 16/09/2019 à 12:28, Jacques Le Roux a écrit :
>>> Hi Devs,
>>>
>>> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
>>>
>>> Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
>>>
>>> I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
>>> templates and Groovy Scripts.
>>>
>>> We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
>>>
>>> I tried and it works. So here is the (simple) plan:
>>>
>>> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
>>> 2. We add the necessary packages names
>>> 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
>>>
>>> So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax
>>> or alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.
>>>
>>> I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
>>> suggested Mathieu.
>>>
>>> I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
>>>
>>> Feedback welcome, thanks
>>>
>>> Jacques
>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

taher
I see, in this case I think it's a good idea to comply with
conventions. It's strange that while I was working in the beginnings
on gradle I remember the opposite suggestion happening "keep the
scripts where they are" is what I heard repeatedly. Anyway, if it is
just a matter of moving, then it's not that big of a deal.

I suggest to do that slowly and carefully though. It is quite possible
to break many scripts due to location references.

On Fri, Sep 20, 2019 at 6:40 PM Jacques Le Roux
<[hidden email]> wrote:

>
> In a 1st time I intend to do only what I wrote in OFBIZ-10226, OFBIZ-10205 and this thread, ie indeed mostly "move them to src/main/groovy". That's
> enough for my need.
>
> Using @CompileStatic is out of my scope because I want to keep Groovy scripts dynamic.
>
> Le 20/09/2019 à 16:27, Taher Alkhateeb a écrit :
> > I'm not sure I understand the outcome from reading the JIRA and this
> > thread. What will happen exactly? Are you going to make groovy scripts
> > part of the call stack? Are you going to use @CompileStatic? Or are
> > you just going to move them to src/main/groovy?
> >
> > On Fri, Sep 20, 2019 at 5:14 PM Jacques Le Roux
> > <[hidden email]> wrote:
> >> Thanks Paul, Gil, for your suggestions,
> >>
> >> I have created OFBIZ-11205 for that
> >>
> >> Jacques
> >>
> >> Le 16/09/2019 à 12:28, Jacques Le Roux a écrit :
> >>> Hi Devs,
> >>>
> >>> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
> >>>
> >>> Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
> >>>
> >>> I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
> >>> templates and Groovy Scripts.
> >>>
> >>> We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
> >>>
> >>> I tried and it works. So here is the (simple) plan:
> >>>
> >>> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
> >>> 2. We add the necessary packages names
> >>> 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
> >>>
> >>> So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax
> >>> or alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.
> >>>
> >>> I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> >>> suggested Mathieu.
> >>>
> >>> I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
> >>>
> >>> Feedback welcome, thanks
> >>>
> >>> Jacques
> >>>
> >>>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Samuel-2
In reply to this post by Jacques Le Roux
Hello Jacques,

I think it is a really good idea: add more checks on our code!

The option to use `gradlew --continous classes` make me think about
putting more things into jar (but this another discussion )

I still have one question: what about `commponent://` url in xml
(screen, service,...) ? are you going to rewrite
ComponentLocationResolver to load groovy from compiled `.class`

Samuel


On 16/09/2019 12:28, Jacques Le Roux wrote:

> Hi Devs,
>
> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle
> sourceSets" I discussed with Mathieu and we had some ideas.
>
> Mathieu suggested to move Groovy scripts from /groovyScripts/
> to/src/main/groovy/.
>
> I was initially reluctant because I love to be able to change things on
> the fly. That's why I liked Minilang and still like widgets, Freemarker
> templates and Groovy Scripts.
>
> We also know the advantages of compilation. But then I thought: why not
> have best of both Groovy worlds: compile and on the fly.
>
> I tried and it works. So here is the (simple) plan:
>
> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
> 2. We add the necessary packages names
> 3. Devs can then open "gradlew --continuous" in a terminal and let it
> like that. It will continuously build on any changes in Gradle sourcesets
>
> So, if you modify a Groovy scripts while running an OFBiz instance, the
> changes will be reflected in the instance and you can check possible
> syntax or alike issues in the terminal running the continuous build.
> It's very fast since only changes have an impact on the build.
>
> I'm sure there are other benefits to follow "the common convention of
> putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
> suggested Mathieu.
>
> I see no disadvantages, do you? If nobody disagree with this idea, I'll
> create a Jira for that.
>
> Feedback welcome, thanks
>
> Jacques
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSSION] Best of both Groovy worlds: compile and on the fly

Jacques Le Roux
Administrator
Hi Samuel,

For the moment I don't expect to change "`commponent://` url in xml (screen, service,...)", but that a good idea!

I suggest you create a Jira for that

Thanks

Jacques

Le 23/09/2019 à 10:31, Samuel a écrit :

> Hello Jacques,
>
> I think it is a really good idea: add more checks on our code!
>
> The option to use `gradlew --continous classes` make me think about putting more things into jar (but this another discussion )
>
> I still have one question: what about `commponent://` url in xml (screen, service,...) ? are you going to rewrite ComponentLocationResolver to load
> groovy from compiled `.class`
>
> Samuel
>
>
> On 16/09/2019 12:28, Jacques Le Roux wrote:
>> Hi Devs,
>>
>> While working on OFBIZ-10226 "Adds groovyScripts in the Gradle sourceSets" I discussed with Mathieu and we had some ideas.
>>
>> Mathieu suggested to move Groovy scripts from /groovyScripts/ to/src/main/groovy/.
>>
>> I was initially reluctant because I love to be able to change things on the fly. That's why I liked Minilang and still like widgets, Freemarker
>> templates and Groovy Scripts.
>>
>> We also know the advantages of compilation. But then I thought: why not have best of both Groovy worlds: compile and on the fly.
>>
>> I tried and it works. So here is the (simple) plan:
>>
>> 1. We move all Groovy scripts from /groovyScripts/ to /src/main/groovy/
>> 2. We add the necessary packages names
>> 3. Devs can then open "gradlew --continuous" in a terminal and let it like that. It will continuously build on any changes in Gradle sourcesets
>>
>> So, if you modify a Groovy scripts while running an OFBiz instance, the changes will be reflected in the instance and you can check possible syntax
>> or alike issues in the terminal running the continuous build. It's very fast since only changes have an impact on the build.
>>
>> I'm sure there are other benefits to follow "the common convention of putting groovy compiled sources in ${COMPONENT}/src/main/groovy.", as
>> suggested Mathieu.
>>
>> I see no disadvantages, do you? If nobody disagree with this idea, I'll create a Jira for that.
>>
>> Feedback welcome, thanks
>>
>> Jacques
>>
>>
>