-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.bat
122 lines (88 loc) · 3.17 KB
/
build.bat
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@echo off
setlocal
cd /d %~dp0
:: check argument
set ARCH=%1
set TARGET="%2"
set VERSION=%3
if "%ARCH%" == "" (
echo usage: build.bat $arch $target $version
echo example: build.bat x64 Release 1.0.0
goto :error_exit
)
if "%TARGET%" == "" (
echo usage: build.bat $arch $target $version
echo example: build.bat x64 Release 1.0.0
goto :error_exit
)
if "%VERSION%" == "" (
echo usage: build.bat $arch $target $version
echo example: build.bat x64 Release 1.0.0
goto :error_exit
)
if not "%ARCH%" == "x64" (
if not "%ARCH%" == "x86" (
echo arch must be x64 or x86
goto :error_exit
)
)
set PF32=%ProgramFiles(x86)%
if not exist "%PF32%" set PF32=%ProgramFiles%
set VS_WHERE_PATH="%PF32%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist ""%VS_WHERE_PATH%"" (
echo vswhere not found
goto :error_exit
)
for /f "usebackq tokens=*" %%i in (`%VS_WHERE_PATH% -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
if exist "%%i" (
set MSBUILD=%%i
goto :msb_found
)
)
goto :error_exit
:error_exit
exit 1
:success_exit
exit 0
:msb_found
echo MSBuild Found : %MSBUILD%
echo ******************************************************************************************************
echo Build blender-injection for %2 (%ARCH%)
echo ******************************************************************************************************
"%MSBUILD%" /p:Configuration=%2 /p:Platform=%1 /t:Rebuild src/dll/blender-injection.vcxproj
echo ******************************************************************************************************
echo Build blender-extension for %2 (%ARCH%)
echo ******************************************************************************************************
mkdir bin
del bin\drag-and-drop-support.zip
echo D | xcopy /e src/blender-extension bin/drag-and-drop-support/
echo ******************************************************************************************************
echo Collect Artifacts
echo ******************************************************************************************************
for /f "tokens=2 delims=: " %%i in (%2) do (
set VERSION=%%i.%3
)
set DEST="bin\%1\DragAndDropSupport-v%VERSION%"
echo Y | rmdir /s "%DEST%"
mkdir "%DEST%"
echo F | xcopy /s "src\dll\%1\"%2"\*.dll" "%DEST%\drag-and-drop-support\"
echo F | xcopy /s "src\addon\*" "%DEST%\drag-and-drop-support\"
echo F | xcopy "src\LICENSE.txt" "%DEST%\"
pwsh -Command compress-archive "%DEST%\drag-and-drop-support" "%DEST%\drag-and-drop-support.zip"
echo Y | rmdir /s "%DEST%\drag-and-drop-support"
echo ******************************************************************************************************
echo Packaging Artifact
echo ******************************************************************************************************
if exist "%DEST%.zip" (
del "%DEST%.zip"
)
pwsh -Command compress-archive %DEST% %DEST%.zip
set HASH=
for /F "usebackq skip=1 delims==" %%i in (`certutil -hashfile %DEST%.zip SHA256`) do (
if not defined HASH (
set HASH=%%i
)
)
echo %HASH% > "%DEST%.zip.sha256"
echo "packaged -> %DEST%.zip"
echo "hash -> %HASH%"