Skip to content

Commit

Permalink
Merge branch 'rime:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alpzmj9 authored Oct 6, 2024
2 parents 87c38cc + 3c70aed commit aeea6b1
Show file tree
Hide file tree
Showing 36 changed files with 999 additions and 114 deletions.
119 changes: 101 additions & 18 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,54 @@ on:
pull_request:

jobs:
lint:
runs-on: windows-2019
steps:
- name: Checkout last commit
uses: actions/checkout@v4
- 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
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: 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
submodules: true
fetch-depth: 0

- name: Code style lint
shell: bash
run: ./clang-format.sh -i
- name: Fetch all tags
run: git fetch --tags

- name: Configure build environment
shell: bash
Expand All @@ -54,19 +77,16 @@ 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
run: |
./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
Expand All @@ -93,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
14 changes: 12 additions & 2 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ jobs:
- name: Checkout last commit
uses: actions/checkout@v4
with:
submodules: recursive
submodules: true
fetch-depth: 0

- name: Fetch all tags
if: github.ref == 'refs/heads/master'
run: git fetch --tags

- name: Configure build environment
shell: bash
Expand Down Expand Up @@ -98,10 +103,15 @@ 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
./output/archives/debug_symbols.7z
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 }}
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
<a name="0.16.3"></a>
## [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))

<a name="0.16.2"></a>
## [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警告


<a name="0.16.1"></a>
## [0.16.1](https://github.com/rime/weasel/compare/0.16.0...0.16.1) (2024-06-06)

Expand Down Expand Up @@ -1015,3 +1066,4 @@
* 以Python開發的實驗版本
* 獨創「拼寫運算」技術
* 預裝標調拼音、註音、粵拼、吳語等多種輸入方案

5 changes: 5 additions & 0 deletions RimeWithWeasel/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target("RimeWithWeasel")
set_kind("static")
add_files("./*.cpp")
add_rules("use_weaselconstants")

4 changes: 2 additions & 2 deletions WeaselDeployer/SwitcherSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ LRESULT SwitcherSettingsDialog::OnOK(WORD, WORD code, HWND, BOOL&) {

LRESULT SwitcherSettingsDialog::OnSchemaListItemChanged(int, LPNMHDR p, BOOL&) {
LPNMLISTVIEW lv = reinterpret_cast<LPNMLISTVIEW>(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)) {
Expand Down
24 changes: 24 additions & 0 deletions WeaselDeployer/xmake.lua
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions WeaselIME/WeaselIME.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,41 +117,49 @@
<LinkIncremental>true</LinkIncremental>
<TargetName>weasel</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>weasel</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<LinkIncremental>true</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<LinkIncremental>false</LinkIncremental>
<TargetName>weasel$(Platform)</TargetName>
<TargetExt>.ime</TargetExt>
<OutDir>$(SolutionDir)output\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down
30 changes: 30 additions & 0 deletions WeaselIME/xmake.lua
Original file line number Diff line number Diff line change
@@ -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)

15 changes: 1 addition & 14 deletions WeaselIPC/WeaselClientImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "stdafx.h"
#include "WeaselClientImpl.h"
#include <StringAlgorithm.hpp>
#include <future>
#include <chrono>

using namespace weasel;

Expand Down Expand Up @@ -197,18 +195,7 @@ 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();
}
return channel.Transact(req);
} catch (DWORD /* ex */) {
return 0;
}
Expand Down
Loading

0 comments on commit aeea6b1

Please sign in to comment.