`
vickcy
  • 浏览: 31424 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

自动打包发布的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>
 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics