Scripting and Build Tools

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

Scripting and Build Tools

Eric Armstrong-2
 > On 07/03/06, John Wilson <[hidden email]> wrote:
 >> On 7 Mar 2006, at 12:15, Dillman, Brad wrote:
 >>
 >>> Does anybody have any URLs for learning about DSLs?
 >>>
 >> This is probably the best place to start
 >> http://www.martinfowler.com/
 >>
I might not have taken the time to investigate DSLs
much further. But when I saw Fowler's name, I was
compelled. Anything he has to say, I'm interested in.

Looking over his site, I came across yet another tour
de force, this time on build languages:
http://www.martinfowler.com/articles/rake.html

He's pretty well got me convinced that Ruby's Rake
project got it right. This is the kind of thing I
was hoping for in Groovy.

The short version is:

    * You use a scripting language as a basis
    * You create a Task entity that use to
      define tasks. It manages dependencies.
    * The non-obtrusive syntax of the scripting
      language lets you write scripts that look
      like makefiles
    * But you have the expressive power of the
      scripting language at your disposal anytime
      you want it.

http://www.martinfowler.com/articles/rake.html
Reply | Threaded
Open this post in threaded view
|

Re: Scripting and Build Tools

Russel Winder
On Wed, 2006-03-08 at 15:43 -0800, Eric Armstrong wrote:

> Looking over his site, I came across yet another tour
> de force, this time on build languages:
> http://www.martinfowler.com/articles/rake.html

Martin is a good presenter of ideas and a solid thinker however I would
hardly call this a tour de force.  It is a nice piece on using what
appears to be an excellent tool developed by others (Jim Weirich et al.)

Personally I am a fan of using programming languages directly rather
than DSLs.  So, for example, there is SCons and A-A-P in Python or,
perhaps far more importantly, AntBuilder for Groovy -- though it has to
be said AntBuilder is really tied to JVM-related building and so there
is an argument for doing something SCons-like in Groovy.

Of course Ruby has two build systems Rake and Rant.  Many claim Rant to
be superior.  

> He's pretty well got me convinced that Ruby's Rake
> project got it right. This is the kind of thing I
> was hoping for in Groovy.

Many people agree with something along these lines, not least because a
number of people hate writing XML files to control Ant.

> The short version is:
>
>     * You use a scripting language as a basis
>     * You create a Task entity that use to
>       define tasks. It manages dependencies.
>     * The non-obtrusive syntax of the scripting
>       language lets you write scripts that look
>       like makefiles
>     * But you have the expressive power of the
>       scripting language at your disposal anytime
>       you want it.
>
> http://www.martinfowler.com/articles/rake.html
All very true -- well except the implication that having build files
look like Makefiles is a good think, I do not believe that.

Currently I am doing a lot of playing with Groovy and AntBuilder trying
to experiment to see if a Groovy based competitor in the
Rake/Rant/SCons/A-A-P arena is worth pursuing.  Currently I am of the
view that it is not.  However, creating something that replaces Ant XML
files seems like a truly sensible and feasible thing to do.
Particularly if such a system can evolve and replace Maven.  It also
allows the possibility of introducing MD5 checksum related checking
rather than timestamp related checking -- a strong plus in many, many
cases.

So if what you want is something in Groovy to control C++ builds then I
would suggest using SCons/A-A-P/Rake/Rant.  If you want to deal in
Java/Groovy system builds then currently there is no specific tool but
using AntBuilder goes a seriously long way to solving many of the
irritations of Ant.

--
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             [hidden email]

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Scripting and Build Tools

Eric Armstrong-2
I appreciate the additional tips. I'll take a look
at Rant.

Is there an example of a build script that uses
AntBuilder? I'm kind of curious to see what it
looks like.

I remain a huge fan of Fowler's. There are very
few technology writers I look up to. Fowler is one
of them.

Russel Winder wrote:

> On Wed, 2006-03-08 at 15:43 -0800, Eric Armstrong wrote:
>
>> Looking over his site, I came across yet another tour
>> de force, this time on build languages:
>> http://www.martinfowler.com/articles/rake.html
>
> Martin is a good presenter of ideas and a solid thinker however I would
> hardly call this a tour de force.  It is a nice piece on using what
> appears to be an excellent tool developed by others (Jim Weirich et al.)
>
> Personally I am a fan of using programming languages directly rather
> than DSLs.  So, for example, there is SCons and A-A-P in Python or,
> perhaps far more importantly, AntBuilder for Groovy -- though it has to
> be said AntBuilder is really tied to JVM-related building and so there
> is an argument for doing something SCons-like in Groovy.
>
> Of course Ruby has two build systems Rake and Rant.  Many claim Rant to
> be superior.  
>
>> He's pretty well got me convinced that Ruby's Rake
>> project got it right. This is the kind of thing I
>> was hoping for in Groovy.
>
> Many people agree with something along these lines, not least because a
> number of people hate writing XML files to control Ant.
>
>> The short version is:
>>
>>     * You use a scripting language as a basis
>>     * You create a Task entity that use to
>>       define tasks. It manages dependencies.
>>     * The non-obtrusive syntax of the scripting
>>       language lets you write scripts that look
>>       like makefiles
>>     * But you have the expressive power of the
>>       scripting language at your disposal anytime
>>       you want it.
>>
>> http://www.martinfowler.com/articles/rake.html
>
> All very true -- well except the implication that having build files
> look like Makefiles is a good think, I do not believe that.
>
> Currently I am doing a lot of playing with Groovy and AntBuilder trying
> to experiment to see if a Groovy based competitor in the
> Rake/Rant/SCons/A-A-P arena is worth pursuing.  Currently I am of the
> view that it is not.  However, creating something that replaces Ant XML
> files seems like a truly sensible and feasible thing to do.
> Particularly if such a system can evolve and replace Maven.  It also
> allows the possibility of introducing MD5 checksum related checking
> rather than timestamp related checking -- a strong plus in many, many
> cases.
>
> So if what you want is something in Groovy to control C++ builds then I
> would suggest using SCons/A-A-P/Rake/Rant.  If you want to deal in
> Java/Groovy system builds then currently there is no specific tool but
> using AntBuilder goes a seriously long way to solving many of the
> irritations of Ant.
>
Reply | Threaded
Open this post in threaded view
|

RE: Scripting and Build Tools

Dierk König
For a combination of Ant and Groovy Task see this example
from the Grails project:

http://cvs.grails.codehaus.org/viewrep/grails/grails/src/grails/build.xml?r=
1.68

Here's an example that uses WebTest, i.e. it's all
custom Ant tasks:
http://cvs.grails.codehaus.org/viewrep/grails/grails/src/grails/templates/ar
tifacts/WebTest.groovy?r=1.3

Overall I would say Ant/Groovy make a good build automation
system (at least comparable if not better than Rake/Rant).
For making good dependency resolution and package installation
like Ruby-Gems, there is no Groovy-enabled solution yet.
Any help is welcome.

Mittie


> -----Original Message-----
> From: Eric Armstrong [mailto:[hidden email]]
> Sent: Donnerstag, 9. März 2006 2:06
> To: [hidden email]
> Subject: Re: [groovy-user] Scripting and Build Tools
>
>
> I appreciate the additional tips. I'll take a look
> at Rant.
>
> Is there an example of a build script that uses
> AntBuilder? I'm kind of curious to see what it
> looks like.
>
> I remain a huge fan of Fowler's. There are very
> few technology writers I look up to. Fowler is one
> of them.
>
> Russel Winder wrote:
> > On Wed, 2006-03-08 at 15:43 -0800, Eric Armstrong wrote:
> >
> >> Looking over his site, I came across yet another tour
> >> de force, this time on build languages:
> >> http://www.martinfowler.com/articles/rake.html
> >
> > Martin is a good presenter of ideas and a solid thinker however I would
> > hardly call this a tour de force.  It is a nice piece on using what
> > appears to be an excellent tool developed by others (Jim Weirich et al.)
> >
> > Personally I am a fan of using programming languages directly rather
> > than DSLs.  So, for example, there is SCons and A-A-P in Python or,
> > perhaps far more importantly, AntBuilder for Groovy -- though it has to
> > be said AntBuilder is really tied to JVM-related building and so there
> > is an argument for doing something SCons-like in Groovy.
> >
> > Of course Ruby has two build systems Rake and Rant.  Many claim Rant to
> > be superior.
> >
> >> He's pretty well got me convinced that Ruby's Rake
> >> project got it right. This is the kind of thing I
> >> was hoping for in Groovy.
> >
> > Many people agree with something along these lines, not least because a
> > number of people hate writing XML files to control Ant.
> >
> >> The short version is:
> >>
> >>     * You use a scripting language as a basis
> >>     * You create a Task entity that use to
> >>       define tasks. It manages dependencies.
> >>     * The non-obtrusive syntax of the scripting
> >>       language lets you write scripts that look
> >>       like makefiles
> >>     * But you have the expressive power of the
> >>       scripting language at your disposal anytime
> >>       you want it.
> >>
> >> http://www.martinfowler.com/articles/rake.html
> >
> > All very true -- well except the implication that having build files
> > look like Makefiles is a good think, I do not believe that.
> >
> > Currently I am doing a lot of playing with Groovy and AntBuilder trying
> > to experiment to see if a Groovy based competitor in the
> > Rake/Rant/SCons/A-A-P arena is worth pursuing.  Currently I am of the
> > view that it is not.  However, creating something that replaces Ant XML
> > files seems like a truly sensible and feasible thing to do.
> > Particularly if such a system can evolve and replace Maven.  It also
> > allows the possibility of introducing MD5 checksum related checking
> > rather than timestamp related checking -- a strong plus in many, many
> > cases.
> >
> > So if what you want is something in Groovy to control C++ builds then I
> > would suggest using SCons/A-A-P/Rake/Rant.  If you want to deal in
> > Java/Groovy system builds then currently there is no specific tool but
> > using AntBuilder goes a seriously long way to solving many of the
> > irritations of Ant.
> >

Reply | Threaded
Open this post in threaded view
|

Re: Scripting and Build Tools

Russel Winder
In reply to this post by Eric Armstrong-2
On Wed, 2006-03-08 at 17:05 -0800, Eric Armstrong wrote:

> Is there an example of a build script that uses
> AntBuilder? I'm kind of curious to see what it
> looks like.

Below is a trivial example showing the beginnings of the idea.  The
issue that is exercising me just now is how to get dependency management
in rather than just using function call for the different targets.

> I remain a huge fan of Fowler's. There are very
> few technology writers I look up to. Fowler is one
> of them.

Good job I taught him software engineering then !




#! /usr/bin/env groovy

class build {
  def ant = new AntBuilder ( )

  def buildDir = "Build"
  def sourceDir = "Source"
  def testsDir = "Tests"

  def groovyJar = System.properties.'user.home' +
"/lib/Java/groovy/groovy-all.jar"

  def classpathRefName = "classpath"

  def init ( ) {
    ant.mkdir ( dir : buildDir )
    ant.path ( id : classpathRefName ) { ant.pathelement ( location :
groovyJar ) }
    ant.taskdef ( name : "groovy" , classname :
"org.codehaus.groovy.ant.Groovy" , classpathref : classpathRefName )
    ant.taskdef ( name : "groovyc" , classname :
"org.codehaus.groovy.ant.Groovyc" , classpathref : classpathRefName )
  }
   
  def compile ( ) {
    init ( )
    ant.groovyc ( srcdir : sourceDir , destDir : buildDir ,
classpathref : classpathRefName )
  }
   
  def test ( ) {
    compile ( )
    ant.groovy ( src : testsDir + "/Factorial_Test.groovy" ,
classpathref : classpathRefName , fork : "true" )
  }
   
  def clean ( ) {
    ant.delete ( dir : buildDir , quiet : "true" )
    ant.delete ( quiet : "true" ) {
    ant.fileset ( dir : "." , includes : "**/*~" , defaultexcludes :
"no" )
    }
  }
   
  static main ( args ) {
    def builder = new build ( )
    if ( args.length == 0 ) { builder.test ( ) }
    else { builder.invokeMethod ( args[0] , null ) }
  }
}

--
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             [hidden email]

signature.asc (196 bytes) Download Attachment