From 60c5455c57996e5fb8d9602e31579f6ed24627e6 Mon Sep 17 00:00:00 2001 From: fxliang Date: Thu, 18 Jul 2024 14:24:23 +0800 Subject: [PATCH 01/35] refactor: don't use std::async when processing void IPC commands --- WeaselIPC/WeaselClientImpl.cpp | 41 +++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/WeaselIPC/WeaselClientImpl.cpp b/WeaselIPC/WeaselClientImpl.cpp index 2a5d90597..031bba640 100644 --- a/WeaselIPC/WeaselClientImpl.cpp +++ b/WeaselIPC/WeaselClientImpl.cpp @@ -197,18 +197,37 @@ LRESULT ClientImpl::_SendMessage(WEASEL_IPC_COMMAND Msg, DWORD lParam) { try { PipeMessage req{Msg, wParam, lParam}; - auto future = std::async(std::launch::async, - [this, &req]() { return channel.Transact(req); }); - - // wait Transact complete or overtime - if (future.wait_for(std::chrono::seconds(2)) == - std::future_status::timeout) { - // Transact overtime - return 0; - } else { - // Transact complete - return future.get(); + LRESULT ret = 0; + switch (Msg) { + case WEASEL_IPC_SHUTDOWN_SERVER: + case WEASEL_IPC_START_SESSION: + case WEASEL_IPC_END_SESSION: + case WEASEL_IPC_START_MAINTENANCE: + case WEASEL_IPC_END_MAINTENANCE: + case WEASEL_IPC_UPDATE_INPUT_POS: + case WEASEL_IPC_FOCUS_IN: + case WEASEL_IPC_FOCUS_OUT: + case WEASEL_IPC_TRAY_COMMAND: { + ret = channel.Transact(req); + break; + } + default: { + auto future = std::async(std::launch::async, [this, &req]() { + return channel.Transact(req); + }); + // wait Transact complete or overtime + if (future.wait_for(std::chrono::seconds(2)) == + std::future_status::timeout) { + // Transact overtime + ret = 0; + } else { + // Transact complete + ret = future.get(); + } + break; + } } + return ret; } catch (DWORD /* ex */) { return 0; } From a6c3e993c2e3717ffbb97219c1e507d69f32002d Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 22 Jul 2024 17:30:00 +0800 Subject: [PATCH 02/35] build: always re-generate PRODUCT_VERSION --- build.bat | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/build.bat b/build.bat index 9766e9f72..e0b87d05a 100644 --- a/build.bat +++ b/build.bat @@ -15,17 +15,15 @@ if not defined VERSION_PATCH set VERSION_PATCH=1 if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% if not defined WEASEL_BUILD set WEASEL_BUILD=0 -if not defined PRODUCT_VERSION ( - rem use numeric build version for release build - set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% - rem for non-release build, try to use git commit hash as product build version - if not defined RELEASE_BUILD ( - rem check if git is installed and available, then get the short commit id of head - git --version >nul 2>&1 - if not errorlevel 1 ( - rem get short commmit id of head - for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%-%%i) - ) +rem use numeric build version for release build +set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% +rem for non-release build, try to use git commit hash as product build version +if not defined RELEASE_BUILD ( + rem check if git is installed and available, then get the short commit id of head + git --version >nul 2>&1 + if not errorlevel 1 ( + rem get short commmit id of head + for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%-%%i) ) ) From 4196d35ce58cb74aa29d523599df75ff63024742 Mon Sep 17 00:00:00 2001 From: fxliang Date: Fri, 19 Jul 2024 12:39:29 +0800 Subject: [PATCH 03/35] feat: add testing update channel --- WeaselServer/WeaselServer.rc | Bin 21798 -> 22800 bytes WeaselServer/WeaselServerApp.h | 6 ++++++ WeaselSetup/WeaselSetup.cpp | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/WeaselServer/WeaselServer.rc b/WeaselServer/WeaselServer.rc index bfc74ed91f7e81b80fea7cbb7ed006411580b96f..1234e97d6cfec60f29bb30dc67e09ec01d498431 100644 GIT binary patch delta 116 zcmZ3sigCgw#tj0zydey(48aT`44w>r4DOTlx#jtJ8MqjnfTHeTF@?#o+_NV$ahXjv k;7I|}LX$UeWuWO2=XPhrs&2BE+M>w Date: Mon, 22 Jul 2024 17:30:30 +0800 Subject: [PATCH 04/35] ci: generate testing\weasel\appcast.xml and add deploy job-steps --- .github/workflows/release-ci.yml | 13 ++++++- build.bat | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 81c7c3af0..fd5a67e91 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -104,4 +104,15 @@ jobs: ./output/archives/weasel*.exe ./output/archives/debug_symbols.7z body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md - + + - name: Generate testing/weasel/appcast.xml + run: | + .\build.bat testing_cast + + - name: Deploy testing/weasel/appcast.xml to rime.github.io + uses: peaceiris/actions-gh-pages@v4 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + external_repository: rime/rime.github.io + publish_dir: ./testing/weasel/ + keep_files: true diff --git a/build.bat b/build.bat index e0b87d05a..b3dd0e3f8 100644 --- a/build.bat +++ b/build.bat @@ -69,6 +69,7 @@ set rime_build_variant=release set build_weasel=0 set build_installer=0 set build_arm64=0 +set build_test_cast=0 rem parse the command line options :parse_cmdline_options @@ -92,6 +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" == "all" ( set build_boost=1 set build_data=1 @@ -105,6 +107,11 @@ rem parse the command line options goto parse_cmdline_options :end_parsing_cmdline_options +if %build_test_cast% == 1 ( + call :build_test_cast_xml + exit /b +) + if %build_weasel% == 0 ( if %build_boost% == 0 ( if %build_data% == 0 ( @@ -355,6 +362,57 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path if errorlevel 1 goto error exit /b + +:build_test_cast_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% + 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-)", ^ + "latest" >> update_cast.ps1 + echo $newcontent = $newcontent -replace "(?<=weasel-)$long_pat(?=-installer.exe)", ^ + "$env:PRODUCT_VERSION" >> update_cast.ps1 + echo $newcontent = $newcontent -replace "(?<=\S+\s+)$short_pat(?=)", ^ + "$env:PRODUCT_VERSION" >> update_cast.ps1 + echo $newcontent = $newcontent -replace "(?<=sparkle:version=.)$short_pat", ^ + "$env:PRODUCT_VERSION" >> update_cast.ps1 + echo $newcontent = $newcontent -replace ^ + "(?<=)(http.*html)(?=)", ^ + "https://github.com/rime/weasel/releases/tag/latest" >> update_cast.ps1 + ) 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 "(?<=\S+\s+)$short_pat(?=)", ^ + "$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 "(?<=).*(?=)", "$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 + del update_cast.ps1 + if errorlevel 1 exit /b 1 + echo generated testing/weasel/appcast.xml + exit /b + rem --------------------------------------------------------------------------- :error From 14e4b5aa5cb5e772156309d0e780ae4f2726c777 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 22 Jul 2024 22:07:34 +0800 Subject: [PATCH 05/35] chore: naming and fix indent --- build.bat | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/build.bat b/build.bat index b3dd0e3f8..62be47f85 100644 --- a/build.bat +++ b/build.bat @@ -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 @@ -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 @@ -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 ) @@ -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 @@ -385,8 +385,8 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path echo $newcontent = $newcontent -replace ^ "(?<=)(http.*html)(?=)", ^ "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 @@ -394,17 +394,17 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path "$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 "(?<=).*(?=)", "$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 "(?<=).*(?=)", "$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 From 372bcb4f48f9f86a6b187af4a49f0d4c50d24973 Mon Sep 17 00:00:00 2001 From: fxliang Date: Tue, 23 Jul 2024 23:05:20 +0800 Subject: [PATCH 06/35] fix ci generate appcast --- .github/workflows/release-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index fd5a67e91..986fd116a 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -107,7 +107,7 @@ jobs: - name: Generate testing/weasel/appcast.xml run: | - .\build.bat testing_cast + .\build.bat appcast - name: Deploy testing/weasel/appcast.xml to rime.github.io uses: peaceiris/actions-gh-pages@v4 From 8609578d263803b62e77483f1b00b98eb6316766 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 12:01:41 +0800 Subject: [PATCH 07/35] ci: add job to deploy testing appcast --- .github/workflows/release-ci.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 986fd116a..a71ca2cf2 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -109,7 +109,22 @@ jobs: run: | .\build.bat appcast - - name: Deploy testing/weasel/appcast.xml to rime.github.io + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + if-no-files-found: error + path: testing\weasel\appcast.xml + + update_appcast: + permissions: + contents: write + runs-on: ubuntu-latest + needs: [build-and-release] + steps: + - name: Download artifacts + uses: actions/download-artifacts@v4 + + - name: Deploy appcast uses: peaceiris/actions-gh-pages@v4 with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} From 37413f0a770bc7953d330188667aa2827b2820ba Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 12:29:15 +0800 Subject: [PATCH 08/35] ci: fix typo --- .github/workflows/release-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index a71ca2cf2..ffd8d4563 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -122,7 +122,12 @@ jobs: needs: [build-and-release] steps: - name: Download artifacts - uses: actions/download-artifacts@v4 + uses: actions/download-artifact@v4 + + - name: Prepare file + run: | + mkdir -p ./testing/weasel + mv appcast.xml ./testing/weasel/ - name: Deploy appcast uses: peaceiris/actions-gh-pages@v4 From ce7ade52b01b146ff11a0e36469ef915116f5892 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 12:51:30 +0800 Subject: [PATCH 09/35] ci: unzip artifact.zip --- .github/workflows/release-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index ffd8d4563..50684a14b 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -127,6 +127,7 @@ jobs: - name: Prepare file run: | mkdir -p ./testing/weasel + unzip artifact.zip mv appcast.xml ./testing/weasel/ - name: Deploy appcast From 07d15bd97ffba53f286e21cb83c13428f471ee54 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 13:09:44 +0800 Subject: [PATCH 10/35] ci: attempt to fix download-artifact issue --- .github/workflows/release-ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 50684a14b..d3465628a 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -123,12 +123,11 @@ jobs: steps: - name: Download artifacts uses: actions/download-artifact@v4 + with: + path: testing/weasel + merge-multiple: true - - name: Prepare file - run: | - mkdir -p ./testing/weasel - unzip artifact.zip - mv appcast.xml ./testing/weasel/ + - run: ls -R testing/weasel - name: Deploy appcast uses: peaceiris/actions-gh-pages@v4 From 43ba73ec76ea83f87905cfd84d671d92666f2a1e Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 14:31:10 +0800 Subject: [PATCH 11/35] ci: specify deploy branch --- .github/workflows/release-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index d3465628a..86f9ef90e 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -136,3 +136,4 @@ jobs: external_repository: rime/rime.github.io publish_dir: ./testing/weasel/ keep_files: true + publish_branch: master From 3a52f38aeaf9f6b3d02b412592167d347abf9dc2 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 24 Jul 2024 14:54:20 +0800 Subject: [PATCH 12/35] ci: add destination_dir and cname info --- .github/workflows/release-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 86f9ef90e..85853530e 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -135,5 +135,7 @@ jobs: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} external_repository: rime/rime.github.io publish_dir: ./testing/weasel/ + destination_dir: 'testing/weasel' keep_files: true publish_branch: master + cname: rime.im From 6d0be22b355d1b74f5fd5d2ad1be7ccf1c65cdea Mon Sep 17 00:00:00 2001 From: fxliang Date: Fri, 26 Jul 2024 12:32:23 +0800 Subject: [PATCH 13/35] Revert last 9 commits, on updating https://rime.github.io/testing/weasel/appcast.xml --- .github/workflows/release-ci.yml | 36 +------------------- build.bat | 58 -------------------------------- 2 files changed, 1 insertion(+), 93 deletions(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 85853530e..81c7c3af0 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -104,38 +104,4 @@ jobs: ./output/archives/weasel*.exe ./output/archives/debug_symbols.7z body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md - - - name: Generate testing/weasel/appcast.xml - run: | - .\build.bat appcast - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - path: testing\weasel\appcast.xml - - update_appcast: - permissions: - contents: write - runs-on: ubuntu-latest - needs: [build-and-release] - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - path: testing/weasel - merge-multiple: true - - - run: ls -R testing/weasel - - - name: Deploy appcast - uses: peaceiris/actions-gh-pages@v4 - with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} - external_repository: rime/rime.github.io - publish_dir: ./testing/weasel/ - destination_dir: 'testing/weasel' - keep_files: true - publish_branch: master - cname: rime.im + diff --git a/build.bat b/build.bat index 62be47f85..e0b87d05a 100644 --- a/build.bat +++ b/build.bat @@ -69,7 +69,6 @@ set rime_build_variant=release set build_weasel=0 set build_installer=0 set build_arm64=0 -set build_appcast=0 rem parse the command line options :parse_cmdline_options @@ -93,7 +92,6 @@ 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" == "appcast" set build_appcast=1 if "%1" == "all" ( set build_boost=1 set build_data=1 @@ -107,11 +105,6 @@ rem parse the command line options goto parse_cmdline_options :end_parsing_cmdline_options -if %build_appcast% == 1 ( - call :build_appcast_xml - exit /b -) - if %build_weasel% == 0 ( if %build_boost% == 0 ( if %build_data% == 0 ( @@ -362,57 +355,6 @@ rem %3 : target_path of rime.dll, base %WEASEL_ROOT% or abs path if errorlevel 1 goto error exit /b - -: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% - 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-)", ^ - "latest" >> update_cast.ps1 - echo $newcontent = $newcontent -replace "(?<=weasel-)$long_pat(?=-installer.exe)", ^ - "$env:PRODUCT_VERSION" >> update_cast.ps1 - echo $newcontent = $newcontent -replace "(?<=\S+\s+)$short_pat(?=)", ^ - "$env:PRODUCT_VERSION" >> update_cast.ps1 - echo $newcontent = $newcontent -replace "(?<=sparkle:version=.)$short_pat", ^ - "$env:PRODUCT_VERSION" >> update_cast.ps1 - echo $newcontent = $newcontent -replace ^ - "(?<=)(http.*html)(?=)", ^ - "https://github.com/rime/weasel/releases/tag/latest" >> update_cast.ps1 - ) 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 "(?<=\S+\s+)$short_pat(?=)", ^ - "$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 "(?<=).*(?=)", "$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 - del update_cast.ps1 - if errorlevel 1 exit /b 1 - echo generated testing/weasel/appcast.xml - exit /b - rem --------------------------------------------------------------------------- :error From 71cd532b7c21ec1ea505e919efb02a708cb471da Mon Sep 17 00:00:00 2001 From: fxliang Date: Fri, 26 Jul 2024 12:45:55 +0800 Subject: [PATCH 14/35] fix: unexpected windows error event after closing mmc.exe or WINWORD.EXE --- WeaselIPC/WeaselClientImpl.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/WeaselIPC/WeaselClientImpl.cpp b/WeaselIPC/WeaselClientImpl.cpp index 031bba640..75f727921 100644 --- a/WeaselIPC/WeaselClientImpl.cpp +++ b/WeaselIPC/WeaselClientImpl.cpp @@ -199,19 +199,7 @@ LRESULT ClientImpl::_SendMessage(WEASEL_IPC_COMMAND Msg, PipeMessage req{Msg, wParam, lParam}; LRESULT ret = 0; switch (Msg) { - case WEASEL_IPC_SHUTDOWN_SERVER: - case WEASEL_IPC_START_SESSION: - case WEASEL_IPC_END_SESSION: - case WEASEL_IPC_START_MAINTENANCE: - case WEASEL_IPC_END_MAINTENANCE: - case WEASEL_IPC_UPDATE_INPUT_POS: - case WEASEL_IPC_FOCUS_IN: - case WEASEL_IPC_FOCUS_OUT: - case WEASEL_IPC_TRAY_COMMAND: { - ret = channel.Transact(req); - break; - } - default: { + case WEASEL_IPC_PROCESS_KEY_EVENT: { auto future = std::async(std::launch::async, [this, &req]() { return channel.Transact(req); }); @@ -226,6 +214,10 @@ LRESULT ClientImpl::_SendMessage(WEASEL_IPC_COMMAND Msg, } break; } + default: { + ret = channel.Transact(req); + break; + } } return ret; } catch (DWORD /* ex */) { From 4a045c1c78a7d2542edda96164ac1b2f0fcee961 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 29 Jul 2024 16:32:49 +0800 Subject: [PATCH 15/35] build: nightly build PRODUCT_VERSION changed to %WEASEL_VERSION%.%WEASEL_BUILD%.%%i, and output installer file name will be `weasel-%PRODUCT_VERSION%-installer.exe` %WEASEL_BUILD% is commit count since the latest release tag %%i is the short hash of current commit. --- build.bat | 14 ++++++++++---- output/install.nsi | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build.bat b/build.bat index e0b87d05a..5d6d881c1 100644 --- a/build.bat +++ b/build.bat @@ -22,8 +22,16 @@ if not defined RELEASE_BUILD ( rem check if git is installed and available, then get the short commit id of head git --version >nul 2>&1 if not errorlevel 1 ( + for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "^0."') do ( + set LAST_TAG=%%i + goto found_tag + ) + :found_tag + for /f "delims=" %%i in ('git rev-list %LAST_TAG%..HEAD --count') do ( + set WEASEL_BUILD=%%i + ) rem get short commmit id of head - for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%-%%i) + for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%.%%i) ) ) @@ -212,10 +220,8 @@ if %build_installer% == 1 ( "%ProgramFiles(x86)%"\NSIS\Bin\makensis.exe ^ /DWEASEL_VERSION=%WEASEL_VERSION% ^ /DWEASEL_BUILD=%WEASEL_BUILD% ^ + /DPRODUCT_VERSION=%PRODUCT_VERSION% ^ output\install.nsi - if not defined RELEASE_BUILD ( - move output\archives\weasel-%WEASEL_VERSION%.%WEASEL_BUILD%-installer.exe output\archives\weasel-%PRODUCT_VERSION%-installer.exe - ) if errorlevel 1 goto error ) diff --git a/output/install.nsi b/output/install.nsi index 8dd7450f2..b8254417a 100644 --- a/output/install.nsi +++ b/output/install.nsi @@ -25,7 +25,7 @@ Unicode true Name "小狼毫 ${WEASEL_VERSION}" ; The file to write -OutFile "archives\weasel-${WEASEL_VERSION}.${WEASEL_BUILD}-installer.exe" +OutFile "archives\weasel-${PRODUCT_VERSION}-installer.exe" VIProductVersion "${WEASEL_VERSION}.${WEASEL_BUILD}" VIAddVersionKey /LANG=2052 "ProductName" "小狼毫" From 549e9b3795552653a46382b4c4ac16fc552ac1cd Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 29 Jul 2024 17:18:52 +0800 Subject: [PATCH 16/35] ci: update testing appcast after release/nightly release --- .github/workflows/release-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 81c7c3af0..5f47330d7 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -105,3 +105,7 @@ jobs: ./output/archives/debug_symbols.7z body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md + - name: Update testing Appcast + run: gh workflow run gh-pages.yml -R rime/home --ref master + env: + GH_TOKEN: ${{ secrets.ACTIONS_DEPLOY_KEY }} From b97acff0bc6dc784befcdd4756961fedfd0f697f Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 29 Jul 2024 17:31:11 +0800 Subject: [PATCH 17/35] ci: checkout with tags --- .github/workflows/release-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 5f47330d7..b549bc385 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -21,6 +21,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + tags: true - name: Configure build environment shell: bash From 34a9185295a6e37d2a2d6cc8e459af83a84c8d77 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 29 Jul 2024 17:38:10 +0800 Subject: [PATCH 18/35] ci: fix fetch tags --- .github/workflows/release-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index b549bc385..098fc7511 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -21,7 +21,9 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - tags: true + + - name: Fetch all tags + run: git fetch --tags - name: Configure build environment shell: bash From 28ace8ef2dfce4b6ed7a6068f2d866146135aba2 Mon Sep 17 00:00:00 2001 From: fxliang Date: Tue, 30 Jul 2024 11:42:53 +0800 Subject: [PATCH 19/35] ci: attempt to fix WEASEL_BUILD for nightly build --- .github/workflows/release-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 098fc7511..621581a9d 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -20,7 +20,8 @@ jobs: - name: Checkout last commit uses: actions/checkout@v4 with: - submodules: recursive + submodules: true + fetch-depth: 0 - name: Fetch all tags run: git fetch --tags From 2aebe91f0f2a4380b4a9636ec870c88f5c583b90 Mon Sep 17 00:00:00 2001 From: fxliang Date: Tue, 27 Aug 2024 17:02:12 +0800 Subject: [PATCH 20/35] ci: install llvm if necessary by pwsh commands, instead of actions/cache --- .github/workflows/commit-ci.yml | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 6fa9b166f..30639d1fb 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -25,16 +25,29 @@ jobs: with: submodules: recursive - - name: Cache llvm - id: cache-llvm - uses: actions/cache@v4 - with: - path: C:\\Program Files\\LLVM - key: ${{ runner.os }}-llvm-18.1.6 - - - name: Install llvm - if: steps.cache-llvm.outputs.cache-hit != 'true' - run: choco install llvm --version=18.1.6 + - name: Install llvm if necessary + shell: pwsh + run: | + $version = "" + if (Get-Command "clang-format" -ErrorAction SilentlyContinue){ + $version = clang-format --version + $pat = ".*\s+(\d+\.\d+\.\d+)" + if ($version -match $pat) { + $version = $matches[1] + } + } + if ($version -ne "") { + Write-Host "clang-format version:$version" + if ([version]$version -ge [version]"18.1.6") { + Write-Host "clang-format OK" + } else { + Write-Host "clang-format vesion does not meet" + choco install llvm --version=18.1.6 + } + } else { + Write-Host "clang-format not installed" + choco install llvm --version=18.1.6 + } - name: Code style lint shell: bash From d197177f81826eae3206f050a404389ef5215a19 Mon Sep 17 00:00:00 2001 From: fxliang Date: Tue, 27 Aug 2024 16:14:56 +0800 Subject: [PATCH 21/35] reverse async in IPC send message --- WeaselIPC/WeaselClientImpl.cpp | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/WeaselIPC/WeaselClientImpl.cpp b/WeaselIPC/WeaselClientImpl.cpp index 75f727921..26122ad50 100644 --- a/WeaselIPC/WeaselClientImpl.cpp +++ b/WeaselIPC/WeaselClientImpl.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include "WeaselClientImpl.h" #include -#include -#include using namespace weasel; @@ -197,29 +195,7 @@ LRESULT ClientImpl::_SendMessage(WEASEL_IPC_COMMAND Msg, DWORD lParam) { try { PipeMessage req{Msg, wParam, lParam}; - LRESULT ret = 0; - switch (Msg) { - case WEASEL_IPC_PROCESS_KEY_EVENT: { - auto future = std::async(std::launch::async, [this, &req]() { - return channel.Transact(req); - }); - // wait Transact complete or overtime - if (future.wait_for(std::chrono::seconds(2)) == - std::future_status::timeout) { - // Transact overtime - ret = 0; - } else { - // Transact complete - ret = future.get(); - } - break; - } - default: { - ret = channel.Transact(req); - break; - } - } - return ret; + return channel.Transact(req); } catch (DWORD /* ex */) { return 0; } From 9275283bac7004837c943fe06cc83bc2659e1285 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 4 Sep 2024 21:39:59 +0800 Subject: [PATCH 22/35] build: xmake optional (#1360) * build: xmake is now optional with xbuild.bat * chore: update llvm version in install-clang-format.bat --- .github/workflows/commit-ci.yml | 92 +++++++++++-- RimeWithWeasel/xmake.lua | 5 + WeaselDeployer/xmake.lua | 24 ++++ WeaselIME/xmake.lua | 30 +++++ WeaselIPC/xmake.lua | 4 + WeaselIPCServer/xmake.lua | 4 + WeaselServer/xmake.lua | 27 ++++ WeaselSetup/xmake.lua | 33 +++++ WeaselTSF/xmake.lua | 31 +++++ WeaselUI/xmake.lua | 4 + install-clang-format.bat | 16 +-- test/TestResponseParser/xmake.lua | 12 ++ test/TestWeaselIPC/xmake.lua | 12 ++ xbuild.bat | 215 ++++++++++++++++++++++++++++++ xmake.lua | 107 +++++++++++++++ 15 files changed, 597 insertions(+), 19 deletions(-) create mode 100644 RimeWithWeasel/xmake.lua create mode 100644 WeaselDeployer/xmake.lua create mode 100644 WeaselIME/xmake.lua create mode 100644 WeaselIPC/xmake.lua create mode 100644 WeaselIPCServer/xmake.lua create mode 100644 WeaselServer/xmake.lua create mode 100644 WeaselSetup/xmake.lua create mode 100644 WeaselTSF/xmake.lua create mode 100644 WeaselUI/xmake.lua create mode 100644 test/TestResponseParser/xmake.lua create mode 100644 test/TestWeaselIPC/xmake.lua create mode 100644 xbuild.bat create mode 100644 xmake.lua diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 30639d1fb..8edb3c25d 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -14,17 +14,11 @@ on: pull_request: jobs: - build: + lint: runs-on: windows-2019 - env: - boost_version: 1.84.0 - BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_84_0 steps: - name: Checkout last commit uses: actions/checkout@v4 - with: - submodules: recursive - - name: Install llvm if necessary shell: pwsh run: | @@ -48,11 +42,27 @@ jobs: Write-Host "clang-format not installed" choco install llvm --version=18.1.6 } - - name: Code style lint shell: bash run: ./clang-format.sh -i + build: + needs: lint + runs-on: windows-2019 + env: + boost_version: 1.84.0 + BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_84_0 + steps: + + - name: Checkout last commit + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --tags + - name: Configure build environment shell: bash run: | @@ -67,7 +77,6 @@ jobs: ${{ env.BOOST_ROOT }} key: ${{ runner.os }}-boost-${{ env.boost_version }} - # install boost if not cached - name: Install Boost if: steps.cache-boost.outputs.cache-hit != 'true' shell: bash @@ -75,11 +84,9 @@ jobs: ./install_boost.bat ./build.bat boost arm64 - # add msbuild to PATH - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v2 - # use upper stream released librime files if stable release - name: Copy Rime files run: | .\github.install.bat @@ -106,3 +113,66 @@ jobs: path: | .\output\archives\weasel*.exe .\output\archives\debug_symbols.7z + + xbuild: + needs: lint + runs-on: windows-2019 + env: + boost_version: 1.84.0 + BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_84_0 + steps: + + - name: Checkout last commit + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Fetch all tags + run: git fetch --tags + + - name: Configure build environment + shell: bash + run: | + cp env.vs2019.bat env.bat + echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV + + - name: Cache Boost + id: cache-boost + uses: actions/cache@v4 + with: + path: | + ${{ env.BOOST_ROOT }} + key: ${{ runner.os }}-boost-${{ env.boost_version }} + + - name: Install Boost + if: steps.cache-boost.outputs.cache-hit != 'true' + shell: bash + run: | + ./install_boost.bat + ./build.bat boost arm64 + + # xmake 2.9.4 or later + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: '2.9.4' + actions-cache-folder: '.xmake-cache' + + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Copy Rime files + shell: pwsh + run: | + .\github.install.bat + + - name: Build data + run: | + $ErrorActionPreference = 'Stop' + .\build.bat data + + - name: Build Weasel + id: build_weasel + shell: cmd + run: | + .\xbuild.bat arm64 installer + diff --git a/RimeWithWeasel/xmake.lua b/RimeWithWeasel/xmake.lua new file mode 100644 index 000000000..5bca92bd1 --- /dev/null +++ b/RimeWithWeasel/xmake.lua @@ -0,0 +1,5 @@ +target("RimeWithWeasel") + set_kind("static") + add_files("./*.cpp") + add_rules("use_weaselconstants") + diff --git a/WeaselDeployer/xmake.lua b/WeaselDeployer/xmake.lua new file mode 100644 index 000000000..61823d48d --- /dev/null +++ b/WeaselDeployer/xmake.lua @@ -0,0 +1,24 @@ +target("WeaselDeployer") + set_kind("binary") + add_files("./*.cpp") + add_rules("add_rcfiles", "use_weaselconstants", "subwin") + add_links("imm32", "kernel32", "rime") + add_deps("WeaselIPC", "RimeWithWeasel") + add_files("$(projectdir)/PerMonitorHighDPIAware.manifest") + add_ldflags("/DEBUG /OPT:ICF /LARGEADDRESSAWARE /ERRORREPORT:QUEUE") + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) + after_build(function(target) + if is_arch("x86") then + os.cp(path.join(target:targetdir(), "WeaselDeployer.exe"), "$(projectdir)/output/Win32") + os.cp(path.join(target:targetdir(), "WeaselDeployer.pdb"), "$(projectdir)/output/Win32") + else + os.cp(path.join(target:targetdir(), "WeaselDeployer.exe"), "$(projectdir)/output") + os.cp(path.join(target:targetdir(), "WeaselDeployer.pdb"), "$(projectdir)/output") + end + end) diff --git a/WeaselIME/xmake.lua b/WeaselIME/xmake.lua new file mode 100644 index 000000000..d24d4a353 --- /dev/null +++ b/WeaselIME/xmake.lua @@ -0,0 +1,30 @@ +target("WeaselIME") + set_kind("shared") + add_files("./*.cpp") + add_rules("add_rcfiles") + add_links("advapi32", "imm32", "user32", "gdi32") + add_deps("WeaselIPC", "WeaselUI") + local fname = '' + + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) + + after_build(function(target) + os.cp(path.join(target:targetdir(), "*.ime"), "$(projectdir)/output") + end) + if is_arch("x86") then + fname = "weasel.ime" + elseif is_arch("x64") then + fname = "weaselx64.ime" + elseif is_arch("arm") then + fname = "weaselARM.ime" + elseif is_arch("arm64") then + fname = "weaselARM64.ime" + end + set_filename(fname) + diff --git a/WeaselIPC/xmake.lua b/WeaselIPC/xmake.lua new file mode 100644 index 000000000..b55b10314 --- /dev/null +++ b/WeaselIPC/xmake.lua @@ -0,0 +1,4 @@ +target("WeaselIPC") + set_kind("static") + add_files("./*.cpp") + diff --git a/WeaselIPCServer/xmake.lua b/WeaselIPCServer/xmake.lua new file mode 100644 index 000000000..9ef67d0f9 --- /dev/null +++ b/WeaselIPCServer/xmake.lua @@ -0,0 +1,4 @@ +target("WeaselIPCServer") + set_kind("static") + add_files("./*.cpp") + diff --git a/WeaselServer/xmake.lua b/WeaselServer/xmake.lua new file mode 100644 index 000000000..78b99b0d3 --- /dev/null +++ b/WeaselServer/xmake.lua @@ -0,0 +1,27 @@ +target("WeaselServer") + set_kind("binary") + add_files("./*.cpp") + add_rules("add_rcfiles", "subwin") + add_links("imm32", "kernel32", "rime") + add_deps("WeaselUI", "WeaselIPC", "RimeWithWeasel", "WeaselIPCServer") + + add_files("$(projectdir)/PerMonitorHighDPIAware.manifest") + add_ldflags("/DEBUG /OPT:REF /OPT:ICF /LARGEADDRESSAWARE /ERRORREPORT:QUEUE") + set_policy("windows.manifest.uac", "invoker") + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) + after_build(function(target) + if is_arch("x86") then + os.cp(path.join(target:targetdir(), "WeaselServer.exe"), "$(projectdir)/output/Win32") + os.cp(path.join(target:targetdir(), "WeaselServer.pdb"), "$(projectdir)/output/Win32") + else + os.cp(path.join(target:targetdir(), "WeaselServer.exe"), "$(projectdir)/output") + os.cp(path.join(target:targetdir(), "WeaselServer.pdb"), "$(projectdir)/output") + end + end) + diff --git a/WeaselSetup/xmake.lua b/WeaselSetup/xmake.lua new file mode 100644 index 000000000..49439e8bd --- /dev/null +++ b/WeaselSetup/xmake.lua @@ -0,0 +1,33 @@ +target("WeaselSetup") + set_kind("binary") + add_files("./*.cpp") + add_rules("add_rcfiles", "use_weaselconstants", "subwin") + add_links("imm32", "kernel32") + + set_policy("windows.manifest.uac", "admin") + add_files("$(projectdir)/PerMonitorHighDPIAware.manifest") + add_ldflags("/DEBUG /OPT:REF /OPT:ICF /LARGEADDRESSAWARE /ERRORREPORT:QUEUE") + + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + local level = target:policy("windows.manifest.uac") + if level then + local level_maps = { + invoker = "asInvoker", + admin = "requireAdministrator", + highest = "highestAvailable" + } + assert(level_maps[level], "unknown uac level %s, please set invoker, admin or highest", level) + local ui = target:policy("windows.manifest.uac.ui") or false + target:add("ldflags", "/manifest:embed", {("/manifestuac:level='%s' uiAccess='%s'"):format(level_maps[level], ui)}, {force = true, expand = false}) + end + end) + + after_build(function(target) + os.cp(path.join(target:targetdir(), "WeaselSetup.exe"), "$(projectdir)/output") + os.cp(path.join(target:targetdir(), "WeaselSetup.pdb"), "$(projectdir)/output") + end) diff --git a/WeaselTSF/xmake.lua b/WeaselTSF/xmake.lua new file mode 100644 index 000000000..e13d9be86 --- /dev/null +++ b/WeaselTSF/xmake.lua @@ -0,0 +1,31 @@ +target("WeaselTSF") + set_kind("shared") + add_files("./*.cpp", "WeaselTSF.def") + add_rules("add_rcfiles", "use_weaselconstants") + add_deps("WeaselIPC", "WeaselUI") + local fname = '' + if is_arch("x86") then + fname = "weasel.dll" + elseif is_arch("x64") then + fname = "weaselx64.dll" + elseif is_arch("arm") then + fname = "weaselARM.dll" + elseif is_arch("arm64") then + fname = "weaselARM64.dll" + end + set_filename(fname) + + add_files("$(projectdir)/PerMonitorHighDPIAware.manifest") + add_shflags("/DEBUG /OPT:REF /OPT:ICF") + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) + + after_build(function(target) + os.cp(path.join(target:targetdir(), "weasel*.dll"), "$(projectdir)/output") + os.cp(path.join(target:targetdir(), "weasel*.pdb"), "$(projectdir)/output") + end) diff --git a/WeaselUI/xmake.lua b/WeaselUI/xmake.lua new file mode 100644 index 000000000..420befc2a --- /dev/null +++ b/WeaselUI/xmake.lua @@ -0,0 +1,4 @@ +target("WeaselUI") + set_kind("static") + add_files("./*.cpp") + diff --git a/install-clang-format.bat b/install-clang-format.bat index 0fcc437fb..3e1cc78dc 100644 --- a/install-clang-format.bat +++ b/install-clang-format.bat @@ -2,17 +2,17 @@ if "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( rem 64 bit system - rem powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win64.exe', 'LLVM-17.0.6-win64.exe')" - rem LLVM-17.0.6-win64.exe /S + rem powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.6/LLVM-18.1.6-win64.exe', 'LLVM-18.1.6-win64.exe')" + rem LLVM-18.1.6-win64.exe /S rem or maybe - rem output/7z.exe e LLVM-17.0.6-win64.exe bin/clang-format.exe -o. - rem rm LLVM-17.0.6-win64.exe + rem output/7z.exe e LLVM-18.1.6-win64.exe bin/clang-format.exe -o. + rem rm LLVM-18.1.6-win64.exe ) else ( rem 32 bit system - rem powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/LLVM-17.0.6-win32.exe', 'LLVM-17.0.6-win32.exe')" - rem LLVM-17.0.6-win32.exe /S + rem powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.6/LLVM-18.1.6-win32.exe', 'LLVM-18.1.6-win32.exe')" + rem LLVM-18.1.6-win32.exe /S rem or maybe - rem output/7z.exe e LLVM-17.0.6-win32.exe bin/clang-format.exe -o. - rem rm LLVM-17.0.6-win32.exe + rem output/7z.exe e LLVM-18.1.6-win32.exe bin/clang-format.exe -o. + rem rm LLVM-18.1.6-win32.exe ) pause diff --git a/test/TestResponseParser/xmake.lua b/test/TestResponseParser/xmake.lua new file mode 100644 index 000000000..906d03690 --- /dev/null +++ b/test/TestResponseParser/xmake.lua @@ -0,0 +1,12 @@ +target("TestResponseParser") + set_kind("binary") + add_files("./*.cpp") + add_deps("WeaselIPC", "WeaselIPCServer") + add_rules("subcmd") + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) diff --git a/test/TestWeaselIPC/xmake.lua b/test/TestWeaselIPC/xmake.lua new file mode 100644 index 000000000..0219a5a71 --- /dev/null +++ b/test/TestWeaselIPC/xmake.lua @@ -0,0 +1,12 @@ +target("TestWeaselIPC") + set_kind("binary") + add_files("./*.cpp") + add_deps("WeaselIPC", "WeaselIPCServer") + add_rules("subcmd") + before_build(function(target) + local target_dir = path.join(target:targetdir(), target:name()) + if not os.exists(target_dir) then + os.mkdir(target_dir) + end + target:set("targetdir", target_dir) + end) diff --git a/xbuild.bat b/xbuild.bat new file mode 100644 index 000000000..5bf471a89 --- /dev/null +++ b/xbuild.bat @@ -0,0 +1,215 @@ +@echo off +setlocal enabledelayedexpansion +if not defined include ( + echo You should run this inside Developer Command Promt! + exit /b +) +for %%a in ("%include:;=" "%") do ( + echo %%a| findstr /r "ATLMFC\\include" > nul + if not errorlevel 1 ( + set "atl_lib_dir=%%a" + set dpi_manifest=!atl_lib_dir:ATLMFC\include=Include\Manifest\PerMonitorHighDPIAware.manifest! + if not exist ".\PerMonitorHighDPIAware.manifest" ( + copy ""!dpi_manifest!"" .\ + ) + ) +) +rem --------------------------------------------------------------------------- +if not exist env.bat copy env.bat.template env.bat +if exist env.bat call env.bat +set PRODUCT_VERSION= +if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% +if not defined VERSION_MAJOR set VERSION_MAJOR=0 +if not defined VERSION_MINOR set VERSION_MINOR=16 +if not defined VERSION_PATCH set VERSION_PATCH=1 + +if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% +if not defined WEASEL_BUILD set WEASEL_BUILD=0 + +rem use numeric build version for release build +set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% +rem for non-release build, try to use git commit hash as product build version +if not defined RELEASE_BUILD ( + rem check if git is installed and available, then get the short commit id of head + git --version >nul 2>&1 + if not errorlevel 1 ( + for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "^0."') do ( + set LAST_TAG=%%i + goto found_tag + ) + :found_tag + for /f "delims=" %%i in ('git rev-list %LAST_TAG%..HEAD --count') do ( + set WEASEL_BUILD=%%i + ) + rem get short commmit id of head + for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%.%%i) + ) +) + +rem FILE_VERSION is always 4 numbers; same as PRODUCT_VERSION in release build +if not defined FILE_VERSION set FILE_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% +echo PRODUCT_VERSION=%PRODUCT_VERSION% +echo WEASEL_VERSION=%WEASEL_VERSION% +echo WEASEL_BUILD=%WEASEL_BUILD% +echo WEASEL_ROOT=%WEASEL_ROOT% +echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% +echo BOOST_ROOT=%BOOST_ROOT% +rem --------------------------------------------------------------------------- +rem parse the command line options +set build_config=release +set build_rebuild=0 +set build_boost=0 +set boost_build_variant=release +set build_data=0 +set build_opencc=0 +set build_rime=0 +set rime_build_variant=release +set build_weasel=0 +set build_installer=0 +set build_arm64=0 +set build_clean=0 +set build_commands=0 +:parse_cmdline_options + if "%1" == "" goto end_parsing_cmdline_options + if "%1" == "debug" ( + set build_config=debug + set boost_build_variant=debug + set rime_build_variant=debug + ) + if "%1" == "release" ( + set build_config=release + set boost_build_variant=release + set rime_build_variant=release + ) + if "%1" == "rebuild" set build_rebuild=1 + if "%1" == "boost" set build_boost=1 + if "%1" == "data" set build_data=1 + if "%1" == "opencc" set build_opencc=1 + if "%1" == "rime" set build_rime=1 + if "%1" == "librime" set build_rime=1 + if "%1" == "weasel" set build_weasel=1 + if "%1" == "installer" set build_installer=1 + if "%1" == "arm64" set build_arm64=1 + if "%1" == "clean" set build_clean=1 + if "%1" == "commands" set build_commands=1 + if "%1" == "all" ( + set build_boost=1 + set build_data=1 + set build_opencc=1 + set build_rime=1 + set build_weasel=1 + set build_installer=1 + set build_arm64=1 + set build_commands=1 + ) + shift + goto parse_cmdline_options +:end_parsing_cmdline_options + +if %build_weasel% == 0 ( +if %build_boost% == 0 ( +if %build_data% == 0 ( +if %build_opencc% == 0 ( +if %build_rime% == 0 ( +if %build_commands% == 0 ( + set build_weasel=1 +)))))) +rem +rem quit WeaselServer.exe before building +cd /d %WEASEL_ROOT% +if exist output\weaselserver.exe ( + output\weaselserver.exe /q +) + +rem build booost +if %build_boost% == 1 ( + if %build_arm64% == 1 ( + call build.bat boost arm64 + ) else ( + call build.bat boost + ) + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_rime% == 1 ( + call build.bat rime + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_data% == 1 ( + call build.bat data + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_opencc% == 1 ( + call build.bat opencc + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) + +if %build_commands% == 1 ( + echo Generating compile_commands.json + xmake project -k compile_commands -m %build_config% +) + +rem if to clean +if %build_clean% == 1 ( goto clean ) +if %build_weasel% == 0 ( goto end ) + +if %build_arm64% == 1 ( + xmake f -a arm64 -m %build_config% + if %build_rebuild% == 1 ( xmake clean ) + xmake + if errorlevel 1 goto error + xmake f -a arm -m %build_config% + if %build_rebuild% == 1 ( xmake clean ) + xmake + if errorlevel 1 goto error +) +xmake f -a x64 -m %build_config% +if %build_rebuild% == 1 ( xmake clean ) +xmake +if errorlevel 1 goto error +xmake f -a x86 -m %build_config% +if %build_rebuild% == 1 ( xmake clean ) +xmake +if errorlevel 1 goto error + +if %build_arm64% == 1 ( + pushd arm64x_wrapper + call build.bat + if errorlevel 1 goto error + popd + + copy arm64x_wrapper\weaselARM64X.dll output + if errorlevel 1 goto error + copy arm64x_wrapper\weaselARM64X.ime output + if errorlevel 1 goto error +) +if %build_installer% == 1 ( + "%ProgramFiles(x86)%"\NSIS\Bin\makensis.exe ^ + /DWEASEL_VERSION=%WEASEL_VERSION% ^ + /DWEASEL_BUILD=%WEASEL_BUILD% ^ + /DPRODUCT_VERSION=%PRODUCT_VERSION% ^ + output\install.nsi + if errorlevel 1 goto error +) +goto end + +:clean + if exist build ( + rmdir /s /q build + if errorlevel 1 ( + echo error cleaning weasel build + goto error + ) + goto end + ) + +:error + echo error building weasel... + exit /b 1 + +:end + cd %WEASEL_ROOT% + diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 000000000..3a61b7fe1 --- /dev/null +++ b/xmake.lua @@ -0,0 +1,107 @@ +-- 工作区的xmake.lua +set_project("weasel") + +-- 定义全局变量 +set_xmakever("2.9.4") +set_languages("c++17") +add_defines("UNICODE", "_UNICODE") +add_defines("WINDOWS") +add_defines("MSVC") + +add_includedirs("$(projectdir)/include") +-- 设置Boost库的全局路径 +boost_root = os.getenv("BOOST_ROOT") +boost_include_path = boost_root +boost_lib_path = boost_root .. "/stage/lib" +add_includedirs(boost_include_path) +add_linkdirs(boost_lib_path) +add_cxflags("/utf-8 /MP /O2 /Oi /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /external:W3 /Gd /TP /FC") +add_ldflags("/TLBID:1 /DYNAMICBASE /NXCOMPAT") + +-- 全局ATL lib路径 +local atl_lib_dir = '' +dpi_manifest = '' +for include in string.gmatch(os.getenv("include"), "([^;]+)") do + if atl_lib_dir=='' and include:match(".*ATLMFC\\include\\?$") then + atl_lib_dir = include:replace("include$", "lib") + dpi_manifest = include:replace("ATLMFC\\include$", "Include\\Manifest\\PerMonitorHighDPIAware.manifest") + end + add_includedirs(include) +end + +add_includedirs("$(projectdir)/include/wtl") + +if is_arch("x64") then + add_linkdirs("$(projectdir)/lib64") + add_linkdirs(atl_lib_dir .. "/x64") +elseif is_arch("x86") then + add_linkdirs("$(projectdir)/lib") + add_linkdirs(atl_lib_dir .. "/x86") +elseif is_arch("arm") then + add_linkdirs(atl_lib_dir .. "/arm") +elseif is_arch("arm64") then + add_linkdirs(atl_lib_dir .. "/arm64") +end + +add_links("atls", "shell32", "advapi32", "gdi32", "user32", "uuid", "ole32") + +includes("WeaselIPC", "WeaselUI", "WeaselTSF", "WeaselIME") + +if is_arch("x64") or is_arch("x86") then + includes("RimeWithWeasel", "WeaselIPCServer", "WeaselServer", "WeaselDeployer") +end + +if is_arch("x86") then + includes("WeaselSetup") +end + +if is_mode("debug") then + includes("test/TestWeaselIPC") + includes("test/TestResponseParser") +else + add_cxflags("/GL") + add_ldflags("/LTCG /INCREMENTAL:NO", {force = true}) +end + +rule("subcmd") + on_load(function(target) + target:add("ldflags", "/SUBSYSTEM:CONSOLE") + end) +rule("subwin") + on_load(function(target) + target:add("ldflags", "/SUBSYSTEM:WINDOWS") + end) + +rule("add_rcfiles") + on_load(function(target) + target:add("files", path.join(target:scriptdir(), "*.rc"), + {defines = {"VERSION_MAJOR=" .. os.getenv("VERSION_MAJOR"), + "VERSION_MINOR=" .. os.getenv("VERSION_MINOR"), + "VERSION_PATCH=" .. os.getenv("VERSION_PATCH"), + "FILE_VERSION=" .. os.getenv("FILE_VERSION"), + "PRODUCT_VERSION=" .. os.getenv("PRODUCT_VERSION") + }}) + end) +rule("use_weaselconstants") + on_load(function(target) + function check_include_weasel_constants_in_dir(dir) + local files = os.files(path.join(dir, "**.h")) + table.join2(files, os.files(path.join(dir, "**.cpp"))) + for _, file in ipairs(files) do + local content = io.readfile(file) + if content:find('#include%s+"WeaselConstants%.h"') or content:find('#include%s+') then + return true + end + end + return false + end + if check_include_weasel_constants_in_dir(target:scriptdir()) then + target:add("defines", { + "VERSION_MAJOR=" .. os.getenv("VERSION_MAJOR"), + "VERSION_MINOR=" .. os.getenv("VERSION_MINOR"), + "VERSION_PATCH=" .. os.getenv("VERSION_PATCH"), + "FILE_VERSION=" .. os.getenv("FILE_VERSION"), + "PRODUCT_VERSION=" .. os.getenv("PRODUCT_VERSION") + }) + end + end) From 4acb9368ac72417cb0985c44d4950d8647e51807 Mon Sep 17 00:00:00 2001 From: fxliang Date: Sat, 14 Sep 2024 17:45:44 +0800 Subject: [PATCH 23/35] feat: GUID_COMPARTMENT_KEYBOARD_OPENCLOSE actions configurable. (#1364) - WeaselTSF default toggle ascii_mode on keyboard open/close messages(esp., Ctrl+Space), if `HKEY_CURRENT_USER\SOFTWARE\Rime\Weasel\ToggleImeOnOpenClose` is not set `yes` - WeaselSetup parameters, `/toggleime` to enable toggle ime on keyboard open/close message, `/toggleascii` to toggle ascii_mode when those messages come. --- WeaselSetup/WeaselSetup.cpp | 8 ++++++++ WeaselTSF/Compartment.cpp | 27 +++++++++++++++++++++------ WeaselTSF/KeyEventSink.cpp | 4 +++- WeaselTSF/LanguageBar.h | 1 + WeaselTSF/WeaselTSF.cpp | 4 ++++ WeaselTSF/WeaselTSF.h | 1 + 6 files changed, 38 insertions(+), 7 deletions(-) diff --git a/WeaselSetup/WeaselSetup.cpp b/WeaselSetup/WeaselSetup.cpp index bef216a7c..259af11f7 100644 --- a/WeaselSetup/WeaselSetup.cpp +++ b/WeaselSetup/WeaselSetup.cpp @@ -161,6 +161,14 @@ static int Run(LPTSTR lpCmdLine) { L"CheckForUpdates", L"0", REG_SZ); } + if (!wcscmp(L"/toggleime", lpCmdLine)) { + return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel", + L"ToggleImeOnOpenClose", L"yes", REG_SZ); + } + if (!wcscmp(L"/toggleascii", lpCmdLine)) { + return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel", + L"ToggleImeOnOpenClose", L"no", REG_SZ); + } if (!wcscmp(L"/testing", lpCmdLine)) { return SetRegKeyValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel", L"UpdateChannel", L"testing", REG_SZ); diff --git a/WeaselTSF/Compartment.cpp b/WeaselTSF/Compartment.cpp index a3b6a25a2..a45e0d1f9 100644 --- a/WeaselTSF/Compartment.cpp +++ b/WeaselTSF/Compartment.cpp @@ -5,6 +5,7 @@ #include #include "ResponseParser.h" #include "CandidateList.h" +#include "LanguageBar.h" STDAPI CCompartmentEventSink::QueryInterface(REFIID riid, _Outptr_ void** ppvObj) { @@ -242,13 +243,27 @@ void WeaselTSF::_UninitCompartment() { HRESULT WeaselTSF::_HandleCompartment(REFGUID guidCompartment) { if (IsEqualGUID(guidCompartment, GUID_COMPARTMENT_KEYBOARD_OPENCLOSE)) { - BOOL isOpen = _IsKeyboardOpen(); - // clear composition when close keyboard - if (!isOpen && _pEditSessionContext) { - m_client.ClearComposition(); - _EndComposition(_pEditSessionContext, true); + if (_isToOpenClose) { + BOOL isOpen = _IsKeyboardOpen(); + // clear composition when close keyboard + if (!isOpen && _pEditSessionContext) { + m_client.ClearComposition(); + _EndComposition(_pEditSessionContext, true); + } + _EnableLanguageBar(isOpen); + _UpdateLanguageBar(_status); + } else { + _status.ascii_mode = !_status.ascii_mode; + _SetKeyboardOpen(true); + if (_pLangBarButton && _pLangBarButton->IsLangBarDisabled()) + _EnableLanguageBar(true); + _HandleLangBarMenuSelect(_status.ascii_mode + ? ID_WEASELTRAY_ENABLE_ASCII + : ID_WEASELTRAY_DISABLE_ASCII); + if (_pEditSessionContext) + m_client.ClearComposition(); + _UpdateLanguageBar(_status); } - _EnableLanguageBar(isOpen); } else if (IsEqualGUID(guidCompartment, GUID_COMPARTMENT_KEYBOARD_INPUTMODE_CONVERSION)) { BOOL isOpen = _IsKeyboardOpen(); diff --git a/WeaselTSF/KeyEventSink.cpp b/WeaselTSF/KeyEventSink.cpp index 55dde4f98..e0d431410 100644 --- a/WeaselTSF/KeyEventSink.cpp +++ b/WeaselTSF/KeyEventSink.cpp @@ -9,7 +9,9 @@ static BOOL prevfEaten = FALSE; static int keyCountToSimulate = 0; void WeaselTSF::_ProcessKeyEvent(WPARAM wParam, LPARAM lParam, BOOL* pfEaten) { - if (!_IsKeyboardOpen() || _IsKeyboardDisabled()) { + // when _IsKeyboardDisabled don't eat the key, + // when keyboard closable and keyboard closed, don't eat the key + if ((_isToOpenClose && !_IsKeyboardOpen()) || _IsKeyboardDisabled()) { *pfEaten = FALSE; return; } diff --git a/WeaselTSF/LanguageBar.h b/WeaselTSF/LanguageBar.h index 667eab3fd..2c0513ab3 100644 --- a/WeaselTSF/LanguageBar.h +++ b/WeaselTSF/LanguageBar.h @@ -30,6 +30,7 @@ class CLangBarItemButton : public ITfLangBarItemButton, public ITfSource { /* ITfSource */ STDMETHODIMP AdviseSink(REFIID riid, IUnknown* punk, DWORD* pdwCookie); STDMETHODIMP UnadviseSink(DWORD dwCookie); + BOOL IsLangBarDisabled() { return (_status & TF_LBI_STATUS_DISABLED); } void UpdateWeaselStatus(weasel::Status stat); void SetLangbarStatus(DWORD dwStatus, BOOL fSet); diff --git a/WeaselTSF/WeaselTSF.cpp b/WeaselTSF/WeaselTSF.cpp index 0564ebdc1..236e3daf8 100644 --- a/WeaselTSF/WeaselTSF.cpp +++ b/WeaselTSF/WeaselTSF.cpp @@ -171,6 +171,10 @@ STDAPI WeaselTSF::ActivateEx(ITfThreadMgr* pThreadMgr, } STDMETHODIMP WeaselTSF::OnSetThreadFocus() { + std::wstring _ToggleImeOnOpenClose{}; + RegGetStringValue(HKEY_CURRENT_USER, L"Software\\Rime\\weasel", + L"ToggleImeOnOpenClose", _ToggleImeOnOpenClose); + _isToOpenClose = (_ToggleImeOnOpenClose == L"yes"); if (m_client.Echo()) { m_client.ProcessKeyEvent(0); weasel::ResponseParser parser(NULL, NULL, &_status, NULL, &_cand->style()); diff --git a/WeaselTSF/WeaselTSF.h b/WeaselTSF/WeaselTSF.h index 12ae30d17..696d3cce4 100644 --- a/WeaselTSF/WeaselTSF.h +++ b/WeaselTSF/WeaselTSF.h @@ -232,4 +232,5 @@ class WeaselTSF : public ITfTextInputProcessorEx, TfGuidAtom _gaDisplayAttributeInput; BOOL _async_edit = false; BOOL _committed = false; + BOOL _isToOpenClose = false; }; From b9cef05d311dfb5d32d96e3a21f0590faa95e4f1 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 9 Sep 2024 16:19:37 +0800 Subject: [PATCH 24/35] refactor: fix warnings on GetVersion and GetVersionEx --- WeaselServer/SystemTraySDK.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/WeaselServer/SystemTraySDK.cpp b/WeaselServer/SystemTraySDK.cpp index 4c5745c9e..19e8ca485 100644 --- a/WeaselServer/SystemTraySDK.cpp +++ b/WeaselServer/SystemTraySDK.cpp @@ -112,10 +112,16 @@ void CSystemTray::Initialise() { m_uCreationFlags = 0; #ifdef SYSTEMTRAY_USEW2K - OSVERSIONINFO os = {sizeof(os)}; - GetVersionEx(&os); - m_bWin2K = - (VER_PLATFORM_WIN32_NT == os.dwPlatformId && os.dwMajorVersion >= 5); + OSVERSIONINFOEX osInfo = {0}; + osInfo.dwOSVersionInfoSize = sizeof(osInfo); + osInfo.dwMajorVersion = 5; + osInfo.dwPlatformId = VER_PLATFORM_WIN32_NT; + DWORDLONG conditionMask = 0; + conditionMask = + VerSetConditionMask(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + conditionMask = VerSetConditionMask(conditionMask, VER_PLATFORMID, VER_EQUAL); + m_bWin2K = VerifyVersionInfo(&osInfo, VER_MAJORVERSION | VER_PLATFORMID, + conditionMask); #else m_bWin2K = FALSE; #endif @@ -156,7 +162,13 @@ BOOL CSystemTray::Create(HINSTANCE hInst, m_bEnabled = TRUE; #else // this is only for Windows 95 (or higher) - m_bEnabled = (GetVersion() & 0xff) >= 4; + OSVERSIONINFOEXW osInfo = {0}; + osInfo.dwOSVersionInfoSize = sizeof(osInfo); + osInfo.dwMajorVersion = 4; + DWORDLONG conditionMask = 0; + conditionMask = + VerSetConditionMask(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + m_bEnabled = VerifyVersionInfoW(&osInfo, VER_MAJORVERSION, conditionMask); if (!m_bEnabled) { ASSERT(FALSE); return FALSE; @@ -1058,4 +1070,4 @@ void CSystemTray::MaximiseFromTray(HWND hWnd) { SetActiveWindow(hWnd); SetForegroundWindow(hWnd); #endif -} \ No newline at end of file +} From 9bc58514058a0254b41336ae3a53b9355c9a05c5 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 9 Sep 2024 16:40:41 +0800 Subject: [PATCH 25/35] build: fix warnings on WeaselIME OutDir settings. --- WeaselIME/WeaselIME.vcxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/WeaselIME/WeaselIME.vcxproj b/WeaselIME/WeaselIME.vcxproj index f7fe773a4..82bc33431 100644 --- a/WeaselIME/WeaselIME.vcxproj +++ b/WeaselIME/WeaselIME.vcxproj @@ -117,41 +117,49 @@ true weasel .ime + $(SolutionDir)output\ true weasel$(Platform) .ime + $(SolutionDir)output\ false weasel .ime + $(SolutionDir)output\ false weasel$(Platform) .ime + $(SolutionDir)output\ true weasel$(Platform) .ime + $(SolutionDir)output\ true weasel$(Platform) .ime + $(SolutionDir)output\ false weasel$(Platform) .ime + $(SolutionDir)output\ false weasel$(Platform) .ime + $(SolutionDir)output\ From 2b2afbdf2e83f03f2ce65d8fba4e838a324a0acb Mon Sep 17 00:00:00 2001 From: fxliang Date: Fri, 27 Sep 2024 22:39:23 +0800 Subject: [PATCH 26/35] fix: PRODUCT_VERSION not correct in commit-ci or nightly build, after bumping version without new tag --- build.bat | 2 +- xbuild.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.bat b/build.bat index 5d6d881c1..a45be78b4 100644 --- a/build.bat +++ b/build.bat @@ -22,7 +22,7 @@ if not defined RELEASE_BUILD ( rem check if git is installed and available, then get the short commit id of head git --version >nul 2>&1 if not errorlevel 1 ( - for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "^0."') do ( + for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "%WEASEL_VERSION%"') do ( set LAST_TAG=%%i goto found_tag ) diff --git a/xbuild.bat b/xbuild.bat index 5bf471a89..5ebacb4f1 100644 --- a/xbuild.bat +++ b/xbuild.bat @@ -33,7 +33,7 @@ if not defined RELEASE_BUILD ( rem check if git is installed and available, then get the short commit id of head git --version >nul 2>&1 if not errorlevel 1 ( - for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "^0."') do ( + for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "%WEASEL_VERSION%"') do ( set LAST_TAG=%%i goto found_tag ) From 2130c49345a599d2958f5405e64bf33621d2459f Mon Sep 17 00:00:00 2001 From: fxliang Date: Sat, 28 Sep 2024 01:22:53 +0800 Subject: [PATCH 27/35] ci: set git_ref_name to PRODUCT_VERSION, for artifacts name. --- build.bat | 5 +++++ xbuild.bat | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/build.bat b/build.bat index a45be78b4..ca4e966f3 100644 --- a/build.bat +++ b/build.bat @@ -45,6 +45,11 @@ echo WEASEL_ROOT=%WEASEL_ROOT% echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% echo. +if defined GITHUB_ENV ( + setlocal enabledelayedexpansion + echo git_ref_name=%PRODUCT_VERSION%>>!GITHUB_ENV! +) + if defined BOOST_ROOT ( if exist "%BOOST_ROOT%\boost" goto boost_found ) diff --git a/xbuild.bat b/xbuild.bat index 5ebacb4f1..c8a50fde6 100644 --- a/xbuild.bat +++ b/xbuild.bat @@ -54,6 +54,12 @@ echo WEASEL_BUILD=%WEASEL_BUILD% echo WEASEL_ROOT=%WEASEL_ROOT% echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% echo BOOST_ROOT=%BOOST_ROOT% + +if defined GITHUB_ENV ( + setlocal enabledelayedexpansion + echo git_ref_name=%PRODUCT_VERSION%>>!GITHUB_ENV! +) + rem --------------------------------------------------------------------------- rem parse the command line options set build_config=release From c46d94db866f5b9edb79cfe8c3fdb7f3f72a3440 Mon Sep 17 00:00:00 2001 From: liangfx Date: Fri, 27 Sep 2024 18:02:00 +0800 Subject: [PATCH 28/35] =?UTF-8?q?chore(release):=200.16.2=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ build.bat | 2 +- librime | 2 +- xbuild.bat | 2 +- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6acb39add..1ba44241a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ + +## [0.16.2](https://github.com/rime/weasel/compare/0.16.1...0.16.2) (2024-09-28) + +#### 安裝須知 + +**⚠️如您由0.16.0之前的版本升級,由於參數變化,安裝小狼毫前請保存好文件資料,於安裝後重啓或註銷 Windows,否則正在使用小狼毫的應用可能會崩潰。** + +**⚠如您由0.16.0之前的版本升級,請確認您的 `installation.yaml` 文件編碼爲 `UTF-8`, 否則如您在其中修改了非 ASCII 字符內容的路徑時,有可能會引起未明錯誤。** + +#### 主要更新 +* 新特性:支持自動檢查更新使用測試通道,使用`WeaselSetup.exe`參數可修改,`/testing`使用測試通道,`/release`使用發佈版本,默認後者; +* 新特性:`WeaselSetup.exe`參數設置界面語言,设置后覆盖区域设置的自动检测。`/lt`設置爲繁體中文界面,`/ls` 設置爲簡體中文界面,`/le`設置爲英文界面 +* 新特性:`WeaselSetup.exe`參數設置是否使用自動檢查更新,`/du`禁用自動檢查更新,`/eu`使用自動檢查更新 +* 新特性:安裝器彈窗提示設置是否自動檢查升級 +* 新特性:開關IME消息響應狀態可配置,`WeaselSetup.exe`參數`/toggleime`設置關閉鍵盤(原版本狀態),`/toggleascii`切換`ascii_mode`,安裝默認後者 #1364 +* 新特性:支持xmake 2.9.4以上版本構建,使用`xbuild.bat`開展,相關參數基本同`build.bat`, 使用`xbuild.bat commands`可生成`compile_commands.json`便於lsp使用,`xbuild.bat clean`可清空xmake構建 #1360 +* 新特性:支持`Caps_Lock` 按鍵binding(如選重),需将`key_binder`置于`ascii_composer`之前 +* 使能TSF dll中的WER +* nightly 構建後自動更新rime/home頁面更新測試通道appcast +* 升級lint檢查使用的llvm最低版本至18.1.6, 更新ci脚本检查更新llvm + +#### Bug 修復 + +* 修復安裝器在系統未滿足要求時未中斷的問題 +* 修復重新安裝時舊的安於路徑未保持的問題 +* 修復界面語言根據區域格式未正確設置的問題 +* 修復IPC通信時因新舊版本變更引起的異常崩潰的問題 +* 修正代碼編碼格式 +* 修復清空舊log文件 +* 修復控制面板卸載界面中的圖標顯示問題 +* 修復`style/hover_type`爲`"semi_hilite"`在首候選時的顯示異常問題 +* 修復新版librime產物未能直接替換使用問題 +* 禁用IPC通信的異步機制,修復一些因異步機制引發的應用異常 +* 修復構建腳本不能重生成正確的版本信息問題 +* 修復一些vs工程配置設置,處理一些deprecated API警告 + + ## [0.16.1](https://github.com/rime/weasel/compare/0.16.0...0.16.1) (2024-06-06) diff --git a/build.bat b/build.bat index ca4e966f3..11ab6453d 100644 --- a/build.bat +++ b/build.bat @@ -10,7 +10,7 @@ if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% if not defined VERSION_MAJOR set VERSION_MAJOR=0 if not defined VERSION_MINOR set VERSION_MINOR=16 -if not defined VERSION_PATCH set VERSION_PATCH=1 +if not defined VERSION_PATCH set VERSION_PATCH=2 if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% if not defined WEASEL_BUILD set WEASEL_BUILD=0 diff --git a/librime b/librime index 5b09f35ba..76a0a16c5 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit 5b09f35bab12683d8ed5e8663c18c940e971b954 +Subproject commit 76a0a16c5ca0c7efc80fa918c8e0c88754699fd7 diff --git a/xbuild.bat b/xbuild.bat index c8a50fde6..9160df73a 100644 --- a/xbuild.bat +++ b/xbuild.bat @@ -21,7 +21,7 @@ set PRODUCT_VERSION= if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% if not defined VERSION_MAJOR set VERSION_MAJOR=0 if not defined VERSION_MINOR set VERSION_MINOR=16 -if not defined VERSION_PATCH set VERSION_PATCH=1 +if not defined VERSION_PATCH set VERSION_PATCH=2 if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% if not defined WEASEL_BUILD set WEASEL_BUILD=0 From 02fdffed7af420be676c3ac1856dcf5e5681fdbe Mon Sep 17 00:00:00 2001 From: fxliang Date: Sat, 28 Sep 2024 23:13:16 +0800 Subject: [PATCH 29/35] ci: fix release ci --- .github/workflows/release-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 621581a9d..47d6630f2 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -24,6 +24,7 @@ jobs: fetch-depth: 0 - name: Fetch all tags + if: github.ref == 'refs/heads/master' run: git fetch --tags - name: Configure build environment From 4da263727e16362f01054f6f0bb7522e83ae1e06 Mon Sep 17 00:00:00 2001 From: Xuesong Peng Date: Mon, 30 Sep 2024 08:58:43 +0800 Subject: [PATCH 30/35] fix: invalid quick return --- WeaselDeployer/SwitcherSettingsDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WeaselDeployer/SwitcherSettingsDialog.cpp b/WeaselDeployer/SwitcherSettingsDialog.cpp index d9e648ce2..fe7f62765 100644 --- a/WeaselDeployer/SwitcherSettingsDialog.cpp +++ b/WeaselDeployer/SwitcherSettingsDialog.cpp @@ -182,8 +182,8 @@ LRESULT SwitcherSettingsDialog::OnOK(WORD, WORD code, HWND, BOOL&) { LRESULT SwitcherSettingsDialog::OnSchemaListItemChanged(int, LPNMHDR p, BOOL&) { LPNMLISTVIEW lv = reinterpret_cast(p); - if (!loaded_ || !lv || - lv->iItem < 0 && lv->iItem >= schema_list_.GetItemCount()) + if (!loaded_ || !lv || lv->iItem < 0 || + lv->iItem >= schema_list_.GetItemCount()) return 0; if ((lv->uNewState & LVIS_STATEIMAGEMASK) != (lv->uOldState & LVIS_STATEIMAGEMASK)) { From 91d5e4e224a0d73b8303a6ce10f03c71dace5cdd Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 30 Sep 2024 11:53:19 +0800 Subject: [PATCH 31/35] chore: update bump-version.sh, appcast.xml and testing-appcast.xml[skip ci] --- update/appcast.xml | 8 ++++---- update/bump-version.sh | 18 +++++++++++------- update/testing-appcast.xml | 8 ++++---- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/update/appcast.xml b/update/appcast.xml index 212d542c4..f99ed05c5 100644 --- a/update/appcast.xml +++ b/update/appcast.xml @@ -6,11 +6,11 @@ 小狼毫 Appcast 更新頻道 zh - 小狼毫 0.16.1 + 小狼毫 0.16.2 http://rime.github.io/release/weasel/release-notes.html - Thu, 06 Jun 2024 19:29:28 +0800 - Mon, 30 Sep 2024 11:51:10 +0800 + diff --git a/update/bump-version.sh b/update/bump-version.sh index 2fca3fdda..52e0557db 100755 --- a/update/bump-version.sh +++ b/update/bump-version.sh @@ -72,6 +72,9 @@ update_version_number() { update_version_number build.bat VERSION_MAJOR $old_major $new_major update_version_number build.bat VERSION_MINOR $old_minor $new_minor update_version_number build.bat VERSION_PATCH $old_patch $new_patch +update_version_number xbuild.bat VERSION_MAJOR $old_major $new_major +update_version_number xbuild.bat VERSION_MINOR $old_minor $new_minor +update_version_number xbuild.bat VERSION_PATCH $old_patch $new_patch if [[ $OSTYPE =~ darwin ]]; then L_BOUND='[[:<:]]' @@ -114,13 +117,14 @@ update_version_string update/appcast.xml update_pub_date update/testing-appcast.xml update_pub_date update/appcast.xml -update_changelog "${new_version}" -${VISUAL:-${EDITOR:-nano}} CHANGELOG.md -match_line "## ${new_version} " CHANGELOG.md || ( - echo >&2 "CHANGELOG.md has no changes for version ${new_version}." - exit 1 -) -bash update/write-release-notes.sh +# changelog manually, so disable this +#update_changelog "${new_version}" +#${VISUAL:-${EDITOR:-nano}} CHANGELOG.md +#match_line "## ${new_version} " CHANGELOG.md || ( +# echo >&2 "CHANGELOG.md has no changes for version ${new_version}." +# exit 1 +#) +#bash update/write-release-notes.sh release_message="chore(release): ${new_version} :tada:" release_tag="${new_version}" diff --git a/update/testing-appcast.xml b/update/testing-appcast.xml index 2f93d3fac..d5e679f5d 100644 --- a/update/testing-appcast.xml +++ b/update/testing-appcast.xml @@ -6,11 +6,11 @@ 小狼毫測試版 Appcast 更新頻道 zh - 小狼毫 0.16.1 + 小狼毫 0.16.2 http://rime.github.io/testing/weasel/release-notes.html - Thu, 06 Jun 2024 19:29:28 +0800 - Mon, 30 Sep 2024 11:51:10 +0800 + From 0c8bb0f01a929f46160482ae2f4492bed560b7b9 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 30 Sep 2024 12:52:21 +0800 Subject: [PATCH 32/35] fix: release channel feed_url not correct. --- WeaselServer/WeaselServer.rc | Bin 22800 -> 22800 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/WeaselServer/WeaselServer.rc b/WeaselServer/WeaselServer.rc index 1234e97d6cfec60f29bb30dc67e09ec01d498431..53fcadd45ddf3bd25a067c053c65aefe67d366fe 100644 GIT binary patch delta 17 ZcmbQRiE+Xv#tjBMlP$O&EEeGP0RTOK1~dQw delta 21 dcmbQRiE+Xv#tjBMlNAI~CePujSuDWo0{~cj2U`FD From 4af83b6e17f7c3cf78257dd300f4adadbffa1083 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 2 Oct 2024 23:35:33 +0800 Subject: [PATCH 33/35] ci: release and update testing appcast only in rime/weasel --- .github/workflows/release-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 47d6630f2..b1d03e224 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -103,7 +103,7 @@ jobs: # create stable release - name: Release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') + if: ${{ github.repository == 'rime/weasel' && startsWith(github.ref, 'refs/tags/') }} with: files: | ./output/archives/weasel*.exe @@ -111,6 +111,7 @@ jobs: body_path: ${{ github.workspace }}/RELEASE_CHANGELOG.md - name: Update testing Appcast + if: ${{ github.repository == 'rime/weasel' }} run: gh workflow run gh-pages.yml -R rime/home --ref master env: GH_TOKEN: ${{ secrets.ACTIONS_DEPLOY_KEY }} From 8770fb3ed1b4341b7875c1d60e98bfa5b42f8ac7 Mon Sep 17 00:00:00 2001 From: fxliang Date: Wed, 2 Oct 2024 23:13:06 +0800 Subject: [PATCH 34/35] chore: add update\bump-version.ps1 to bump version in powershell, when clog is not required --- update/bump-version.ps1 | 161 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 update/bump-version.ps1 diff --git a/update/bump-version.ps1 b/update/bump-version.ps1 new file mode 100644 index 000000000..9e0a5093b --- /dev/null +++ b/update/bump-version.ps1 @@ -0,0 +1,161 @@ +param( [string]$tag, [switch]$updatelog) +# -tag [new_tag], new tag shall be in format ^\d+\.\d+\.\d+$ and greater than +# the current one +# -updatelog update CHANGELOG.md if this switch used + +# get old version info from file, esp from build.bat +function get_old_version{ + param ([string]$filePath) + $fileContent = Get-Content -Path $filePath; + $version = @{}; + foreach ($line in $fileContent) { + if ($version["major"] -eq $null -and $line -match 'VERSION_MAJOR=(\d+)') { + $version["major"] = $matches[1]; + } + if ($version["minor"] -eq $null -and $line -match 'VERSION_MINOR=(\d+)') { + $version["minor"] = $matches[1]; + } + if ($version["patch"] -eq $null -and $line -match 'VERSION_PATCH=(\d+)') { + $version["patch"] = $matches[1]; + } + if ($version["major"] -ne $null -and $version["minor"] -ne $null -and $version["patch"] -ne $null) { + break; + } + } + $version['str'] = $version["major"] + "." + $version["minor"] + "." + $version["patch"]; + return $version; +} + +# parse new version info +function parse_new_version { + param([string]$new_version) + $version = @{}; + if ($new_version -match "^(\d+)\.(\d+)\.(\d+)$") { + $version['major'] = $matches[1]; + $version['minor'] = $matches[2]; + $version['patch'] = $matches[3]; + } + return $version; +} + +# update bat file with param filePath, and tags +function update_bat_file{ + param( [string]$filePath, $old_version, $new_version) + $old_major, $old_minor, $old_patch = $old_version['major'], $old_version["minor"], $old_version["patch"]; + $new_major, $new_minor, $new_patch = $new_version['major'], $new_version["minor"], $new_version["patch"]; + $fileContent = Get-Content -Path $filePath; + $fileContent = $fileContent -replace "VERSION_MAJOR=$old_major", "VERSION_MAJOR=$new_major"; + $fileContent = $fileContent -replace "VERSION_MINOR=$old_minor", "VERSION_MINOR=$new_minor"; + $fileContent = $fileContent -replace "VERSION_PATCH=$old_patch", "VERSION_PATCH=$new_patch"; + Set-Content -Path $filePath -Value $fileContent -Encoding UTF8; +} + +# update change log, work like clog-cli +function update_changelog { + param( [string]$new_tag, [string]$old_tag) + # get the current the previous release tag and current release tag + $tags = git tag --sort=creatordate | Select-String -Pattern '^\d+\.\d+\.\d+$' | ForEach-Object { $_.ToString() }; + $latestTag = $tags[-1]; + $commits = git log "$latestTag..HEAD" --pretty=format:"%s ([%an](https://github.com/rime/weasel/commit/%H))"; + # group commit logs + $groupedCommits = @{ + build = @(); ci = @(); fix = @(); feat = @(); docs = @(); style = @(); + refactor = @(); test = @(); chore = @(); commit = @(); + }; + $groupedTitle = @{ + build = "Builds"; + ci = "Continuous Integration"; + fix = "Bug Fixes"; + feat = "Features"; + docs = "Documents"; + style = "Code Style"; + refactor = "Code Refactor"; + test = "Tests"; + chore = "Chores"; + commit = "Commits"; + }; + foreach ($commit in $commits) { + if ($commit -match "^(build|ci|fix|feat|docs|style|refactor|test|chore):") { + $prefix = $matches[1]; + $groupedCommits[$prefix] += $commit; + } else { + $groupedCommits["commit"] += $commit; + } + } + $changelog = ""; + foreach ($group in $groupedCommits.Keys) { + if ($groupedCommits[$group].Count -gt 0) { + $changelog += "`n#### " + $groupedTitle[$group] + "`n" + foreach ($commit in $groupedCommits[$group]) { + $msg = $commit -replace "^" + $group + ":", ''; + $changelog += "* $msg`n"; + } + } + } + $currentDateTime = Get-Date -Format "yyyy-MM-dd"; + $fileContent = Get-Content -Path "CHANGELOG.md" -Raw -Encoding UTF8; + $contentAdd = "`n" ; + $contentAdd += "## [$new_tag](https://github.com/rime/weasel/compare/$old_tag...$new_tag)($currentDateTime)`n" ; + $contentAdd += $changelog; + Write-Host "`n" + $contentAdd + "`n" + $fileContent = $contentAdd + "`n" + $fileContent; + $fileContent | Out-File -FilePath "CHANGELOG.md" -Encoding UTF8; +} + +# update appcast file, with regex patterns +function update_appcast_file { + param( [string]$filePath, [string]$pat_orig, [string]$pat_replace) + $fileContent = Get-Content -Path $filePath; + $fileContent = $fileContent -replace $pat_orig, $pat_replace; + Set-Content -Path $filePath -Value $fileContent; +} +############################################################################### +# program now started +# tag name not match rule, exit +if (-not ($tag -match '^\d+\.\d+\.\d+$')) { + Write-Host "tag name not match rule '^\d+\.\d+\.\d+$'"; + Write-Host "please recheck it"; + exit; +} +# get old version +$old_version = get_old_version -filePath "build.bat"; +$old_major, $old_minor, $old_patch = $old_version['major'], $old_version["minor"], $old_version["patch"]; +# get new version +$new_version = parse_new_version -new_version $tag +# check new version is greater than the current one +if ($tag -eq $old_version["str"]) { + Write-Host "the new tag: $tag is the same with the old one:" $old_version["str"]; + exit; +} elseif ($tag -lt $old_version["str"]) { + Write-Host "$tag is older version than " $old_version['str']", please recheck your target version."; + exit; +} +Write-Host "bump version to $tag ... " +#get date-time string in english date-time format +$CurrentCulture = [System.Globalization.CultureInfo]::InvariantCulture +$currentDateTime = (Get-Date).ToString("ddd, dd MMM yyyy HH:mm:ss K", $CurrentCulture) + +#update appcast files +update_appcast_file -filePath "update/appcast.xml" -pat_orig "$old_major\.$old_minor\.$old_patch" -pat_replace $tag +update_appcast_file -filePath "update/appcast.xml" -pat_orig ".*?" -pat_replace "$currentDateTime" +Write-Host "update/appcast.xml updated" +update_appcast_file -filePath "update/testing-appcast.xml" -pat_orig "$old_major\.$old_minor\.$old_patch" -pat_replace $tag +update_appcast_file -filePath "update/testing-appcast.xml" -pat_orig ".*?" -pat_replace "$currentDateTime" +Write-Host "update/testing-appcast.xml updated" +#update bat files +update_bat_file -filePath "build.bat" -old_version $old_version -new_version $new_version +Write-Host "build.bat updated" +update_bat_file -filePath "xbuild.bat" -old_version $old_version -new_version $new_version +Write-Host "xbuild.bat updated" +#update CHANGELOG.md +if ($updatelog) { + update_changelog -new_tag $tag -old_tag "$old_major.$old_minor.$old_patch" + & git add CHANGELOG.md + Write-Host "CHANGELOG.md updated" +} +#commit changes and make a new tag +$release_message = "chore(release): $tag :tada:" +$release_tag = $tag +& git add update/*.xml build.bat xbuild.bat +& git commit --message $release_message +& git tag --annotate $release_tag --message $release_message From 3c70aedf9ff6288be82041c580ff7f00c7f8e6f1 Mon Sep 17 00:00:00 2001 From: fxliang Date: Fri, 4 Oct 2024 21:08:11 +0800 Subject: [PATCH 35/35] chore(release): 0.16.3 :tada: --- CHANGELOG.md | 15 ++ build.bat | 2 +- update/appcast.xml | 34 +-- update/testing-appcast.xml | 34 +-- xbuild.bat | 442 ++++++++++++++++++------------------- 5 files changed, 271 insertions(+), 256 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ba44241a..35a7e6c7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ + +## [0.16.3](https://github.com/rime/weasel/compare/0.16.2...0.16.3)(2024-10-04) + +#### Bug Fixes +* release channel feed_url not correct. ([fxliang](https://github.com/rime/weasel/commit/0c8bb0f01a929f46160482ae2f4492bed560b7b9)) +* invalid quick return ([Xuesong Peng](https://github.com/rime/weasel/commit/4da263727e16362f01054f6f0bb7522e83ae1e06)) + +#### Chores +* add update\bump-version.ps1 to bump version in powershell, when clog is not required ([fxliang](https://github.com/rime/weasel/commit/8770fb3ed1b4341b7875c1d60e98bfa5b42f8ac7)) +* update bump-version.sh, appcast.xml and testing-appcast.xml[skip ci] ([fxliang](https://github.com/rime/weasel/commit/91d5e4e224a0d73b8303a6ce10f03c71dace5cdd)) + +#### Continuous Integration +* release and update testing appcast only in rime/weasel ([fxliang](https://github.com/rime/weasel/commit/4af83b6e17f7c3cf78257dd300f4adadbffa1083)) + ## [0.16.2](https://github.com/rime/weasel/compare/0.16.1...0.16.2) (2024-09-28) @@ -1052,3 +1066,4 @@ * 以Python開發的實驗版本 * 獨創「拼寫運算」技術 * 預裝標調拼音、註音、粵拼、吳語等多種輸入方案 + diff --git a/build.bat b/build.bat index 11ab6453d..152d0de85 100644 --- a/build.bat +++ b/build.bat @@ -10,7 +10,7 @@ if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% if not defined VERSION_MAJOR set VERSION_MAJOR=0 if not defined VERSION_MINOR set VERSION_MINOR=16 -if not defined VERSION_PATCH set VERSION_PATCH=2 +if not defined VERSION_PATCH set VERSION_PATCH=3 if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% if not defined WEASEL_BUILD set WEASEL_BUILD=0 diff --git a/update/appcast.xml b/update/appcast.xml index f99ed05c5..380834301 100644 --- a/update/appcast.xml +++ b/update/appcast.xml @@ -1,17 +1,17 @@ - - - - 【小狼毫】輸入法更新頻道 - http://rime.github.io/release/weasel/appcast.xml - 小狼毫 Appcast 更新頻道 - zh - - 小狼毫 0.16.2 - http://rime.github.io/release/weasel/release-notes.html - Mon, 30 Sep 2024 11:51:10 +0800 - - - - + + + + 【小狼毫】輸入法更新頻道 + http://rime.github.io/release/weasel/appcast.xml + 小狼毫 Appcast 更新頻道 + zh + + 小狼毫 0.16.3 + http://rime.github.io/release/weasel/release-notes.html + Fri, 04 Oct 2024 21:08:10 +08:00 + + + + diff --git a/update/testing-appcast.xml b/update/testing-appcast.xml index d5e679f5d..546ef60b4 100644 --- a/update/testing-appcast.xml +++ b/update/testing-appcast.xml @@ -1,17 +1,17 @@ - - - - 【小狼毫】輸入法測試頻道 - http://rime.github.io/testing/weasel/appcast.xml - 小狼毫測試版 Appcast 更新頻道 - zh - - 小狼毫 0.16.2 - http://rime.github.io/testing/weasel/release-notes.html - Mon, 30 Sep 2024 11:51:10 +0800 - - - - + + + + 【小狼毫】輸入法測試頻道 + http://rime.github.io/testing/weasel/appcast.xml + 小狼毫測試版 Appcast 更新頻道 + zh + + 小狼毫 0.16.3 + http://rime.github.io/testing/weasel/release-notes.html + Fri, 04 Oct 2024 21:08:10 +08:00 + + + + diff --git a/xbuild.bat b/xbuild.bat index 9160df73a..943399c64 100644 --- a/xbuild.bat +++ b/xbuild.bat @@ -1,221 +1,221 @@ -@echo off -setlocal enabledelayedexpansion -if not defined include ( - echo You should run this inside Developer Command Promt! - exit /b -) -for %%a in ("%include:;=" "%") do ( - echo %%a| findstr /r "ATLMFC\\include" > nul - if not errorlevel 1 ( - set "atl_lib_dir=%%a" - set dpi_manifest=!atl_lib_dir:ATLMFC\include=Include\Manifest\PerMonitorHighDPIAware.manifest! - if not exist ".\PerMonitorHighDPIAware.manifest" ( - copy ""!dpi_manifest!"" .\ - ) - ) -) -rem --------------------------------------------------------------------------- -if not exist env.bat copy env.bat.template env.bat -if exist env.bat call env.bat -set PRODUCT_VERSION= -if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% -if not defined VERSION_MAJOR set VERSION_MAJOR=0 -if not defined VERSION_MINOR set VERSION_MINOR=16 -if not defined VERSION_PATCH set VERSION_PATCH=2 - -if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% -if not defined WEASEL_BUILD set WEASEL_BUILD=0 - -rem use numeric build version for release build -set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% -rem for non-release build, try to use git commit hash as product build version -if not defined RELEASE_BUILD ( - rem check if git is installed and available, then get the short commit id of head - git --version >nul 2>&1 - if not errorlevel 1 ( - for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "%WEASEL_VERSION%"') do ( - set LAST_TAG=%%i - goto found_tag - ) - :found_tag - for /f "delims=" %%i in ('git rev-list %LAST_TAG%..HEAD --count') do ( - set WEASEL_BUILD=%%i - ) - rem get short commmit id of head - for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%.%%i) - ) -) - -rem FILE_VERSION is always 4 numbers; same as PRODUCT_VERSION in release build -if not defined FILE_VERSION set FILE_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% -echo PRODUCT_VERSION=%PRODUCT_VERSION% -echo WEASEL_VERSION=%WEASEL_VERSION% -echo WEASEL_BUILD=%WEASEL_BUILD% -echo WEASEL_ROOT=%WEASEL_ROOT% -echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% -echo BOOST_ROOT=%BOOST_ROOT% - -if defined GITHUB_ENV ( - setlocal enabledelayedexpansion - echo git_ref_name=%PRODUCT_VERSION%>>!GITHUB_ENV! -) - -rem --------------------------------------------------------------------------- -rem parse the command line options -set build_config=release -set build_rebuild=0 -set build_boost=0 -set boost_build_variant=release -set build_data=0 -set build_opencc=0 -set build_rime=0 -set rime_build_variant=release -set build_weasel=0 -set build_installer=0 -set build_arm64=0 -set build_clean=0 -set build_commands=0 -:parse_cmdline_options - if "%1" == "" goto end_parsing_cmdline_options - if "%1" == "debug" ( - set build_config=debug - set boost_build_variant=debug - set rime_build_variant=debug - ) - if "%1" == "release" ( - set build_config=release - set boost_build_variant=release - set rime_build_variant=release - ) - if "%1" == "rebuild" set build_rebuild=1 - if "%1" == "boost" set build_boost=1 - if "%1" == "data" set build_data=1 - if "%1" == "opencc" set build_opencc=1 - if "%1" == "rime" set build_rime=1 - if "%1" == "librime" set build_rime=1 - if "%1" == "weasel" set build_weasel=1 - if "%1" == "installer" set build_installer=1 - if "%1" == "arm64" set build_arm64=1 - if "%1" == "clean" set build_clean=1 - if "%1" == "commands" set build_commands=1 - if "%1" == "all" ( - set build_boost=1 - set build_data=1 - set build_opencc=1 - set build_rime=1 - set build_weasel=1 - set build_installer=1 - set build_arm64=1 - set build_commands=1 - ) - shift - goto parse_cmdline_options -:end_parsing_cmdline_options - -if %build_weasel% == 0 ( -if %build_boost% == 0 ( -if %build_data% == 0 ( -if %build_opencc% == 0 ( -if %build_rime% == 0 ( -if %build_commands% == 0 ( - set build_weasel=1 -)))))) -rem -rem quit WeaselServer.exe before building -cd /d %WEASEL_ROOT% -if exist output\weaselserver.exe ( - output\weaselserver.exe /q -) - -rem build booost -if %build_boost% == 1 ( - if %build_arm64% == 1 ( - call build.bat boost arm64 - ) else ( - call build.bat boost - ) - if errorlevel 1 exit /b 1 - cd /d %WEASEL_ROOT% -) -if %build_rime% == 1 ( - call build.bat rime - if errorlevel 1 exit /b 1 - cd /d %WEASEL_ROOT% -) -if %build_data% == 1 ( - call build.bat data - if errorlevel 1 exit /b 1 - cd /d %WEASEL_ROOT% -) -if %build_opencc% == 1 ( - call build.bat opencc - if errorlevel 1 exit /b 1 - cd /d %WEASEL_ROOT% -) - -if %build_commands% == 1 ( - echo Generating compile_commands.json - xmake project -k compile_commands -m %build_config% -) - -rem if to clean -if %build_clean% == 1 ( goto clean ) -if %build_weasel% == 0 ( goto end ) - -if %build_arm64% == 1 ( - xmake f -a arm64 -m %build_config% - if %build_rebuild% == 1 ( xmake clean ) - xmake - if errorlevel 1 goto error - xmake f -a arm -m %build_config% - if %build_rebuild% == 1 ( xmake clean ) - xmake - if errorlevel 1 goto error -) -xmake f -a x64 -m %build_config% -if %build_rebuild% == 1 ( xmake clean ) -xmake -if errorlevel 1 goto error -xmake f -a x86 -m %build_config% -if %build_rebuild% == 1 ( xmake clean ) -xmake -if errorlevel 1 goto error - -if %build_arm64% == 1 ( - pushd arm64x_wrapper - call build.bat - if errorlevel 1 goto error - popd - - copy arm64x_wrapper\weaselARM64X.dll output - if errorlevel 1 goto error - copy arm64x_wrapper\weaselARM64X.ime output - if errorlevel 1 goto error -) -if %build_installer% == 1 ( - "%ProgramFiles(x86)%"\NSIS\Bin\makensis.exe ^ - /DWEASEL_VERSION=%WEASEL_VERSION% ^ - /DWEASEL_BUILD=%WEASEL_BUILD% ^ - /DPRODUCT_VERSION=%PRODUCT_VERSION% ^ - output\install.nsi - if errorlevel 1 goto error -) -goto end - -:clean - if exist build ( - rmdir /s /q build - if errorlevel 1 ( - echo error cleaning weasel build - goto error - ) - goto end - ) - -:error - echo error building weasel... - exit /b 1 - -:end - cd %WEASEL_ROOT% - +@echo off +setlocal enabledelayedexpansion +if not defined include ( + echo You should run this inside Developer Command Promt! + exit /b +) +for %%a in ("%include:;=" "%") do ( + echo %%a| findstr /r "ATLMFC\\include" > nul + if not errorlevel 1 ( + set "atl_lib_dir=%%a" + set dpi_manifest=!atl_lib_dir:ATLMFC\include=Include\Manifest\PerMonitorHighDPIAware.manifest! + if not exist ".\PerMonitorHighDPIAware.manifest" ( + copy ""!dpi_manifest!"" .\ + ) + ) +) +rem --------------------------------------------------------------------------- +if not exist env.bat copy env.bat.template env.bat +if exist env.bat call env.bat +set PRODUCT_VERSION= +if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% +if not defined VERSION_MAJOR set VERSION_MAJOR=0 +if not defined VERSION_MINOR set VERSION_MINOR=16 +if not defined VERSION_PATCH set VERSION_PATCH=3 + +if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH% +if not defined WEASEL_BUILD set WEASEL_BUILD=0 + +rem use numeric build version for release build +set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% +rem for non-release build, try to use git commit hash as product build version +if not defined RELEASE_BUILD ( + rem check if git is installed and available, then get the short commit id of head + git --version >nul 2>&1 + if not errorlevel 1 ( + for /f "delims=" %%i in ('git tag --sort=-creatordate ^| findstr /r "%WEASEL_VERSION%"') do ( + set LAST_TAG=%%i + goto found_tag + ) + :found_tag + for /f "delims=" %%i in ('git rev-list %LAST_TAG%..HEAD --count') do ( + set WEASEL_BUILD=%%i + ) + rem get short commmit id of head + for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%.%%i) + ) +) + +rem FILE_VERSION is always 4 numbers; same as PRODUCT_VERSION in release build +if not defined FILE_VERSION set FILE_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD% +echo PRODUCT_VERSION=%PRODUCT_VERSION% +echo WEASEL_VERSION=%WEASEL_VERSION% +echo WEASEL_BUILD=%WEASEL_BUILD% +echo WEASEL_ROOT=%WEASEL_ROOT% +echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% +echo BOOST_ROOT=%BOOST_ROOT% + +if defined GITHUB_ENV ( + setlocal enabledelayedexpansion + echo git_ref_name=%PRODUCT_VERSION%>>!GITHUB_ENV! +) + +rem --------------------------------------------------------------------------- +rem parse the command line options +set build_config=release +set build_rebuild=0 +set build_boost=0 +set boost_build_variant=release +set build_data=0 +set build_opencc=0 +set build_rime=0 +set rime_build_variant=release +set build_weasel=0 +set build_installer=0 +set build_arm64=0 +set build_clean=0 +set build_commands=0 +:parse_cmdline_options + if "%1" == "" goto end_parsing_cmdline_options + if "%1" == "debug" ( + set build_config=debug + set boost_build_variant=debug + set rime_build_variant=debug + ) + if "%1" == "release" ( + set build_config=release + set boost_build_variant=release + set rime_build_variant=release + ) + if "%1" == "rebuild" set build_rebuild=1 + if "%1" == "boost" set build_boost=1 + if "%1" == "data" set build_data=1 + if "%1" == "opencc" set build_opencc=1 + if "%1" == "rime" set build_rime=1 + if "%1" == "librime" set build_rime=1 + if "%1" == "weasel" set build_weasel=1 + if "%1" == "installer" set build_installer=1 + if "%1" == "arm64" set build_arm64=1 + if "%1" == "clean" set build_clean=1 + if "%1" == "commands" set build_commands=1 + if "%1" == "all" ( + set build_boost=1 + set build_data=1 + set build_opencc=1 + set build_rime=1 + set build_weasel=1 + set build_installer=1 + set build_arm64=1 + set build_commands=1 + ) + shift + goto parse_cmdline_options +:end_parsing_cmdline_options + +if %build_weasel% == 0 ( +if %build_boost% == 0 ( +if %build_data% == 0 ( +if %build_opencc% == 0 ( +if %build_rime% == 0 ( +if %build_commands% == 0 ( + set build_weasel=1 +)))))) +rem +rem quit WeaselServer.exe before building +cd /d %WEASEL_ROOT% +if exist output\weaselserver.exe ( + output\weaselserver.exe /q +) + +rem build booost +if %build_boost% == 1 ( + if %build_arm64% == 1 ( + call build.bat boost arm64 + ) else ( + call build.bat boost + ) + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_rime% == 1 ( + call build.bat rime + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_data% == 1 ( + call build.bat data + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) +if %build_opencc% == 1 ( + call build.bat opencc + if errorlevel 1 exit /b 1 + cd /d %WEASEL_ROOT% +) + +if %build_commands% == 1 ( + echo Generating compile_commands.json + xmake project -k compile_commands -m %build_config% +) + +rem if to clean +if %build_clean% == 1 ( goto clean ) +if %build_weasel% == 0 ( goto end ) + +if %build_arm64% == 1 ( + xmake f -a arm64 -m %build_config% + if %build_rebuild% == 1 ( xmake clean ) + xmake + if errorlevel 1 goto error + xmake f -a arm -m %build_config% + if %build_rebuild% == 1 ( xmake clean ) + xmake + if errorlevel 1 goto error +) +xmake f -a x64 -m %build_config% +if %build_rebuild% == 1 ( xmake clean ) +xmake +if errorlevel 1 goto error +xmake f -a x86 -m %build_config% +if %build_rebuild% == 1 ( xmake clean ) +xmake +if errorlevel 1 goto error + +if %build_arm64% == 1 ( + pushd arm64x_wrapper + call build.bat + if errorlevel 1 goto error + popd + + copy arm64x_wrapper\weaselARM64X.dll output + if errorlevel 1 goto error + copy arm64x_wrapper\weaselARM64X.ime output + if errorlevel 1 goto error +) +if %build_installer% == 1 ( + "%ProgramFiles(x86)%"\NSIS\Bin\makensis.exe ^ + /DWEASEL_VERSION=%WEASEL_VERSION% ^ + /DWEASEL_BUILD=%WEASEL_BUILD% ^ + /DPRODUCT_VERSION=%PRODUCT_VERSION% ^ + output\install.nsi + if errorlevel 1 goto error +) +goto end + +:clean + if exist build ( + rmdir /s /q build + if errorlevel 1 ( + echo error cleaning weasel build + goto error + ) + goto end + ) + +:error + echo error building weasel... + exit /b 1 + +:end + cd %WEASEL_ROOT% +