« Return to Thread: Replacing build.xml with Build.java - Doing Ant builds directly from Java

Re: Replacing build.xml with Build.java - Doing Ant builds directly from Java

by Steve Loughran :: Rate this Message:

Reply to Author | View in Thread

Michael Ludwig wrote:

> Ashley Williams schrieb am 11.06.2009 um 17:51:45 (+0100):
>> // create the ant parent project
>> Project project = new Project();
>> project.setName("project");
>> project.init();
>>
>> // create the child target
>> Target target = new Target();
>> target.setName("target");
>> project.addTarget(target);
>> project.addBuildListener(new Log4jListener());
>
> The Ant XML isn't exactly compact and doesn't flow like, say, Python
> or Perl; but painstakingly recreating the XML structure from the API
> is even harder for the eyeball.
>
> But of course, this usage may have its places and applications.

Ant's API-mode is a bit more brittle than the XML level, and there are a
few steps to setting it up. when I run it embedded, we have a special
logger that checks for an interrupted flag -if it is set it throws a
special subclass of BuildException

http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/ant/src/org/smartfrog/services/ant/InterruptibleLogger.java

All the rest of our embedding code is there to see, even though it has
an LGPL license, we're going to move to the ASF license, so ask nicely
and we'll edit the header on whichever file you want to cut and paste from.

http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/ant/

My most recent work in this area was using the unzip code, where it
turned out to be easier to take bits of the unzip task and call its
underlying code directly, bypassing the task (though using it as the
foundation for my own code)
http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/ant/src/org/smartfrog/services/archives/UnzipImpl.java?view=markup

Remember, this is the other right that open source software gives you.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: Replacing build.xml with Build.java - Doing Ant builds directly from Java