自动打包发布的ANT小脚本

<project name="CheckStyleCustom" default="distribute" basedir=".">
    <target name="init">
        <property name="destFile" value="checkstyle"/>
        <property name="pluginName" value="com.atlassw.tools.eclipse.checkstyle_4.4.2"/>    	
        <property name="pluginFile" value="${pluginName}-bin.zip"/>  
    	<property name="coreJar" value="checkstyle-all-4.4"/>
        <property name="jarFile" value="checkstyle_custom.jar"/>
        <property name="encoding" value="utf-8"></property>
    	<property name="eclipseHome" value="C:\_zyf\eclipse"></property>
        <tstamp>
            <format property="TODAY" pattern="yyyyMMdd"/>
        </tstamp>
    </target>
    <target name="distribute">
    	<antcall target="prepare"></antcall>
    	<antcall target="package"></antcall>
    	<antcall target="clean"></antcall>
    </target>
	
	<target name="prepare" depends="init">
        <delete file="dist/${destFile}_${TODAY}.zip"/>
        <unzip src="plugin/${pluginFile}"
               dest="temp"
        />
		
		<!-- Chinese Version Start-->
		<unjar src="lib/${coreJar}.jar" dest="temp/${coreJar}">
		</unjar>
		<copy todir="temp/${coreJar}">
			<fileset dir="chineseProperties"
				excludes="**/*.txt"
			/>
		</copy>
		<jar jarfile="temp/${coreJar}.jar">
			<fileset dir="temp/${coreJar}"/>
		</jar>
		<copy file="temp/${coreJar}.jar" 
			todir="temp/plugins/${pluginName}/lib"/>
		<delete dir="temp/${coreJar}"></delete>
		<delete file="temp/${coreJar}.jar"></delete>
		<!-- Chinese Version End-->
		
        <jar jarfile="${jarFile}">
            <fileset dir="bin" 
                     includes="**"
                     excludes="**/*Test.class"
            />
        </jar>
        <copy file="${jarFile}" 
              todir="temp/plugins/${pluginName}/extension-libraries"
        />
        <copy file="checkstyle_plugin.xml"
              tofile="temp/plugins/${pluginName}/plugin.xml"
        />
        <copy file="checkstyle.xml"
              tofile="temp/plugins/${pluginName}/custom_checks.xml" encoding="utf-8">
        	<filterset begintoken="$${" endtoken="}">
        		<filter token="encoding" value="${encoding}"/>
        	</filterset>
        </copy>
        <copy file="header.txt"
              todir="temp/plugins/${pluginName}"
        />      
	</target>
	<target name="package" depends="init">
        <zip destfile="dist/${destFile}_${TODAY}.zip"
             basedir="temp"
        />
	</target>
	<target name="clean" depends="init">
        <!--<delete dir="temp"/>-->
        <mkdir dir="temp"/>
        <delete file="${jarFile}"/>
	</target>
	<target name="install" depends="init">
		<unzip src="dist/${destFile}_${TODAY}.zip" 
			   dest="temp" 
		/>
		<copy file="temp/features" 
			  todir="${eclipseHome}" 
		/>
		<copy file="temp/plugins" 
			  todir="${eclipseHome}" 
		/>
		<delete dir="temp"/>
		<mkdir dir="temp"/>
	</target>
</project>
 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值