Better ant with pnuts?

View: New views
4 Messages — Rating Filter:   Alert me  

Better ant with pnuts?

by petar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hallo Folks,

are there any plans with pnuts to make a better ant or even maven?

There are similar projects out in the web. Based on the ruby scripting
language:

http://raven.rubyforge.org/index.html
http://buildr.rubyforge.org/

Discussed from Martin Fowler here:

http://www.martinfowler.com/articles/rake.html
http://www.martinfowler.com/bliki/JRake.html

Bye, Peter.

Re: Better ant with pnuts?

by NateS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I use a build system I developed with Pnuts. It is basically a library
to do common build related tasks and a Pnuts script that uses the
library. The library is very simple. I borrowed the directory scanner
mechansim from Ant's source and tweaked it so it is easy to use. I wrote
a class that parses a project.xml file of my own format into an instance
of a "Project" class which contains the data in the XML file along with
the collections of paths defined there (dependent libs, source, tests,
etc). The rest of the system is a Pnuts file of about 200 lines that
defines utility methods that take a project object and do something
useful, like compile the source, run the tests, create a JAR, build
javadocs, etc.

In the end, I think the build system is a lot easier to customize for
your own use. If the default pnut utility functions don't work like you
want, you can modify the ~200 line file easily and when you are done,
the system can do exactly what you want. It is easy because you don't
have to mess with plugins and "XML scripting", just Pnuts code, which
should be trivial for Java developers.

I just don't like programming in XML (aka Ant) for a build system. Some
build systems like Maven are trying to solve problems I am not, like a
central artifact repository. I don't have an answer for that, but if you
just need a simple, flexible build system for your projects, I think my
solution is reasonable. If you want to check it out, I zipped up an
older version (before I integrated it into my proprietary software) here...
http://n4te.com/dev/java/build.zip
Note while it isn't terrible, I never got around to packaging it up
nicely for others to use.

The "getPaths" Pnuts function (and related build.scanner.Paths class) is
key. This lets you easily select files and manipulate them, eg...
getPaths("some/stuff", "blah/**").zip("blah.zip")
This would select all files and folders recursively under the folder
"some/stuff/blah" and zip them into the file "blah.zip". When complete,
blah.zip would contain the folder "blah" and all the files under it.
What is key is that the first arg to getPaths is the "root" directory,
and all other files selected by subsequent args keep their folder
structure. The function supports varargs, and patterns starting with "!"
exclude the matched files...
getPaths("some/stuff", "blah/**", "!blah/badstuff",
"**/*.jar").copyTo("somewhere")
Also, getPaths returns a "Paths" instance, which can be manipulated in
various ways. The File objects and paths can be accessed, more paths
added, and there are utility methods for move, copy, zip, delete,
iteration, etc.

-Nate


Peter Karich wrote:

> Hallo Folks,
>
> are there any plans with pnuts to make a better ant or even maven?
>
> There are similar projects out in the web. Based on the ruby scripting
> language:
>
> http://raven.rubyforge.org/index.html
> http://buildr.rubyforge.org/
>
> Discussed from Martin Fowler here:
>
> http://www.martinfowler.com/articles/rake.html
> http://www.martinfowler.com/bliki/JRake.html
>
> Bye, Peter.

Re: Better ant with pnuts?

by petar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> In the end, I think the build system is a lot easier to customize for
> your own use. If the default pnut utility functions don't work like you
> want, you can modify the ~200 line file easily and when you are done,
> the system can do exactly what you want. It is easy because you don't
> have to mess with plugins and "XML scripting", just Pnuts code, which
> should be trivial for Java developers.
>
> I just don't like programming in XML (aka Ant) for a build system.
Me too. Thats the point I was asking.
Your 'pnuts-build project' sounds great!
Do you want to extend it or keep it up to date?


Peter.



PS: May I freely use the code?? Because I couldn't find a license file
or header?

Re: Better ant with pnuts?

by NateS :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't think I have the time to make it into a real project. The code
lifted from Ant is under the Apache license and requires a copyright
notice and disclaimer, sorry about that. Please include that if you do
anything with the code. For simplicity I'll go ahead and make the rest
of the code under the same license. If you want to use the code for a
Pnuts based build system, that would be awesome. :) I would help where I
could, I just don't have time in the immediate future to tackle another
project.

-Nate


Peter Karich wrote:

>
>> In the end, I think the build system is a lot easier to customize for
>> your own use. If the default pnut utility functions don't work like
>> you want, you can modify the ~200 line file easily and when you are
>> done, the system can do exactly what you want. It is easy because you
>> don't have to mess with plugins and "XML scripting", just Pnuts code,
>> which should be trivial for Java developers.
>>
>> I just don't like programming in XML (aka Ant) for a build system.
> Me too. Thats the point I was asking.
> Your 'pnuts-build project' sounds great!
> Do you want to extend it or keep it up to date?
>
>
> Peter.
>
>
>
> PS: May I freely use the code?? Because I couldn't find a license file
> or header?
LightInTheBox - Buy quality products at wholesale price!