Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ANT to manage delphi project

Status
Not open for further replies.

IPOz

Programmer
Jul 11, 2001
109
CN
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=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
<!-- An Ant build file for the delphi
-->

<project name=&quot;Delphi Build Script&quot; default=&quot;build&quot; basedir=&quot;.&quot;>

<property name=&quot;dpr.name&quot; value=&quot;testCAS.dpr&quot; />

<property name=&quot;build.dir&quot; value=&quot;${basedir}/build&quot; />
<property name=&quot;build.dcu.dir&quot; value=&quot;${basedir}/build/dcu&quot; />
<property name=&quot;unit.dir&quot; value=&quot;'C:\Program Files\Borland\Delphi5\imports'&quot; />

<target name=&quot;init&quot;>
</target>

<target name=&quot;compile&quot; depends=&quot;init&quot;>
<exec executable=&quot;dcc32.exe&quot; dir=&quot;${basedir}/src&quot;>
<arg line=&quot;-Q -B -W -U${unit.dir} -N${build.dcu.dir} -E${build.dir} ${dpr.name}&quot; />
</exec>
</target>

<target name=&quot;run&quot; depends=&quot;compile&quot;>
<exec executable=&quot;${build.dir}/testCAS.exe&quot;>
</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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top