Windows程式打包指令碼[bat]

來源:互聯網
上載者:User

標籤:nes   名稱   編譯   命名   nsis   格式   git   version   完整   

打包指令碼的流程和自動打包基本相同:

1. 編譯軟體

2. 拷貝需要的內容

3. 程式碼簽署

4. 打包成安裝檔案

5. 再次簽名,並將安裝檔案名稱改成需要的格式

------------------------------------------------------------------

編譯軟體需要初始化vs的運行環境,如

call "D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"

然後開編譯。

編譯完成,拷貝檔案,使用signtool對軟體進行簽名,

signtool sign /f codesign.cer ..\bin\app\Joywok.exe

最後將其修改為需要的命名風格,這裡使用了 git rev-list HEAD --count 來擷取git的提交次數作為build version

rem 修改軟體名稱for /f "delims=" %%i in (‘git rev-list HEAD --count‘) do (set "buildversion=%%i")echo %buildversion%cd setupset year=%date:~0,4%set month=%date:~5,2%set day=%date:~8,2%set ymd=%year%%month%%day%-b%buildversion%ren setup.exe joywok-aws-setup-%ymd%.exe

 

---------------------------------------------------------------------------

完整的樣本:

@echo offcall "D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\vcvars32.bat"rmdir /s/q ..\src\buildlibmkdir ..\src\buildlibcd ..\src\buildlibqmake ..\JWLib_qt\JWLib_qt.pro -spec win32-msvc2013 "CONFIG-=debug" "CONFIG+=release force_debug_info" "DEFINES+=JW_AWS"D:\Qt\qtcreator-4.2.1\bin\jom qmake_allnmake -f Makefile.Releasermdir /s/q ..\buildjoymkdir ..\buildjoycd ..\buildjoyqmake ..\joywok_qt\joywok_qt.pro -spec win32-msvc2013 "CONFIG-=debug" "CONFIG+=release force_debug_info" "DEFINES+=JW_AWS"D:\Qt\qtcreator-4.2.1\bin\jom qmake_allnmake -f Makefile.Releaserem 拷貝檔案並打包cd ..\..\setupdel ..\bin\app\YWdatabase.dbrmdir /s/q ..\bin\app\cachermdir /s/q ..\bin\app\logrmdir /s/q ..\bin\app\skinrmdir /s/q ..\bin\app\qmlmkdir ..\bin\app\skinmkdir ..\bin\app\qmlxcopy ..\bin\QDebug\skin\* ..\bin\app\skin /excopy ..\bin\QDebug\qml\* ..\bin\app\qml /ecopy ..\lib\Release\JWLib_qt.dll ..\bin\appcopy ..\bin\Release\Joywok.exe ..\bin\apprmdir /s/q ..\bin\app\crashesset year=%date:~0,4%set month=%date:~5,2%set day=%date:~8,2%set hour=%time:~0,2%set minute=%time:~3,2%set second=%time:~6,2%set ymd=%year%%month%%day%_%hour%%minute%%second%cd ..\crashlogmd "%ymd%"copy /y ..\lib\Release\jwlib_qt.pdb "%ymd%"copy /y ..\bin\Release\joywok.pdb "%ymd%"copy /y ..\lib\Release\JWLib_qt.dll "%ymd%"copy /y ..\bin\Release\Joywok.exe "%ymd%"cd ..\setuprem 簽名signtool sign /f codesign.cer ..\bin\app\JWLib_qt.dllsigntool sign /f codesign.cer ..\bin\app\Joywok.exerem 打包del app.7zdel setup.exe..\software\7-Zip\7z.exe a -t7z app.7z ..\bin\app\*..\software\NSIS\makensis.exe setup.nsisigntool sign /f codesign.cer setup.exerem 修改軟體名稱cd ..for /f "delims=" %%i in (‘git rev-list HEAD --count‘) do (set "buildversion=%%i")echo %buildversion%cd setupset year=%date:~0,4%set month=%date:~5,2%set day=%date:~8,2%set ymd=%year%%month%%day%-b%buildversion%ren setup.exe joywok-aws-setup-%ymd%.exepause

 

Windows程式打包指令碼[bat]

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.