Delphi7 Want编译配置文件编写

最近在学习TDD开发,一直用Delphi7开发程序(各位大侠不要笑话我),配合DUNIT开发(推荐用DUNITWizard插件,支持生成test程序在Console和GUI下运行),通过网上查找内容,发现这篇网页PDF文档介绍的内容比较适用我,下载Want(下载0.3.3,最新2.02支持的脚本xml,是一种Script语言),WANT是像ant的构建工具,基本上语法与ant一致,但是增加了dcc,dunit几个与delphi有关的命令。自己研究下,编写了一个支持我项目中的配置文件build.xml。我的目录结构和上面网页的类似,不过约有调整。

Project

—    |–src(应用程序源码)

        |–test(测试程序源码)

        |–scratch(中间文件)

             |–dcu(生成的编译文件)
        |–deploy(执行代码和构建文件build.xml)
        |–doc(文档)
        |–lib(开发库)
            |–want

 

配置文件如下:

<project name="testcommonprj" basedir="." default="compile" >
    <property name="src.dir" value="${basedir}/src" />
    <property name="test.dir" value="${basedir}/test" />
    <property name="deploy.dir" value="${basedir}/deploy" />
    <property name="dcu.dir" value="${basedir}/scratch/dcu" />
    <property name="delphi" value="D:/Program Files/Borland/Delphi7" />
    <property name="components" value="E:/Source/Delphi/Component"/>
    <property name="test.app" value="testcommonprjstructTests" />
    <property name="main.app" value="testcommonprjstruct" />
    <property name="mainexe.name" value="${deploy}/${main.app}.exe"/>
    <property name="maintestexe.name" value="${deploy}/${test.app}.exe"/>
    
    <patternset id="componentsdir">
        <include name = "${components}/dunit_v9.2.0/src"  />
    </patternset>       
    <patternset id="main.src">
        <include name="${src.dir}/view"  />
        <include name="${src.dir}/common"  />
    </patternset>       
    
    <patternset id="test.src" refid="main.src">
        <include name="${test.dir}/**"  />
    </patternset>   
        
    <target name="clean">
        <echo message="delete dcu" />
        <delete dir="${dcu.dir}" >
            <include name="**" />
        </delete>
        <echo message="delete exe" />       
        <delete dir="${deploy.dir}">
            <include name="*.exe" />
        </delete>           
    </target>
        
    <target name="prepare">
        <mkdir dir="${dcu.dir}"></mkdir>
        <mkdir dir="${deploy.dir}"></mkdir>
    </target>   
    <target name="compile" depends="clean,compiletest,compileapp">  
    </target>
    
    <target name="compileapp">
        <echo message="build ${main.app}" />
        <dcc basedir="${src.dir}" source="${main.app}.dpr">
            <build value="True" />
            <exeoutput path="${deploy.dir}" />
            <dcuoutput path="${dcu.dir}" />
            <warnings value="True" />
            <map value="none" />
            <console value="False" />
            <unitPath refid="main.src" />
            <resourcePath refid="main.src"/>
        </dcc>  
    </target>   
    
    
    <target name="compiletest">
        <echo message="build ${test.app}" />
        <dcc basedir="${test.dir}" source="${test.app}.dpr">
            <build value="True" />
            <exeoutput path="${deploy.dir}" />
            <dcuoutput path="${dcu.dir}" />
            <warnings value="True" />
            <map value="none" />
            <console value="True" />
            <unitPath refid="test.src" />
            <includepath refid="componentsdir" />
            <resourcePath refid="test.src"/>
        </dcc>  
    </target>   
    
    <target name="runtest" depends="clean,compiletest">
        <echo message="run test ${maintestexe.name}" />
        <exec executable="${maintestexe.name}"/>
    </target>
    
    <target name="runmain" depends="clean,compileapp">
        <echo message="run test ${mainexe.name}" />
        <exec executable="${mainexe.name}"/>
    </target>   
</project>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值