-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
upload-debug-symbols-win.bat
161 lines (136 loc) · 4.64 KB
/
upload-debug-symbols-win.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
@echo off
setlocal enabledelayedexpansion
set TargetPlatform=%1
set TargetName=%2
set TargetType=%3
set TargetConfig=%4
set ProjectPath=%5
set PluginPath=%6
set ProjectBinariesPath=%ProjectPath:"=%\Binaries\%TargetPlatform%
set PluginBinariesPath=%PluginPath:"=%\Source\ThirdParty\%TargetPlatform%
set ConfigPath=%ProjectPath:"=%\Config
echo Sentry: Start debug symbols upload
if "%TargetType%"=="Editor" (
echo Sentry: Automatic symbols upload is not required for Editor target. Skipping...
exit
)
if "%TargetPlatform%"=="Win64" (
set CliExec=%PluginPath:"=%\Source\ThirdParty\CLI\sentry-cli-Windows-x86_64.exe
) else if "%TargetPlatform%"=="Linux" (
set CliExec=%PluginPath:"=%\Source\ThirdParty\CLI\sentry-cli-Windows-x86_64.exe
) else if "%TargetPlatform%"=="Android" (
echo Warning: Sentry: Debug symbols upload for Android is handled by Sentry's gradle plugin if enabled
exit
) else (
echo Warning: Sentry: Unexpected platform %TargetPlatform%. Skipping...
exit
)
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings UploadSymbolsAutomatically UploadSymbols
if /i "%UploadSymbols%" NEQ "True" (
echo Sentry: Automatic symbols upload is disabled in plugin settings. Skipping...
exit
)
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings IncludeSources IncludeSourceFiles
set CliArgs=
if /i "%IncludeSourceFiles%"=="True" (
set "CliArgs=--include-sources"
)
set CliLogLevel=
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings DiagnosticLevel CliLogLevel
if "%CliLogLevel%"=="" (
set "CliLogLevel=info"
)
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings EnableBuildPlatforms EnabledPlatforms
if not "%EnabledPlatforms%"=="" (
set PlatformToCheck=
if "%TargetPlatform%"=="Win64" (
set "PlatformToCheck=bEnableWindows=False"
) else (
set "PlatformToCheck=bEnable%TargetPlatform%=False"
)
call :FindString EnabledPlatforms PlatformToCheck IsPlatformDisabled
if "!IsPlatformDisabled!"=="true" (
echo "Sentry: Automatic symbols upload is disabled for build platform %TargetPlatform%. Skipping..."
exit
)
)
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings EnableBuildTargets EnabledTargets
if not "%EnabledTargets%"=="" (
set TargetToCheck="bEnable%TargetType%=False"
call :FindString EnabledTargets TargetToCheck IsTargetDisabled
if "!IsTargetDisabled!"=="true" (
echo "Sentry: Automatic symbols upload is disabled for build target type %TargetType%. Skipping..."
exit
)
)
call :ParseIniFile "%ConfigPath%\DefaultEngine.ini" /Script/Sentry.SentrySettings EnableBuildConfigurations EnabledConfigurations
if not "%EnabledConfigurations%"=="" (
set ConfigToCheck="bEnable%TargetConfig%=False"
call :FindString EnabledConfigurations ConfigToCheck IsConfigDisabled
if "!IsConfigDisabled!"=="true" (
echo "Sentry: Automatic symbols upload is disabled for build configuration %TargetConfig%. Skipping..."
exit
)
)
set PropertiesFile=%ProjectPath:"=%\sentry.properties
if not exist "%PropertiesFile%" (
echo Warning: Sentry: Properties file is missing: '%PropertiesFile%'
exit
)
if not exist "%CliExec%" (
echo Warning: Sentry: Sentry CLI is not configured in plugin settings. Skipping...
exit
)
echo Sentry: Upload started using PropertiesFile '%PropertiesFile%'
set "SENTRY_PROPERTIES=%PropertiesFile%"
echo %ProjectBinariesPath%
echo %PluginBinariesPath%
call "%CliExec%" upload-dif %CliArgs% --log-level %CliLogLevel% "%ProjectBinariesPath%" "%PluginBinariesPath%"
echo Sentry: Upload finished
endlocal
exit
:FindString <sourceStr> <findStr> <result>
setlocal
for /f "delims=" %%A in ('echo %%%1%%') do set str1=%%A
for /f "delims=" %%A in ('echo %%%2%%') do set str2=%%A
echo.%str1%|findstr /C:"%str2%" >nul 2>&1
endlocal
if not errorlevel 1 (
set %~3=true
) else (
set %~3=false
)
goto :eof
:ParseIniFile <filename> <section> <key> <result>
set %~4=
setlocal
set insection=
for /f "usebackq eol=; tokens=*" %%a in ("%~1") do (
set line=%%a
if defined insection (
for /f "tokens=1,* delims==" %%b in ("!line!") do (
if /i "%%b"=="%3" (
endlocal
set %~4=%%c
set insection=
goto :eof
)
)
)
if "!line:~0,1!"=="[" (
for /f "delims=[]" %%b in ("!line!") do (
if /i "%%b"=="%2" (
set insection=1
) else (
endlocal
if defined insection (
set insection=
goto :eof
)
)
)
)
)
endlocal
set insection=
goto :eof