Using Ant auto-hit Delta packages based on Eclipse SVN Changelog

Source: Internet
Author: User

1. Get Changelog

View the history with ECLIPSESVN plugin features.

  

Export the log file to a local file Svn_change.log, in the following format

  

 r63 | xiaodaoshi | 2014-08-08 18:01:36 cstchanged paths:m /root/testproject/ Ant_demo/demo/src/com/csdn/common/util/stringutil.java M /root/testproject/ Ant_demo/demo/src/com/csdn/service/first.java A /root/testproject/ant_demo/ Demo/src/com/csdn/service/second.java M /root/testproject/ant_demo/demo/src /com/csdn/service/third.java M /root/testproject/ant_demo/demo/webapps/demo /welcome/welcome.jsp M /root/testproject/ant_demo/demo/webapps/demo/images/ welcome.png  <description> testing </description> xds9527 ------------------------------------------------------------------- ---------

2, the Ant script is written, the basic principle is to read ChangeLog.txt, first filter will be commented, the author: Wait for the unwanted information to be filtered out. Import to the new file Patch.log. This file is read from the regular expression to handle the inefficient directory, replacing it with the real compiled classes directory. Replace. Java with the *.class suffix. * is for wildcard characters. Matches the inner class. How to copy files to a new directory according to the file. In accordance with this packaging. It basically completes the function.

Invalid information filtered file contents

webapps/demo/web-inf/classes/com/csdn/common/util/stringutil*. class WebApps/demo/web-inf/classes/com/csdn/service/first*. class WebApps/demo/web-inf/classes/com/csdn/service/second*. class WebApps/demo/web-inf/classes/com/csdn/service/third*. class WebApps/demo/welcome/welcome.jspwebapps/demo/images/welcome.png

The following is the complete ant script

<?XML version= "1.0" encoding= "UTF-8"?><Projectname= "Project"default= "Patch_without_compile">    <!--TLBADX Project -    < Propertyname= "Project.name"value= "Demo" />    <Tstamp><format Property= "Date.today"pattern= "YyyyMMdd" /></Tstamp>    <!--SVN submits change log -    < Propertyname= "Change.log"value= "./changelog.txt" />    <!--directory where the patch package resides -    < Propertyname= "Build.dir"value= "./release" />    <!--read the SVN log to extract new and modified files to get the files contained in the patch pack -    < Propertyname= "Patch.includesfile"value= "${build.dir}/patchfiles.txt" />    <!--Patch Package Name -    < Propertyname= "Dest.zip"value= "${project.name}_${date.today}_patch.zip" />    <!----------- target: From the SVN log, remove the checkin file- -------- -    <Targetname= "Patchfile"depends= "Init"Description= "Process Svn_changge Log">        <!--Remove comments from the SVN log, leaving only added and modified records -        <concatDestFile= "${patch.includesfile}"Append= "false" Force= "true">            <Filesetfile= "${change.log}" />            <Filterchain>                <Containsregexbyline= "true"pattern= "^ ([\s]+) (?: a| M) ([\s]+) (. +) $ "Replace= "\3" />            </Filterchain>        </concat>        <!--Replace the SRC directory with the classes directory primarily for submitted code -        <Replaceregexpfile= "${patch.includesfile}"byline= "true">            <!--(?: x) x extracts the relative path of code as a group concept for non-capturing groups equivalent to Java -            <RegExppattern= "^/.+/(?: SRC)/(. +) \. +$" />            <substitutionexpression= "Webapps/toolbar/web-inf/classes/\1*.class" />        </Replaceregexp>        <!--replace the path in front of webroot/mainly for submitting. js. css and other picture page files -        <Replaceregexpfile= "${patch.includesfile}"byline= "true">            <!--(? =x) read from the front of the sentence if the X front is empty directly. Perform a replace operation that is not previously empty -            <RegExppattern= "^/.+/(? =webapps/)" />            <substitutionexpression="" />        </Replaceregexp>    </Target>    <!------------ Target:package- -------- -    <Targetname= "Package"Description= "Patch Pack">        <Deletedir= "${build.dir}/webapps" />        <CopyTodir= "${build.dir}"Overwrite= "true">            <Filesetdir="."Includesfile= "${patch.includesfile}" />        </Copy>        <Deletefile= "${build.dir}/${dest.zip}" />        <ZipDestFile= "${build.dir}/${dest.zip}"Compress= "true">            <Zipfilesetprefix= "WebApps"dir= "${build.dir}/webapps">                <includename="**" />            </Zipfileset>        </Zip>    </Target>    <!------------ target:release without compile- --------- -    <Targetname= "Patch_without_compile"depends= "Patchfile, package"Description= "--Release">        <Echo>Package End of Patch Pack</Echo>    </Target>        <!----------- -target:init- -------- -    <Targetname= "Init"depends= "clean">        <mkdirdir= "${build.dir}"/>    </Target>    <!----------- -target:clean- -------- -    <Targetname= "clean">        <Deletedir= "${build.dir}" />    </Target>    </Project>

In this case get version changeLog.txt, execute the ant script. A patch package will be generated in the release directory.

Using Ant auto-hit Delta packages based on Eclipse SVN Changelog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.