VCプロジェクトワンタッチコンパイルスクリプト

10475 ワード

VCソフトウェアをリリースする場合、コンパイルマシンにDirectoryパラメータ(libとincludeを含む)を構成する必要があります.
プロジェクトコンパイルスクリプトを実行すると、ターゲットファイルを生成できます.
build.batスクリプトは以下の通りです:(Android携帯電話とIOS携帯電話のプッシュメッセージを行うバックグラウンドサービスプログラムのコンパイルスクリプトです)
@rem      
@rem    mysql  ,openssl。
@rem  VC  “  ” 》include     mysql     ,openssl     ;
@rem                 》lib        mysql lib  , openssl lib  ;
@rem  ######################    
@if   not   exist   Release   md   Release
@set m_time=%time%

@set hh=%m_time:~0,2%
@if /i %hh% LSS 10 (set hh=0%time:~1,1%)

@set log=.\Release\%date:~0,4%%date:~5,2%%date:~8,2%%hh%%time:~3,2%%time:~6,2%_buildlog

@md  %log%
@set logpath=%log%\

@echo  on
@rem  #######################    
@set name=Notification4Android_dll_debug.log
msdev .\Notification4Android\Pushinfodll\pushinfo.dsw /make "pushinfo - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4Android_dll_release.log
msdev .\Notification4Android\Pushinfodll\pushinfo.dsw /make "pushinfo - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

@set name=Notification4Android_service_debug.log
msdev .\Notification4Android\pushservice\pushservice.dsw /make "pushservice - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4Android_service_release.log
msdev .\Notification4Android\pushservice\pushservice.dsw /make "pushservice - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

@set name=Notification4Android_monitor_release.log
msdev .\ServerMonitor\ServerMonitor.dsw /make "ServerMonitor - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%



XCOPY .\Notification4Android\pushservice\sysconfig.ini            				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\install_pushservice.bat   				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Uninstall_pushservice.bat 				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\start_pushservice.bat     				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\stop_pushservice.bat      				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\libmysql.dll              				.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\ReleaseMinDependency\pushservice.exe   .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.dll      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.pdb      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\ReleaseMinDependency\pushinfo.map      .\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\registerdll.bat      								.\release\4Android_release\  /h /d /q /y
XCOPY .\Notification4Android\Unregisterdll.bat      							.\release\4Android_release\  /h /d /q /y
@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe        		.\release\4Android_release\.  /h /d /q /y


XCOPY .\Notification4Android\pushservice\sysconfig.ini             .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\install_pushservice.bat   .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Uninstall_pushservice.bat .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\start_pushservice.bat     .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\stop_pushservice.bat      .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\libmysql.dll              .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\pushservice\Debug\pushservice.exe     .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.dll        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.pdb        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\Pushinfodll\Debug\pushinfo.map        .\release\4Android_debug\  /h /d /q /y
XCOPY .\Notification4Android\registerdll.bat      				   .\release\4Android_debug\.  /h /d /q /y
XCOPY .\Notification4Android\Unregisterdll.bat      			   .\release\4Android_debug\.  /h /d /q /y
@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe       .\release\4Android_debug\.  /h /d /q /y


@rem  XCOPY .\\stlport_vc646.dll .\release  /h /d /q /y


@set name=Notification4IOS_dll_debug.log
msdev .\Notification4IOS\NotificationDll\NotificationDll.dsw /make "NotificationDll - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_dll_release.log
msdev .\Notification4IOS\NotificationDll\NotificationDll.dsw /make "NotificationDll - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_service_debug.log
msdev .\Notification4IOS\NotificationService\NotificationService.dsw /make "NotificationService - Win32 Debug" /REBUILD /OUT %logpath%%name%
@set name=Notification4IOS_service_release.log
msdev .\Notification4IOS\NotificationService\NotificationService.dsw /make "NotificationService - Win32 Release MinDependency" /REBUILD /OUT %logpath%%name%

XCOPY .\Notification4IOS\NotificationService\sysconfig.ini                                     .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\install_Notificationservice.bat                   .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Uninstall_Notificationservice.bat                 .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\start_Notificationservice.bat                     .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\stop_Notificationservice.bat                      .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libmysql.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libeay32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libssl32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ssleay32.dll                                          .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\ReleaseMinDependency\NotificationService.exe      .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.dll              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.pdb              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ReleaseMinDependency\NotificationDll.map              .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\registerdll.bat                                     				   .\release\4IOS_release\  /h /d /q /y
XCOPY .\Notification4IOS\Unregisterdll.bat                   								   .\release\4IOS_release\  /h /d /q /y

@rem  XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe                              .\release\4IOS_release\  /h /d /q /y


XCOPY .\Notification4IOS\NotificationService\sysconfig.ini                     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\install_Notificationservice.bat   .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Uninstall_Notificationservice.bat .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\start_Notificationservice.bat     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\stop_Notificationservice.bat      .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libmysql.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libeay32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\libssl32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\ssleay32.dll                          .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationService\Debug\NotificationService.exe     .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.dll             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.pdb             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\NotificationDll\Debug\NotificationDll.map             .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\registerdll.bat                                       .\release\4IOS_debug\  /h /d /q /y
XCOPY .\Notification4IOS\Unregisterdll.bat                   				   .\release\4IOS_debug\  /h /d /q /y


XCOPY .\ServerMonitor\ReleaseMinDependency\ServerMonitor.exe    .\release\  /h /d /q /y
XCOPY .\ServerMonitor\install_monitor_service.bat				.\release\  /h /d /q /y
XCOPY .\ServerMonitor\start_monitor_server.bat					.\release\  /h /d /q /y
XCOPY .\ServerMonitor\stop_monitor_server.bat					.\release\  /h /d /q /y
XCOPY .\ServerMonitor\Uninstall_monitor_service.bat				.\release\  /h /d /q /y


@echo  build is completed
pause

もう1つの問題は、プロジェクトのバージョンをアップグレードし、バージョン番号を更新することです.
バージョン番号rcファイルでは、バージョン番号を直接置き換える簡単な方法があります.
#    ruby  
#
#  :jordan .sg 2012-8-31
#require "stringio"


File.open("./Notification4Android/Pushinfodll/pushinfo.rc", "r") do |rcfile|  # Open file out.txt for writing
 str=rcfile.read
 str.gsub!('1,0,0,4','1,0,0,5')
 str.gsub!('1, 0, 0, 4','1, 0, 0, 5')
 rcfile.close
 File.open("./pushinfo.rc", "w") do |rcfile|
  rcfile.write(str) 
  rcfile.flush
  rcfile.close
 end
end


File.open("./Notification4IOS/NotificationDll/NotificationDll.rc", "r") do |rcfile|  # Open file out.txt for writing
 str=rcfile.read
 str.gsub!('1,0,0,0','1,0,0,1')
 str.gsub!('1, 0, 0, 0','1, 0, 0, 1')
 rcfile.close
 File.open("./pushinfo.rc", "w") do |rcfile|
  rcfile.write(str) 
  rcfile.flush
  rcfile.close
 end
end