mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 04:33:04 +01:00
[build.bat] Determine ILRepack folder name dynamically
& improve general consistency and clarity.
This commit is contained in:
parent
c5138d9cd6
commit
ae4dbaee42
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@
|
|||||||
bin/
|
bin/
|
||||||
obj/
|
obj/
|
||||||
SubtitleEdit-*-setup.exe
|
SubtitleEdit-*-setup.exe
|
||||||
|
SubtitleEdit-*.zip
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
167
build.bat
167
build.bat
@ -3,15 +3,16 @@ SETLOCAL
|
|||||||
|
|
||||||
CD /D %~dp0
|
CD /D %~dp0
|
||||||
|
|
||||||
rem Check for the help switches
|
REM Check for the help switches
|
||||||
IF /I "%~1" == "help" GOTO SHOWHELP
|
IF /I "%~1" == "help" GOTO ShowHelp
|
||||||
IF /I "%~1" == "/help" GOTO SHOWHELP
|
IF /I "%~1" == "/help" GOTO ShowHelp
|
||||||
IF /I "%~1" == "-help" GOTO SHOWHELP
|
IF /I "%~1" == "-help" GOTO ShowHelp
|
||||||
IF /I "%~1" == "--help" GOTO SHOWHELP
|
IF /I "%~1" == "--help" GOTO ShowHelp
|
||||||
IF /I "%~1" == "/?" GOTO SHOWHELP
|
IF /I "%~1" == "/?" GOTO ShowHelp
|
||||||
|
IF /I "%~1" == "-?" GOTO ShowHelp
|
||||||
|
|
||||||
for /f "usebackq tokens=1* delims=: " %%i in (`vswhere -latest -requires Microsoft.Component.MSBuild`) do (
|
FOR /F "usebackq tokens=1* delims=: " %%A IN (`vswhere -latest -requires Microsoft.Component.MSBuild`) DO (
|
||||||
if /i "%%i"=="installationPath" set InstallDir=%%j
|
IF /I "%%A" == "installationPath" SET "VSINSTALLDIR=%%B"
|
||||||
)
|
)
|
||||||
|
|
||||||
IF "%~1" == "" (
|
IF "%~1" == "" (
|
||||||
@ -30,39 +31,42 @@ IF "%~1" == "" (
|
|||||||
IF /I "%~1" == "-Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
IF /I "%~1" == "-Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
||||||
IF /I "%~1" == "--Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
IF /I "%~1" == "--Rebuild" SET "BUILDTYPE=Rebuild" & GOTO START
|
||||||
|
|
||||||
ECHO. & ECHO Unsupported commandline switch!
|
ECHO.
|
||||||
|
ECHO Unsupported commandline switch!
|
||||||
GOTO EndWithError
|
GOTO EndWithError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
:START
|
:START
|
||||||
|
TITLE %BUILDTYPE%ing Subtitle Edit - Release^|Any CPU...
|
||||||
|
ECHO.
|
||||||
|
ECHO %BUILDTYPE%ing Subtitle Edit - Release^|Any CPU...
|
||||||
|
DEL /F /Q SubtitleEdit-*-Setup.exe SubtitleEdit-*.zip 2>NUL
|
||||||
PUSHD "src"
|
PUSHD "src"
|
||||||
|
ECHO.
|
||||||
TITLE %BUILDTYPE%ing SubtitleEdit - Release^|Any CPU...
|
ECHO Visual Studio installation path: "%VSINSTALLDIR%"
|
||||||
ECHO %InstallDir%
|
IF EXIST "%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe" (
|
||||||
IF exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
|
SET "MSBUILD=%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe"
|
||||||
"%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="Any CPU"^
|
|
||||||
/maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal
|
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
|
||||||
) ELSE (
|
) ELSE (
|
||||||
IF exist "%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" (
|
IF EXIST "%VSINSTALLDIR%\MSBuild\Current\Bin\MSBuild.exe" (
|
||||||
"%InstallDir%\MSBuild\Current\Bin\MSBuild.exe" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="Any CPU"^
|
SET "MSBUILD=%VSINSTALLDIR%\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
/maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal
|
) ELSE (
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
ECHO Cannot find Visual Studio 2017.
|
||||||
) else (
|
|
||||||
ECHO Cannot find Visual Studio 2017
|
|
||||||
GOTO EndWithError
|
GOTO EndWithError
|
||||||
)
|
))
|
||||||
|
"%MSBUILD%" SubtitleEdit.sln /t:%BUILDTYPE% /p:Configuration=Release /p:Platform="Any CPU"^
|
||||||
|
/maxcpucount /consoleloggerparameters:DisableMPLogging;Summary;Verbosity=minimal
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
||||||
|
|
||||||
)
|
IF /I "%BUILDTYPE%" == "Clean" GOTO EndSuccessful
|
||||||
|
|
||||||
IF /I "%BUILDTYPE%" == "Clean" GOTO END
|
|
||||||
|
|
||||||
ECHO.
|
ECHO.
|
||||||
ECHO ILRepack...
|
ECHO Merging assemblies with ILRepack...
|
||||||
"packages\ILRepack.2.0.16\tools\ILRepack.exe" /parallel /internalize /targetplatform:v4 /out:"bin\Release\SubtitleEdit.exe" "bin\Release\SubtitleEdit.exe" "bin\Release\libse.dll" "bin\Release\zlib.net.dll" "bin\Release\NHunspell.dll" "DLLs\Interop.QuartzTypeLib.dll"
|
FOR /D %%A IN (packages\ILRepack.*) DO (SET "ILREPACKDIR=%%A")
|
||||||
ECHO.
|
|
||||||
ECHO.
|
ECHO.
|
||||||
|
"%ILREPACKDIR%\tools\ILRepack.exe" /parallel /internalize /targetplatform:v4 /out:"bin\Release\SubtitleEdit.exe" "bin\Release\SubtitleEdit.exe"^
|
||||||
|
"bin\Release\libse.dll" "bin\Release\zlib.net.dll" "bin\Release\NHunspell.dll" "DLLs\Interop.QuartzTypeLib.dll"
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
||||||
POPD
|
POPD
|
||||||
|
|
||||||
CALL :SubDetectSevenzipPath
|
CALL :SubDetectSevenzipPath
|
||||||
@ -72,19 +76,47 @@ IF DEFINED SEVENZIP IF EXIST "%SEVENZIP%" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
CALL :SubDetectInnoSetup
|
CALL :SubDetectInnoSetup
|
||||||
IF DEFINED InnoSetupPath (
|
IF DEFINED INNOSETUP IF EXIST "%INNOSETUP%" (
|
||||||
TITLE Compiling installer...
|
TITLE Compiling installer with Inno Setup...
|
||||||
"%InnoSetupPath%" /O"." /Q "installer\Subtitle_Edit_installer.iss"
|
ECHO.
|
||||||
|
ECHO Compiling installer with Inno Setup...
|
||||||
|
"%INNOSETUP%" /O"." /Q "installer\Subtitle_Edit_installer.iss"
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
||||||
|
|
||||||
ECHO. & ECHO Installer compiled successfully!
|
ECHO.
|
||||||
|
ECHO Installer compiled successfully!
|
||||||
) ELSE (
|
) ELSE (
|
||||||
ECHO Inno Setup wasn't found; the installer wasn't built
|
ECHO Inno Setup wasn't found; the installer wasn't built.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
:EndSuccessful
|
||||||
|
TITLE %BUILDTYPE%ing Subtitle Edit finished!
|
||||||
|
GOTO END
|
||||||
|
|
||||||
|
|
||||||
|
:EndWithError
|
||||||
|
TITLE Compiling Subtitle Edit [ERROR]
|
||||||
|
ECHO.
|
||||||
|
ECHO.
|
||||||
|
ECHO ** ERROR: Build failed and aborted! **
|
||||||
|
GOTO END
|
||||||
|
|
||||||
|
|
||||||
|
:ShowHelp
|
||||||
|
TITLE %~nx0 %1
|
||||||
|
ECHO.
|
||||||
|
ECHO.
|
||||||
|
ECHO Usage: %~nx0 [Clean^|Build^|Rebuild]
|
||||||
|
ECHO.
|
||||||
|
ECHO Notes: You can also prefix the commands with "-", "--" or "/".
|
||||||
|
ECHO The arguments are not case sensitive.
|
||||||
|
ECHO.
|
||||||
|
ECHO Executing %~nx0 without any arguments is equivalent to "%~nx0 build".
|
||||||
|
|
||||||
|
|
||||||
:END
|
:END
|
||||||
TITLE Compiling Subtitle Edit finished!
|
ECHO.
|
||||||
ECHO.
|
ECHO.
|
||||||
ENDLOCAL
|
ENDLOCAL
|
||||||
PAUSE
|
PAUSE
|
||||||
@ -92,31 +124,33 @@ EXIT /B
|
|||||||
|
|
||||||
|
|
||||||
:SubZipFile
|
:SubZipFile
|
||||||
TITLE Creating the ZIP file...
|
TITLE Creating ZIP archive with 7-Zip...
|
||||||
ECHO. & ECHO Creating the ZIP file...
|
ECHO.
|
||||||
|
ECHO Creating ZIP archive with 7-Zip...
|
||||||
PUSHD "src\bin\Release"
|
PUSHD "src\bin\Release"
|
||||||
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
||||||
IF NOT EXIST "temp_zip" MD "temp_zip"
|
IF NOT EXIST "temp_zip" MD "temp_zip"
|
||||||
IF NOT EXIST "temp_zip\Languages" MD "temp_zip\Languages"
|
IF NOT EXIST "temp_zip\Languages" MD "temp_zip\Languages"
|
||||||
IF NOT EXIST "temp_zip\Dictionaries" MD "temp_zip\Dictionaries"
|
IF NOT EXIST "temp_zip\Dictionaries" MD "temp_zip\Dictionaries"
|
||||||
IF NOT EXIST "temp_zip\Ocr" MD "temp_zip\Ocr"
|
IF NOT EXIST "temp_zip\Ocr" MD "temp_zip\Ocr"
|
||||||
|
|
||||||
COPY /Y /V "..\..\..\LICENSE.txt" "temp_zip\"
|
ECHO.
|
||||||
COPY /Y /V "..\..\..\Changelog.txt" "temp_zip\"
|
COPY /Y /V "..\..\..\LICENSE.txt" "temp_zip\"
|
||||||
COPY /Y /V "Hunspellx86.dll" "temp_zip\"
|
COPY /Y /V "..\..\..\Changelog.txt" "temp_zip\"
|
||||||
COPY /Y /V "Hunspellx64.dll" "temp_zip\"
|
COPY /Y /V "Hunspellx86.dll" "temp_zip\"
|
||||||
COPY /Y /V "SubtitleEdit.exe" "temp_zip\"
|
COPY /Y /V "Hunspellx64.dll" "temp_zip\"
|
||||||
COPY /Y /V "Languages\*.xml" "temp_zip\Languages\"
|
COPY /Y /V "SubtitleEdit.exe" "temp_zip\"
|
||||||
COPY /Y /V "..\..\..\Dictionaries\*.*" "temp_zip\Dictionaries\"
|
COPY /Y /V "Languages\*.xml" "temp_zip\Languages\"
|
||||||
COPY /Y /V "..\..\..\Ocr\*.*" "temp_zip\Ocr\"
|
COPY /Y /V "..\..\..\Dictionaries\*.*" "temp_zip\Dictionaries\"
|
||||||
|
COPY /Y /V "..\..\..\Ocr\*.*" "temp_zip\Ocr\"
|
||||||
|
|
||||||
PUSHD "temp_zip"
|
PUSHD "temp_zip"
|
||||||
START "" /B /WAIT "%SEVENZIP%" a -tzip -mx=9 "SE%VERSION%.zip" * >NUL
|
START "" /B /WAIT "%SEVENZIP%" a -tzip -mx=9 "SubtitleEdit-%VERSION%.zip" * >NUL
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
IF %ERRORLEVEL% NEQ 0 GOTO EndWithError
|
||||||
|
|
||||||
|
ECHO.
|
||||||
ECHO. & ECHO ZIP file created successfully!
|
ECHO ZIP archive created successfully!
|
||||||
MOVE /Y "SE%VERSION%.zip" "..\..\..\.." >NUL
|
MOVE /Y "SubtitleEdit-%VERSION%.zip" "..\..\..\.." >NUL
|
||||||
POPD
|
POPD
|
||||||
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
IF EXIST "temp_zip" RD /S /Q "temp_zip"
|
||||||
POPD
|
POPD
|
||||||
@ -124,29 +158,6 @@ POPD
|
|||||||
EXIT /B
|
EXIT /B
|
||||||
|
|
||||||
|
|
||||||
:EndWithError
|
|
||||||
Title Compiling Subtitle Edit [ERROR]
|
|
||||||
ECHO. & ECHO.
|
|
||||||
ECHO **ERROR: Build failed and aborted!**
|
|
||||||
PAUSE
|
|
||||||
ENDLOCAL
|
|
||||||
EXIT
|
|
||||||
|
|
||||||
|
|
||||||
:SHOWHELP
|
|
||||||
TITLE %~nx0 %1
|
|
||||||
ECHO. & ECHO.
|
|
||||||
ECHO Usage: %~nx0 [Clean^|Build^|Rebuild]
|
|
||||||
ECHO.
|
|
||||||
ECHO Notes: You can also prefix the commands with "-", "--" or "/".
|
|
||||||
ECHO The arguments are not case sensitive.
|
|
||||||
ECHO. & ECHO.
|
|
||||||
ECHO Executing %~nx0 without any arguments is equivalent to "%~nx0 build"
|
|
||||||
ECHO.
|
|
||||||
ENDLOCAL
|
|
||||||
EXIT /B
|
|
||||||
|
|
||||||
|
|
||||||
:SubGetVersion
|
:SubGetVersion
|
||||||
FOR /F delims^=^"^ tokens^=2 %%A IN ('FINDSTR /R /C:"AssemblyVersion" "src\Properties\AssemblyInfo.cs.template"') DO (
|
FOR /F delims^=^"^ tokens^=2 %%A IN ('FINDSTR /R /C:"AssemblyVersion" "src\Properties\AssemblyInfo.cs.template"') DO (
|
||||||
rem 3.4.1.[REVNO]
|
rem 3.4.1.[REVNO]
|
||||||
@ -173,5 +184,5 @@ EXIT /B
|
|||||||
:SubDetectInnoSetup
|
:SubDetectInnoSetup
|
||||||
FOR /F "tokens=5*" %%A IN (
|
FOR /F "tokens=5*" %%A IN (
|
||||||
'REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ" ^|^|
|
'REG QUERY "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ" ^|^|
|
||||||
REG QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "InnoSetupPath=%%B\ISCC.exe"
|
REG QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1" /v "Inno Setup: App Path" 2^>NUL ^| FIND "REG_SZ"') DO SET "INNOSETUP=%%B\ISCC.exe"
|
||||||
EXIT /B
|
EXIT /B
|
||||||
|
Loading…
Reference in New Issue
Block a user