• 构建C#项目build.xml


    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Sample build file used to retrieve svnant's sources -->
    <!-- project name="svn-test" basedir="." default="checkoutThis" -->
      <project name="memberautobuild" default="member" basedir="./http://www.cnblogs.com/../">
        <tstamp>
           <format property="TODAY" pattern="yyyyMMdd" locale="en"/>
        </tstamp>
      
      <!--  all properties are in build.properties --> 
      <!--<property file="build.properties"/> -->
    <property name="ant.dir" value="E:\ant\bin" />
      <property name="svnant.version" value="1.0.3" />
      <!--属性设置 -->
    	<property name="buildversion" value="xxx"/>
    	<property name="work.dir" value="xxx" />
    	<property name="src.dir" value="${work.dir}"/>
    	<property name="publish.dir" value="${basedir}\${buildversion}"/>
    	<property name="build.dir" value="${work.dir}"/>
    	<property name="devenv.dir" value="E:\xxx\Microsoft Visual Studio 10.0\Common7\IDE"/>
    	<property name="publishfile" value="${buildversion}_${TODAY}.zip" />
    	<property name="svn.url" value="xxxx"/>
       
      <!-- path to the svnant libraries. Usually they will be located in ANT_HOME/lib -->
      <path id="project.classpath" >
        <pathelement location="${ant.dir}/lib/svnjavahl.jar"/>
        <pathelement location="${ant.dir}/lib/svnClientAdapter.jar"/>
        <pathelement location="${ant.dir}/lib/svnant.jar"/>
      </path>  
      
      <!-- load the svn task -->
      <taskdef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="project.classpath"/>
      
      <taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask">
        <classpath refid="project.classpath"/>
    	</taskdef>
     
     <!--Check out最新代码 -->
      <target name="checkout" >
      	<mkdir dir="src_member"/>
        <svn svnkit="true" username="xxx" password="xxx">
          <checkout url="${svn.url}" revision="HEAD" destPath="src_member" />
        </svn>
      </target>   
      	
    	<!--提交构建版本至构svn库 -->
    	<target name="submit">
    		<echo message="submit the project to svn  ##########################################################################################################"/>
    	 	<svn svnkit="true" username="xxx" password="xxx" >
    			<import path="${build.dir}\${publishfile}" url="${svn.url}/02执行程序/${publishfile}" message="import ${build.version}" />
    		</svn>
    	</target>
    	
    	<!--更新工作目录 -->
    	<target name="update">
    		<echo message="update the source code"/>
    	 	<svn svnkit="true" username="xxx" password="xxx" >
    			<update dir="${work.dir}">
    			</update>
    		</svn>
    	</target>
    	
    	<!-- 提交代码 -->
    	<target name="commit">
    		<echo message="commit the zip file to svn"/>
    	 <svn svnkit="true" username="xxx" password="xxx" >
    			<commit dir="${build.dir}" message="commit">
    			</commit>
    		</svn>
    	</target>
    	
    	<!--删除SVN对应文件 -->
    	<target name="delete">
    	   <echo message="delete file from svn"/>
    	 <svn svnkit="true" username="xxx" password="xxx" >
    			<delete url="${svn.url}/02执行程序/${publishfile}" message="delete">
    			</delete>
    		</svn>
    	</target>
    	
    	<target name="version" >
    		<echo message="${svnant.version}" />
    	</target>
    
    	
    	
    	<!--构建过程 -->
    	<echo message="Start auto building #########################################################################################################"/>
    	<target name="xxx" depends="update,compile-member,publish,submit"/>
    	<!--<target name="xxx" depends="submit"/>-->
    	
    	<!--清除相关目录 -->
    	<target name="clean"> 
        <delete dir="src_member"/>  
    		<echo>Deleteing: ${publish.dir}</echo>
    		<delete dir="${publish.dir}"/>
    		<echo>Making: ${publish.dir}</echo>
    		<mkdir dir="${publish.dir}"/>
    	</target>
    	
    	<!--编译项目程序 -->
    	<target name="compile-member">
    		<exec executable="${devenv.dir}\devenv.com">
    			<arg value="${src.dir}\ClientMgr\ClientMgr.Speical\ClientMgr.Speical.csproj"/>
    			<arg value="/build"/>
    		</exec>				
    	</target>
    
    	<target name="publish">
    		<echo message="Publish the project ##########################################################################################################"/>
    	<!--复制文件交互应用前台可执行程序到发布目录 -->
    		<copy todir="${publish.dir}/02运行程序/01前台">
    			<fileset dir="${src.dir}/CAFX">
    			   <exclude name="*.svn"/>
    			   <exclude name="*.con"/>
    			   <exclude name="*.log"/>
    			</fileset>
    		</copy>
    		
    		<zip destfile="${publish.dir}/02运行程序/01前台/${publishfile}"
    				 basedir="${publish.dir}/02运行程序/01前台"
    				 excludes="**/*.scc,**/*.lib,**/*.exp,**/*.ilk"	/>
    	  <copy file="${publish.dir}/02运行程序/01前台/${publishfile}" todir="${build.dir}" />	
    	  <delete dir="${publish.dir}/02运行程序/01前台"/>
    	</target> 
    	
    </project>
    

      

  • 相关阅读:
    《JAVA设计模式》中的代理模式Proxy
    《JAVA设计模式》中的外观模式Facade
    《JAVA设计模式》中的组合模式Composite
    《JAVA设计模式》中的享元模式Flyweight
    《JAVA设计模式》中的策略模式Strategy
    《JAVA设计模式》中的模板模式Template
    《JAVA设计模式》中的观察者模式Observer
    《JAVA设计模式》中的迭代器模式Iterator
    《JAVA设计模式》中的责任链模式Chain of Responsibility
    面对对象编程
  • 原文地址:https://www.cnblogs.com/victorcai0922/p/2880536.html
Copyright © 2020-2023  润新知