ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vitaliy S" <runa...@gmail.com>
Subject Re: How to add mutable content to immutable build file
Date Sun, 18 Jun 2006 12:28:46 GMT
Hello Ben,

I want to let users to change content of task in my ant file but don't want
to let them change the file it self.

e.g.

<project name="myproject" basedir=".">
	<target name="mytarget">
		<copy todir="../dest/dir">
		  <fileset dir="src_dir">
		     <exclude name="/*.java"/>
		   </fileset>
		  <!--begin of mutable content -->
		   <fileset dir="other_src__dir">
		     <exclude name="**/*.java"/>
		   </fileset>
		  <!--end of mutable content -->
		</copy>
	</target>
</project>

In the example above mutable part can not be extracted as seporate
task of other ant file.
(in actual example it is hibernate hbm files include for xdoclet).
I want to find clean solution to include xml code for subtasks from a
different files to my build file.

Thanks for your replay.

Regards,
Vitaliy S
On 6/17/06, Ben Stringer <ben@burbong.com> wrote:
> On Fri, 2006-06-16 at 18:54 +0300, Vitaliy S wrote:
> > Hello,
> >
> > I have target with a task supporting subtasks
> > e.g
> >
> >  <copy todir="../dest/dir">
> >    <!--begin of mutable content -->
> >     <fileset dir="src_dir">
> >       <exclude name="**/*.java"/>
> >     </fileset>
> >    <!--end of mutable content -->
> >   </copy>
> > the content of task may be changed but the rest file is immutable.
> > I want to store mutable content in  seporate file.
> > What is the best way to do it?
>
> Hi Vitaliy,
>
> I'm not sure I understand your requirement, but if you are saying that
> the XML describing the task will change from build to build, and you
> need to use it, then I'd suggest using <import> to import the mutable
> part of the task, then having the immutable part of the task call the
> mutable part using <antcall>.
>
> Eg.
>
> mutable.xml:
>
> <project name="mutable" basedir=".">
>   <target name="mutable.part">
>     <echo>I change from build to build</echo>
>   </target>
> </project>
>
> build.xml:
>
> <project name="build" basedir=".">
>   <import file="mutable.xml"/>
>   <target name="immutable.part">
>     <echo>I never change from build to build</echo>
>     <antcall target="mutable.part"/>
>     <echo>I also never change</echo>
>   </target>
> </project>
>
> If the mutable part changes _during_ build time, this gets trickier,
> although it still should be possible to get working, by using the <ant>
> task to re-import the mutable file.
>
> But not fully understanding what you are after, I may be way off here :)
>
> Cheers, Ben
>
> >
> >
> > Regards,
> > Vitaliy S
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
Regards,
Vitaliy S

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


Mime
View raw message