建立项目中的每日构建

     每日构建,是业界比较认可的开发方式,每天将开发人员的代码成果提交,然后编译、测试。不但可以及时了解到开发的情况,保证项目进度,也使项目开发人员养成了良好的习惯。以前的项目是使用CC做配置管理,最近负责的一个使用VSS,以前的ant脚本无法使用,查了一些资料,终于把机制建立起来了。

    基于VSS日构建的主要脚本:

 

     < target  name ="clean" >
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/OA_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/PLT_BIZ_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/PLT_COMMON_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/PLT_DB_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/PLT_FRAMEWORK_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/VIEW_SRC" />
        
< delete  dir ="${VOB_PATH}/SIMP1.0.1.0/test" />
    
</ target >     
    
<!-- 从Vss里面取出最新的源代码 -->    
    
< target  depends =""  name ="update_vss" >    
        
< echo  message ="取最新源代码" />    
        
< vssget  localPath ="${VOB_PATH}/SIMP1.0.1.0/OA_SRC"  recursive ="true"  login ="xufei,xufei"
            vsspath
="$/01_产品开发/02_版本级文档/07_源代码/SIMP1.0.1.0/OA_SRC"  ssdir ="${vss.ssdir}"  serverpath ="${vss.svrdir}"  writable ="true" />
        
< vssget  localPath ="${VOB_PATH}/SIMP1.0.1.0/PLT_BIZ_SRC"  recursive ="true"  login ="xufei,xufei"
            vsspath
="$/01_产品开发/02_版本级文档/07_源代码/SIMP1.0.1.0/PLT_BIZ_SRC"  ssdir ="${vss.ssdir}"  serverpath ="${vss.svrdir}"  writable ="true" />          
    
</ target >
    
<!-- 自定义ant任务 检查日志错误 -->    
    
< target  name ="checkjava" >
        
< echo  message ="开始检查java编译错误..." />
        
< ci_checkjava  javalog ="${JAVA_LOG}"  message ="因为java文件编译存在错误,所以退出单元测试。" />
    
</ target >
    
<!-- 进行单元测试 -->    
    
< target  name ="unittest"  unless ="java.error" >
        
< echo  message ="开始单元测试..." />
        
< record  name ="${UNIT_LOG}"  action ="start" />
             
< javac  destdir ="${MAIN_DIR}/test/classes"  nowarn ="on"  encoding ="GBK"  failonerror ="false" >
    
< classpath  refid ="simp_depend_lib_path" />
    
< classpath  path ="${MAIN_DIR}/classes" />
    
< src  refid ="simp_test_path" />
             
</ javac >
             
< junit  fork ="on"  printsummary ="yes" >
    
< classpath  refid ="simp_depend_lib_path" />
    
< classpath >
    
< pathelement  location ="${MAIN_DIR}/classes" />
    
< pathelement  location ="${MAIN_DIR}/test/classes" />
    
</ classpath >
    
< formatter  type ="plain" />
    
< batchtest  fork ="no"  todir ="${MAIN_DIR}/test/result" >
        
< fileset  dir ="${VOB_PATH}/code/commonstest" >
        
< include  name ="**/*Test.java" />
        
</ fileset >
        
< fileset  dir ="${VOB_PATH}/code/eaftest" >
        
< include  name ="**/*Test.java" />
        
</ fileset >
    
</ batchtest >
              
</ junit >
              
< junitreport  todir ="${MAIN_DIR}/reports" >
    
< fileset  dir ="${MAIN_DIR}/test/result" >
    
< include  name ="TEST-*.xml" />
    
</ fileset >
    
< report  format ="frames"  todir ="${MAIN_DIR}/reports" />
               
</ junitreport >
               
< record  name ="${UNIT_LOG}"  action ="stop" />
    
</ target >
    
<!-- 编译java代码 -->    
    
< target  name ="compilejava" >
         
< property  name ="java.compile.fail"  value ="vv" />
         
< property  name ="enablecall"  value ="true" />
          
< ci_echo > 编译java代码 </ ci_echo >
          
< record  name ="${MAIN_DIR}/java.log"  action ="start" />
               
< copy  todir ="${MAIN_DIR}/classes" >
    
< fileset  dir ="${VOB_PATH}/SIMP1.0.1.0/OA_SRC" >
    
< include  name ="**/*.xml" />
    
</ fileset >
    
< fileset  dir ="${VOB_PATH}/SIMP1.0.1.0/PLT_BIZ_SRC" >
    
< include  name ="**/*.xml" />
                      
</ fileset >
               
</ copy >
               
< javac  failonerror ="false"  destdir ="${MAIN_DIR}/classes"  nowarn ="on"  encoding ="GBK" >
    
< classpath  refid ="simp_depend_lib_path" />
    
< src  refid ="simp_src_path" />
    
< include  name ="**/*.java" />
    
< exclude  name ="**/vssver.scc" />
               
</ javac >
               
< record  name ="${MAIN_DIR}/java.log"  action ="stop" />
    
</ target >
    
<!-- 编译jsp -->    
    
< target  name ="compilejsp"  unless ="java.error" >
    
< property  name ="enablecall"  value ="true" />
    
< ci_echo > 编译jsp代码 </ ci_echo >
    
< record  name ="${MAIN_DIR}/jsp.log"  action ="start" />
    
< java  classname ="weblogic.jspc"  fork ="true" >
    
< arg  line ="-webapp ${JSP_PATH}/admin -compileAll  -d ${MAIN_DIR}/jspc/admin -k *.jsp" />
    
< classpath  refid ="simp_depend_lib_path" />
    
< classpath >
        
< pathelement  path ="${MAIN_DIR}/classes" />
        
< pathelement  location ="../lib/tools.jar" />
    
</ classpath >
    
</ java >
    
< record  name ="${MAIN_DIR}/jsp.log"  action ="stop" />
    
</ target >
    
< target  name ="checkstyle" >
    
< checkstyle  config ="${CHECKSTYLEDIR}/sims_checks_eclipse.xml" >
        
< fileset  dir ="${VOB_PATH}/SIMP1.0.1.0"  includes ="**/*.java" />
        
< formatter  type ="xml"  toFile ="${CHECKSTYLEDIR}/report/report.xml" />
    
</ checkstyle >
    
< style  in ="${CHECKSTYLEDIR}/report/report.xml"  out ="${CHECKSTYLEDIR}/report/report.html"  style ="${CHECKSTYLEDIR}/contrib/checkstyle-frames.xsl" />
    
</ target >
    
<!-- 自定义ant任务 检查日志是否有错误,没有错误则发送编译成功邮件 -->    
    
< target  name ="mail" >
                      
< ci_echo > 开始发送Email. </ ci_echo >         
    
< property  name ="enablecall"  value ="true" />
    
< ci_simplemail  proj_name ="${PROJ_NAME}"  subject ="#USERNAME#,请检查代码"  mailhost ="${MAIL_HOST}"  user ="${USER}"  password ="${PASSWD}"  messagemimetype ="text/html"  javalog ="${JAVA_LOG}"  jsplog ="${JSP_LOG}"  junitlog ="${UNIT_LOG}" >
    
< from  address ="${SENDER}" />
    
< cc  address ="${CC_ADDR}" />
    
< fileset  dir ="${MAIN_DIR}" >
    
< include  name ="*.log" />
    
</ fileset >         
    
</ ci_simplemail >
    
</ target >
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值