Daily build (3)

Source: Internet
Author: User

The previous two daily builds are simple to write. Here we will make some improvements based on the previous ones to make it easier to manage and configure.

Daily build Improvement 1: Share build files.

 

During daily building, I use Nant for copying files. The core part of Nant is build files. Generally, a large website has multiple solutions, such as hotel projects and air ticket projects. Therefore, different deployment rules apply to different solutions. Website deployment is often not in place. Different website versions will be generated as business needs change. However, the build files used by Nant should be the same. here we need to share the build files in different versions.

Solution: Nant build files support external attributes. First paste a Build File: first look at the copy node. It requires two important parameters: the source folder directory, the destination folder directory. If there are too many copy nodes in the build file, we need to write a lot of paths. Here we can define a property node in the build file, which is equivalent to the property in C. On the one hand, this attribute can be used in the Copy command to replace the actual path, on the other hand, to dynamically give the attribute value when the build file is called externally.

 

Code

<? XML version = " 1.0 " Encoding = " Gb2312 "   ?>
< Project name = " Deploy "   Default = " Run " >
< Property name = " Basename " Value = " Website " />
< Property name = " Debug " Value = " True " />
< Property name = " Base. dir " Value = " Http://www.cnblogs.com/./#1 /src "   />
< Property name = " Deploy. dir " Value = " Http://www.cnblogs.com/../deploy/web "   />
< Property name = " Fxcop. dir " Value = " Http://www.cnblogs.com/../deploy "   />  
< Target name = " Clean " >
</ Target >
< Target name = " Deploy " Depends = " Clean " >  

  < Copy todir = " $ {Deploy. dir}/New/member " >
< Fileset basedir = " $ {Base. dir}/member/ " >
< Include name = " **/*. Js "   />  
</ Fileset >
  </ Copy >  
</ Target >
< Target name = " Run " Depends = " Fxcop " >
</ Target >
< Target name = " Fxcop " Depends = " Deploy " >
</ Target >  
</ Project >

 

 

How SVN and Nant work together:Code. And IArticleThe difference is that the buildargs parameter is added to connect the property content to be overwritten through "-d. Multiple Attributes are separated by spaces. When building a project on a daily basis in version 2, you only need to modify the ccnet project configuration. The original build file does not need to be changed.

 

Code

< Nant >
< Executable > C: \ min. Jiang \ bin \ nant.exe </ Executable >
< Basedirectory > C: \ min. Jiang \ proj \ el_online_v36_11.02_1215 </ Basedirectory >
< Nologo > False </ Nologo >
< Buildfile > C: \ min. Jiang \ bin \ deployscripts \ hotels \ Default . Build </ Buildfile >
< Targetlist >
< Target > Run </ Target >
</ Targetlist >
< Buildargs >- D: deploy. dir = C: \ min. Jiang \ deploy \ version 1 \ package \ Web -

D:Base. Dir=C: \ min. Jiang \ proj \ version 1 \ SRC</Buildargs>
<Buildtimeoutseconds>1200</Buildtimeoutseconds>
</Nant>

 

 

Daily build Improvement 2: The deployment package is automatically submitted to SVN.

 

After the ccnet deployment package is generated, it will be stored on the ccnet server. If other colleagues want to obtain the deployment package, they can only log on to the server or obtain it from the shared folder. Now that SVN is available, we can put the generated deployment into SVN. The modified deploy. bat is as follows:

Shift
If exist "C: \ min. Jiang \ deploy \ % 0 \ package \ web_auto.rar" del/f c: \ min. Jiang \ deploy \ % 0

\ Package \ web_auto.rar

Note: Check whether a deployment package exists in the local deployment file directory. If yes, delete the package first.

"C: \ Program Files \ WinRAR \ rar.exe" a-r-EP1-ed-TA % 1 c: \ min. Jiang \ deploy \ % 0

\ Package \ web_auto.rar-Ad c: \ min. Jiang \ deploy \ % 0 \ package \ Web

Note: Incremental compression is implemented by time (the compressed package only contains files modified after the specified time ).

If not exist "C: \ min. Jiang \ deploy \ % 0 \ web_auto.rar" SVN checkout http: // SVN/path/web3.5/% 0/

"C: \ min. Jiang \ deploy \ % 0" -- username AAA -- password aaa

NOTE: If no package is deployed in the svn deployment directory, download the package from SVN first.

If exist "C: \ min. Jiang \ deploy \ % 0 \ web_auto.rar" SVN revert "C: \ min. Jiang \ deploy \ % 0 \ web_auto.rar"

Note: ensure that the local version and SVN version are the same.

Xcopy c: \ min. Jiang \ deploy \ % 0 \ package \ web_auto.rar c: \ min. Jiang \ deploy \ % 0 \/y

Note: copy the local deployment package to the svn deployment directory.

SVN commit-M "update new package" C: \ min. Jiang \ deploy \ % 0 \ web_auto.rar

Note: submit the final deployment package.

 

Commit, and then submit SVN. After I call SVN add c: \ min. Jiang \ deploy \ % 0 \ web_auto.rar and execute SVN commit, the system will prompt that the file is not under SVN control. Please advise if you have any reason.

 

Daily build IMPROVEMENT 3: Set the ccnet website.

By default, after ccnet is installed, a virtual directory is generated under the default website. To facilitate access, we can create a site. For example, the host header is defined as a website.

 

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.