forked from ColorCop/ColorCop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.cmd
More file actions
executable file
·57 lines (45 loc) · 1.47 KB
/
build.cmd
File metadata and controls
executable file
·57 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
@echo off
setlocal enabledelayedexpansion
REM ================================
REM GET VERSION FROM GIT TAG
REM ================================
for /f %%v in ('git describe --tags --abbrev^=0') do set VERSION=%%v
echo Building version %VERSION%
REM Convert x.y.z or x.y.z.w → x,y,z,w
for /f "tokens=1-4 delims=." %%a in ("%VERSION%") do (
set MAJOR=%%a
set MINOR=%%b
set PATCH=%%c
set BUILD=%%d
)
if "%BUILD%"=="" set BUILD=0
set VERSION_NUMERIC=%MAJOR%,%MINOR%,%PATCH%,%BUILD%
echo Numeric version: %VERSION_NUMERIC%
REM ================================
REM LOCATE MSBUILD
REM ================================
for /f "tokens=2,*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath 2^>nul') do (
set MSBUILDPATH=%%b
)
if not exist "%MSBUILDPATH%msbuild.exe" (
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe"`) do (
set MSBUILDPATH=%%i
)
)
if not exist "%MSBUILDPATH%" (
echo ERROR: MSBuild not found.
exit /b 1
)
echo Using MSBuild: %MSBUILDPATH%
REM ================================
REM BUILD
REM ================================
"%MSBUILDPATH%" ColorCop.sln ^
/t:Rebuild ^
/p:Configuration=Release ^
/p:Platform=Win32 ^
/p:ProductVersion=%VERSION% ^
/p:FileVersion=%VERSION% ^
/p:NumericVersion=%VERSION_NUMERIC% ^
/m
exit /b %errorlevel%