hi,friends
Sometimes you donot want to enter delphi IDE when you want to build your project.Of course you can use batch file to do this job however the jakarda ANT is more powerful and flexible
Suppose the delphi project is named testCAS.dpr and the directory structure is as below:
c:\test(build.xml)
|_build
| |_dcu
|
|_src(testCAS.dpr,main.pas,main.dfm)
build.xml
-------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!-- An Ant build file for the delphi
-->
<project name="Delphi Build Script" default="build" basedir=".">
<property name="dpr.name" value="testCAS.dpr" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.dcu.dir" value="${basedir}/build/dcu" />
<property name="unit.dir" value="'C:\Program Files\Borland\Delphi5\imports'" />
<target name="init">
</target>
<target name="compile" depends="init">
<exec executable="dcc32.exe" dir="${basedir}/src">
<arg line="-Q -B -W -U${unit.dir} -N${build.dcu.dir} -E${build.dir} ${dpr.name}" />
</exec>
</target>
<target name="run" depends="compile">
<exec executable="${build.dir}/testCAS.exe">
</exec>
</target>
</project>
--------------------------
then you can build and run testCAS as below:
c:\test\ant compile
c:\test\ant run
BTW,the ant must be in your classpath.
Best Regards! ipo_z@cmmail.com
Garbage in,Garbage out
Sometimes you donot want to enter delphi IDE when you want to build your project.Of course you can use batch file to do this job however the jakarda ANT is more powerful and flexible
Suppose the delphi project is named testCAS.dpr and the directory structure is as below:
c:\test(build.xml)
|_build
| |_dcu
|
|_src(testCAS.dpr,main.pas,main.dfm)
build.xml
-------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!-- An Ant build file for the delphi
-->
<project name="Delphi Build Script" default="build" basedir=".">
<property name="dpr.name" value="testCAS.dpr" />
<property name="build.dir" value="${basedir}/build" />
<property name="build.dcu.dir" value="${basedir}/build/dcu" />
<property name="unit.dir" value="'C:\Program Files\Borland\Delphi5\imports'" />
<target name="init">
</target>
<target name="compile" depends="init">
<exec executable="dcc32.exe" dir="${basedir}/src">
<arg line="-Q -B -W -U${unit.dir} -N${build.dcu.dir} -E${build.dir} ${dpr.name}" />
</exec>
</target>
<target name="run" depends="compile">
<exec executable="${build.dir}/testCAS.exe">
</exec>
</target>
</project>
--------------------------
then you can build and run testCAS as below:
c:\test\ant compile
c:\test\ant run
BTW,the ant must be in your classpath.
Best Regards! ipo_z@cmmail.com
Garbage in,Garbage out