Skip to content

Commit

Permalink
chore: naming and fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Jul 23, 2024
1 parent 32e7e05 commit 14e4b5a
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ set rime_build_variant=release
set build_weasel=0
set build_installer=0
set build_arm64=0
set build_test_cast=0
set build_appcast=0

rem parse the command line options
:parse_cmdline_options
Expand All @@ -93,7 +93,7 @@ rem parse the command line options
if "%1" == "weasel" set build_weasel=1
if "%1" == "installer" set build_installer=1
if "%1" == "arm64" set build_arm64=1
if "%1" == "testing_cast" set build_test_cast=1
if "%1" == "appcast" set build_appcast=1
if "%1" == "all" (
set build_boost=1
set build_data=1
Expand All @@ -107,8 +107,8 @@ rem parse the command line options
goto parse_cmdline_options
:end_parsing_cmdline_options

if %build_test_cast% == 1 (
call :build_test_cast_xml
if %build_appcast% == 1 (
call :build_appcast_xml
exit /b
)

Expand Down Expand Up @@ -363,18 +363,18 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path

exit /b

:build_test_cast_xml
:build_appcast_xml
echo generating testing/weasel/appcast.xml
if not exist testing\weasel (mkdir testing\weasel)
copy update\testing-appcast.xml testing\weasel\appcast.xml > nul
if exist update_cast.ps1 del update_cast.ps1 > nul
echo $content = Get-Content -Path ^
.\testing\weasel\appcast.xml -Raw -Encoding UTF8 > update_cast.ps1
rem set url for nightly build or public release, by %RELEASE_BUILD%
rem set url for nightly build or public release, by %RELEASE_BUILD%
echo $short_pat = "\d+\.\d+\.\d+" >> update_cast.ps1
echo $long_pat = "\d+\.\d+\.\d+\.\d+" >> update_cast.ps1
if not defined RELEASE_BUILD (
echo $newcontent = $content -replace "(?<=download/)$short_pat(?=/weasel-)", ^
if not defined RELEASE_BUILD (
echo $newcontent = $content -replace "(?<=download/)$short_pat(?=/weasel-)", ^
"latest" >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=weasel-)$long_pat(?=-installer.exe)", ^
"$env:PRODUCT_VERSION" >> update_cast.ps1
Expand All @@ -385,26 +385,26 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path
echo $newcontent = $newcontent -replace ^
"(?<=<sparkle:releaseNotesLink>)(http.*html)(?=</sparkle:releaseNotesLink>)", ^
"https://github.com/rime/weasel/releases/tag/latest" >> update_cast.ps1
) else (
echo $newcontent = $content -replace "(?<=download/)$short_pat(?=/weasel-)", ^
) else (
echo $newcontent = $content -replace "(?<=download/)$short_pat(?=/weasel-)", ^
"$env:WEASEL_VERSION" >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=weasel-)$long_pat(?=-installer.exe)", ^
"$env:PRODUCT_VERSION" >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=<title>\S+\s+)$short_pat(?=</title>)", ^
"$env:WEASEL_VERSION" >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=sparkle:version=.)$short_pat", ^
"$env:WEASEL_VERSION" >> update_cast.ps1
)
rem save current set
echo $originalCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture >> update_cast.ps1
echo $originalUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentCulture = 'en-US' >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US' >> update_cast.ps1
echo $dateString = Get-Date -Format "ddd, dd MMM yyyy HH:mm:ss K" >> update_cast.ps1
rem recover current set
echo [System.Threading.Thread]::CurrentThread.CurrentCulture = $originalCulture >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentUICulture = $originalUICulture >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=<pubDate>).*(?=</pubDate>)", "$dateString" >> update_cast.ps1
)
rem save current set
echo $originalCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture >> update_cast.ps1
echo $originalUICulture = [System.Threading.Thread]::CurrentThread.CurrentUICulture >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentCulture = 'en-US' >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentUICulture = 'en-US' >> update_cast.ps1
echo $dateString = Get-Date -Format "ddd, dd MMM yyyy HH:mm:ss K" >> update_cast.ps1
rem recover current set
echo [System.Threading.Thread]::CurrentThread.CurrentCulture = $originalCulture >> update_cast.ps1
echo [System.Threading.Thread]::CurrentThread.CurrentUICulture = $originalUICulture >> update_cast.ps1
echo $newcontent = $newcontent -replace "(?<=<pubDate>).*(?=</pubDate>)", "$dateString" >> update_cast.ps1
echo $newcontent ^| Set-Content -Path testing\weasel\appcast.xml -Encoding UTF8 >> update_cast.ps1
powershell.exe -ExecutionPolicy Bypass .\update_cast.ps1
if errorlevel 1 exit /b 1
Expand Down

0 comments on commit 14e4b5a

Please sign in to comment.