码迷,mamicode.com
首页 > 其他好文 > 详细

你还在手动发布代码吗?累不?

时间:2014-08-15 13:03:39      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:des   os   io   for   ar   art   代码   amp   

1、Auto_Build_EAS.bat

@echo off 

@echo -------------------------
@echo Only change variables below
set MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5
set BuildType=Release
set WorkingSpace=D:\workingspace\projects\shgt_erp\trunk
set SourceDir=%WorkingSpace%\02-Sources
set SolutionDir=%SourceDir%\N-EAS
set SolutionPath=%SolutionDir%\NI.EAS.All.sln
set BinOutput=BinOutput

rem cd to the folder of this command
pushd %~dp0

@echo -------------------------
@echo Start to get latest and build NI.EAS.All solution

@echo Remove old log files
del logs\ /Q /S /F

@echo -------------------------
@echo Get Lastest for %WorkingSpace%
svn update %WorkingSpace%
@echo Get Lastest Finished
@echo -------------------------

@echo Clear BinOutput
del %SolutionDir%\%BinOutput%\ /Q /S /F
@echo Clear Binoutput Finished
@echo -------------------------

@echo Building Start

call %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log

@echo Building Finsihed
@echo -------------------------

find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txt

if exist logs\no_error.txt (goto succeed) else (goto failed)

:succeed

call Deploy.bat %SolutionDir%

call Deploy_Jobs.bat %SourceDir% %BuildType%

echo deploy succeed

pause
exit

:failed
echo deploy failed

pause
exit

----------------------------------------------------------------------------
2、Deploy.bat

set SolutionDir=%1

set DestDir=D:\EAS

set ServiceDir=%SolutionDir%\Service
set ServiceDestDir=%DestDir%\Service

set PortalDir=%SolutionDir%\Portal\NI.EAS.Presentation.Web
set PortalDestDir=%DestDir%\NI.EAS.Presentation.Web

set APIDir=%SolutionDir%\Portal\NI.EAS.Presentation.API
set APIDestDir=%DestDir%\NI.EAS.Presentation.API


@echo Backup the latest version
del bak\ /Q /S /F
xcopy %DestDir%\*.* bak\ /S /Y /exclude:skipFiles.txt


@echo Copy to destination

net stop w3svc

xcopy %ServiceDir%\*.* %ServiceDestDir%\ /S /D /Y /exclude:skipFiles.txt
xcopy %PortalDir%\*.* %PortalDestDir%\ /S /D /Y /exclude:skipFiles.txt
xcopy %APIDir%\*.* %APIDestDir%\ /S /D /Y /exclude:skipFiles.txt

net start w3svc
iisreset /restart

----------------------------------------------------------------------------
3、Auto_Build_Jobs.bat
@echo off 

@echo -------------------------
@echo Only change variables below
set MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5
set BuildType=Release
set WorkingSpace=D:\workingspace\projects\shgt_erp\trunk
set SourceDir=%WorkingSpace%\02-Sources
set SolutionDir=%SourceDir%\N-EAS
set SolutionPath=%SolutionDir%\NI.EAS.All.sln
set BinOutput=BinOutput

rem cd to the folder of this command
pushd %~dp0

@echo -------------------------
@echo Start to get latest and build NI.EAS.All solution

@echo Remove old log files
del logs\ /Q /S /F

@echo -------------------------
@echo Get Lastest for %WorkingSpace%
svn update %WorkingSpace%
@echo Get Lastest Finished
@echo -------------------------

@echo Clear BinOutput
del %SolutionDir%\%BinOutput%\ /Q /S /F
@echo Clear Binoutput Finished
@echo -------------------------

@echo Building Start

call %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log

@echo Building Finsihed
@echo -------------------------

find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txt

if exist logs\no_error.txt (goto succeed) else (goto failed)

:succeed
call Deploy_Jobs.bat %SourceDir% %BuildType%

echo compile succeed

pause
exit

:failed
echo compile failed

pause
exit

------------------------------------------------------------------------------
4.Deploy_Jobs.bat

set SourceDir=%1
set BuildType=%2

set FinancialJobDir=%SourceDir%\AutoInterfaceTask\InterfaceTask\TaskService\bin\%BuildType%
set ScheduleJobDir=%SourceDir%\N-EAS\Jobs\NI.EAS.Jobs\bin\%BuildType%

set FinancialJobDestDir=D:\ServiceRun\Debug
set ScheduleJobDestDir=D:\Scheduler\bin\Release


@echo Backup the latest version
del bak_jobs\ /Q /S /F
xcopy %FinancialJobDestDir%\*.* bak_jobs\ServiceRun\ /S /Y /exclude:skipFiles.txt
xcopy %ScheduleJobDestDir%\*.* bak_jobs\Scheduler\ /S /Y /exclude:skipFiles.txt

@echo Copy to destination

rem net stop Finance

rem xcopy %FinancialJobDir%\*.* %FinancialJobDestDir%\ /S /D /Y /exclude:skipFiles.txt

rem net start Finance


net stop ERPSchedluer

xcopy %ScheduleJobDir%\*.* %ScheduleJobDestDir%\ /S /D /Y /exclude:skipFiles.txt

net start ERPSchedluer


你还在手动发布代码吗?累不?,布布扣,bubuko.com

你还在手动发布代码吗?累不?

标签:des   os   io   for   ar   art   代码   amp   

原文地址:http://my.oschina.net/u/170703/blog/301463

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!