-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildAndPackageForMarketplace.bat
140 lines (102 loc) · 3.68 KB
/
BuildAndPackageForMarketplace.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@echo off
setlocal
set ROOT_PATH=%~dp0
pushd %ROOT_PATH%
echo Plugins\UnityVersionControl\UnityVersionControl.uplugin:
type Plugins\UnityVersionControl\UnityVersionControl.uplugin
echo .
REM Read the plugin version from uplugin file and prompt the user to check, and name zip files from the version
if [%1] == [] (
set /p VERSION="Enter the version name exactly as in the UnityVersionControl.uplugin above: "
) else (
set VERSION=%1
)
if [%VERSION%] == [] (
echo Version is empty
exit /b 1
)
REM TODO: double check with the uplugin and also search in the README
REM Let's also check we are on main
echo on
git branch
@echo off
REM Ask the user if they agree to do a git clean & a git reset! Else we abort the process.
set /p GIT_CLEAN_RESET="WARNING: Git clean & reset before building. You will lose any local changes you have! (ENTER/N)? "
if [%GIT_CLEAN_RESET%] == [] (
echo on
git stash --message "Automatic stash from BuildAndPackageForRelease %VERSION%"
git clean -fdx
git reset --hard
pushd Plugins\UnityVersionControl
git stash --message "Automatic stash from BuildAndPackageForRelease %VERSION%"
git clean -fdx
git reset --hard
popd
@echo off
) else (
echo Git clean is required, exiting.
exit /b
)
REM
REM #####################
REM
REM The Unreal Engine Marketplace only allow to submit new version for the last 3 Unreal versions
call :BuildAndPackage 5.3
call :BuildAndPackage 5.4
REM NOTE: Unreal 5.5 requires C++20 if not compiling with Unity Builds, we have to edit "UE5PlasticPluginDevEditor.Target.cs" manually before continuing!
REM set /p PAUSE="WARNING: you have to edit Source\UE5PlasticPluginDevEditor.Target.cs and uncomment CppStandard = CppStandardVersion.Cpp20; before compiling for UE5.5 (ENTER)"
call :BuildAndPackage 5.5
REM
REM Done
REM
echo .
echo NOTE: After validation, add the source package to the corresponding github release and post to the Marketplace the links to these
exit /b %ERRORLEVEL%
REM
REM ################# BuildAndPackage Function
REM
:BuildAndPackage
set UNREAL_ENGINE=%~1
call :ReplaceEngineVersion 5.0.0 %UNREAL_ENGINE%.0
REM Let's ensure that the plugin correctly builds
del /Q Plugins\UnityVersionControl\Binaries\Win64\*
call Build.bat %UNREAL_ENGINE%
if NOT exist Plugins\UnityVersionControl\Binaries\Win64\UnrealEditor-UnityVersionControl.dll (
echo Something is wrong, some binaries are missing.
exit /b 1
)
REM Create the archive for the Marketplace from within the Plugins subfolder for a cleaner ZIP
cd Plugins
set ARCHIVE_NAME_REL=UE%UNREAL_ENGINE%_UnityVersionControl-%VERSION%.zip
echo on
del ..\%ARCHIVE_NAME_REL%
..\Tools\7-Zip\x64\7za.exe a -tzip ..\%ARCHIVE_NAME_REL% UnityVersionControl -xr!Binaries -xr!Intermediate -xr!Screenshots -xr!.editorconfig -xr!".git*" -xr!"cm.log.conf" -xr!_config.yml -xr!README.md -xr!"*.pdb"
@echo off
cd ..
call :ReplaceEngineVersion %UNREAL_ENGINE%.0 5.0.0
echo Done for Unreal Engine %UNREAL_ENGINE%
echo .
exit /b %ERRORLEVEL%
REM
REM ################# ReplaceEngineVersion Function
REM
:ReplaceEngineVersion
set OLD_VERSION=%~1
set NEW_VERSION=%~2
set UPLUGIN=Plugins\UnityVersionControl\UnityVersionControl.uplugin
if [%OLD_VERSION%] == [%NEW_VERSION%] (
exit /b
)
echo Replace "EngineVersion": "%OLD_VERSION%" by "%NEW_VERSION%" in %UPLUGIN%
setlocal enableextensions disabledelayedexpansion
for /f "delims=" %%i in ('type "%UPLUGIN%" ^& break ^> "%UPLUGIN%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%UPLUGIN%" echo(!line:%OLD_VERSION%=%NEW_VERSION%!
endlocal
)
endlocal
exit /b %ERRORLEVEL%
REM
REM #################
REM