forked from RatScanner/RatScanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.bat
63 lines (53 loc) · 1.76 KB
/
publish.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
@echo off
setlocal enabledelayedexpansion
:: Check if static icon data is present
echo Checking if static icon data is present...
set isPresent=T
if not exist RatScanner\Data\correlation.json set isPresent=F
if not exist RatScanner\Data\name\ set isPresent=F
if "%isPresent%"=="F" (
echo Static icon data missing^^!
echo Did you copy it to the Data folder when cloning the repository?
exit /b
)
:: Remove old publish folder
echo Removing old publish folder...
rmdir /s /q publish
:: Publish the solution
echo Publishing the solution...
dotnet publish -c Release -o publish --runtime win-x64 --self-contained false
:: Copy data folder to publish directory
echo Copying data folder to publish directory...
xcopy "RatScanner\Data\*" "publish\Data\" /y /e /s /q
:: Delete unused pdb
echo Deleting unused pdb...
del publish\OpenCvSharpExtern.pdb
:: Delete reference to pdb
echo Deleting reference to pdb...
set /A REMOVE_COUNT=2
set "SEARCH_STR=OpenCvSharpExtern.pdb"
set "SRC_FILE=publish\RatScanner.deps.json"
set /A SKIP_COUNT=0
for /F "skip=2 delims=[] tokens=1,*" %%I in ('find /v /n "" "%SRC_FILE%"') do (
if !SKIP_COUNT! EQU 0 (
set SRC_LINE=%%J
if defined SRC_LINE (
if "!SRC_LINE:%SEARCH_STR%=!" == "!SRC_LINE!" (
echo.!SRC_LINE! >> publish\RatScanner.deps.json.tmp
) else (
set /A SKIP_COUNT=%REMOVE_COUNT%
)
) else (
rem SRC_LINE is empty
echo. >> publish\RatScanner.deps.json.tmp
)
) else (
set /A SKIP_COUNT-=1
)
)
del publish\RatScanner.deps.json
rename publish\RatScanner.deps.json.tmp RatScanner.deps.json
:: Finalize publish
echo Done^^!
echo Run the published version to make sure there were no errors while publishing^^!
pause