-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.cmd
71 lines (54 loc) · 2.49 KB
/
build.cmd
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
set "root_dir=%~dp0\"
set "build_dir=%root_dir%build\"
mkdir %build_dir%
xcopy "README.MD" %build_dir% /Y
xcopy LICENSE %build_dir% /Y
mkdir %root_dir%server\\examples\\lsys-actix-web\data
cd %root_dir%server\\examples\\lsys-actix-web
cargo version
rustc -V
cargo update
cargo build -r -vvv
cd %root_dir%server && call sql_merge.cmd
mkdir %build_dir%assets
xcopy %root_dir%server\\tables.sql %build_dir%assets\\ /Y
xcopy %root_dir%server\\target\\release\\lsys-actix-web.exe %build_dir% /Y
xcopy /E /I /Y %root_dir%server\\examples\\lsys-actix-web\\config %build_dir%config
xcopy /E /I /Y %root_dir%server\\examples\\lsys-actix-web\\data %build_dir%data
xcopy /E /I /Y %root_dir%server\\examples\\lsys-actix-web\\locale %build_dir%locale
xcopy /E /I /Y %root_dir%server\\examples\\lsys-actix-web\\static %build_dir%static
xcopy %root_dir%server\\examples\\lsys-actix-web\\.env %build_dir% /Y
mkdir %build_dir%logs
mkdir %root_dir%ui\\public
cd %root_dir%ui
call npm install
call npm run build
cd %root_dir%
xcopy /E /I /Y %root_dir%ui\\public %build_dir%ui
powershell.exe -Command "(Get-Content -Path '%build_dir%config\\app.toml') | ForEach-Object { $_ -replace '../../../ui/public/', './ui/' } | Set-Content -Path '%build_dir%config\\app.toml'"
set has_assets=false
set has_tar=false
:loop
if "%1"=="" goto endloop
if "%1"=="assets" (
set has_assets=true
)
if "%1"=="zip" (
set has_tar=true
)
shift
goto loop
:endloop
if "%has_assets%"=="true" (
powershell -Command "Invoke-WebRequest -Uri 'https://github.com/shanliu/lsys/releases/download/v0.0.0/2023-7-area-code.csv.gz' -OutFile '%build_dir%data\2023-7-area-code.csv.gz'"
powershell -Command "Invoke-WebRequest -Uri 'https://github.com/shanliu/lsys/releases/download/v0.0.0/2023-7-area-geo.csv.gz' -OutFile '%build_dir%data\2023-7-area-geo.csv.gz'"
powershell -Command "Invoke-WebRequest -Uri 'https://github.com/shanliu/lsys/releases/download/v0.0.0/IP2LOCATION-LITE-DB11.BIN.zip' -OutFile '%build_dir%data\IP2LOCATION-LITE-DB11.BIN.zip'"
powershell -Command "Expand-Archive -Path '%build_dir%data\IP2LOCATION-LITE-DB11.BIN.zip' -DestinationPath '%build_dir%data'"
del %build_dir%data\IP2LOCATION-LITE-DB11.BIN.zip
)
if "%has_tar%"=="true" (
powershell.exe -Command "Compress-Archive -Path '%build_dir%' -DestinationPath '%build_dir%..\\lsys-for-windows.zip'"
)
cd %root_dir%
echo off
echo "The compilation was successful, please enable the service with ( cd build && .\lsys-actix-web ) to the service and access it via http://127.0.0.1:8080"