You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by 向雅 <fy...@gmail.com> on 2008/11/18 18:44:02 UTC

Contribute for ANT a new format script with a new ProjectHelper

Hi team,
I made a new script ON(ObjectNotation), and I like ant and I developed
a ONProjectHelper2.
I think I should share it with all.
I want know there are someone has some interesting on it.

There is sample script for ant anton self.

project: compile, buildonant, .;
name: buildANTON;
default: deploy;
basedir: .;
path{
	id:onpath;
	pathelement	{location:"lib/antlr-3.1.1-runtime.jar"},
	{location:"${antlr}/antlr-2.7.7.jar"}	
	{location:"${antlr}/stringtemplate.jar"},
	{location: lib/antlr-3.1.1-runtime.jar, lib/on.jar}
}

target{ name: init;
	echo: "${ant.home}";
	echo{message:"${ant.project.name}"}
	delete{dir: output/classes}
	mkdir{dir: output/classes}
}

target
{	name: compile;	depends: init; description:--compile buildonant;
	javac{srcdir:src; destdir: output/classes; includes:
**/ONProjectHelper2.java; classpath:
	"lib/antlr-3.1.1-runtime.jar;lib/on.jar"}
}
{ name: deploy; depends: compile;
	jar{destfile: "${ant.home}/lib/anton.jar";
		fileset{dir: output/classes;
			include: {name:**/ONProjectHelper2.class;}
		}
		fileset{dir: src; includes: "META-INF/**";}
	}
}

Besides this, I have 2 problems:
1,I want take care of some xml format file, but current ProjectHelper
implementation just do one helper. I hope the newInstance failed so
ant can make use origin ant instead of anton. if new I do it, just
wrapper ProjectHelper2, not a good way.
2, I want search default file build.on instead of build.xml, or search
build.on or build.xml. but ProjectHelper not help:)

Best regards,
Qinxian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Contribute for ANT a new format script with a new ProjectHelper

Posted by Stefan Bodewig <bo...@apache.org>.
On 2008-11-19, 向雅 <fy...@gmail.com> wrote:

> after patch ProjectHelper with a method accept(buildFile), if file
> is xml, ONProjectHelper not accept, so all control transfer to ant
> with xml.  else if file is on, ONProjectHelper do it.

This change to ProjectHelper sounds pretty innocent (an accept method
that always returns true in the base class, if I understand
correctly).

> Can I upload some source code to sanbox like?

The sandbox is only writable for Ant committers,
<http://ant.apache.org/bylaws.html#Roles%20and%20Responsibilities>,
but you can always open a bugzilla issue and attach your patch to it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Contribute for ANT a new format script with a new ProjectHelper

Posted by 向雅 <fy...@gmail.com>.
Thanks Stefan.
Current I implemented an ONProjectHelper, and Patch ProjectHelper  and
ant.Main for the 2 problems.
I employe sevice magic way, so now I just run ant like before.
If there has a build.xml, run ant with xml style.
else if has build.on, run ant with on style.
if -f or -s arguments given, first try ONProjectHelper(service do it),
after patch ProjectHelper with a method accept(buildFile),
if file is xml, ONProjectHelper not accept, so all control transfer to
ant with xml.
else if file is on, ONProjectHelper do it.

through patch do it well, but I dont hope user produce some other not
happy thought,
so if ant can patch this:)
If you can add some method, it's best:)

Can I upload some source code to sanbox like?

Regards,
Qinxian


2008/11/19 Stefan Bodewig <bo...@apache.org>:
> On 2008-11-18, 向雅 <fy...@gmail.com> wrote:
>
>> Besides this, I have 2 problems:
>> 1,I want take care of some xml format file, but current ProjectHelper
>> implementation just do one helper. I hope the newInstance failed so
>> ant can make use origin ant instead of anton. if new I do it, just
>> wrapper ProjectHelper2, not a good way.
>
> This will usually happen when an <ant> task is invoked, I've seen that
> myself when I implemented the ProjectHelper in JavaFront
> http://svn.apache.org/repos/asf/ant/sandbox/javafront/
>
> So far I've neglected the issue.  I'd probably hard-code
> ProjectHelper2 and delegate to it when my ProjectHelper is asked to
> parse an XML file.
>
> Any other solution would likely lead us to breaking the ProjectHelper
> contracts in not-so-subtle ways.
>
>> 2, I want search default file build.on instead of build.xml, or search
>> build.on or build.xml. but ProjectHelper not help:)
>
> And I don't think ProjectHelper would be the right place to add
> functionality like searching for build files.
>
> We might add a method that returned the preferred extension and
> returned ".xml" in the base class.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>



-- 
致敬
向雅

Re: Contribute for ANT a new format script with a new ProjectHelper

Posted by Stefan Bodewig <bo...@apache.org>.
On 2008-11-18, 向雅 <fy...@gmail.com> wrote:

> Besides this, I have 2 problems:
> 1,I want take care of some xml format file, but current ProjectHelper
> implementation just do one helper. I hope the newInstance failed so
> ant can make use origin ant instead of anton. if new I do it, just
> wrapper ProjectHelper2, not a good way.

This will usually happen when an <ant> task is invoked, I've seen that
myself when I implemented the ProjectHelper in JavaFront
http://svn.apache.org/repos/asf/ant/sandbox/javafront/

So far I've neglected the issue.  I'd probably hard-code
ProjectHelper2 and delegate to it when my ProjectHelper is asked to
parse an XML file.

Any other solution would likely lead us to breaking the ProjectHelper
contracts in not-so-subtle ways.

> 2, I want search default file build.on instead of build.xml, or search
> build.on or build.xml. but ProjectHelper not help:)

And I don't think ProjectHelper would be the right place to add
functionality like searching for build files.

We might add a method that returned the preferred extension and
returned ".xml" in the base class.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org