Skip to content

Commit ce4f761

Browse files
authored
Migrate code to Swift (#898)
## Major Update * Migrated code to pure Swift, which is easier to maintain, read and contribute. Build your own Squirrel today! ## Other Updates * `style/candidate_format` now updated to `"[index]. [candidate] [comment]"`, while the old format still works, please migrate to this more readable and flexible format at your convenience * `style/horizontal` will be dropped, it's still supported but will be overwrite by the default values of new options. Please adopt `candidate_list_layout`: `stacked`/`linear` and `text_orientation`: `horizontal`/`vertical` * `style/label_hilited_color` is removed, please use `hilited_candidate_label_color` instead * Added a menu item for logs folder for quick access * labels will vertically center if label font is smaller than candidate font, better matches macOS builtin IME * `native` color scheme is updated with smaller font size, better matches macOS builtin IME * Added `--help` command line argument * Bug fixes: * Occasionally, press <kbd>⇧</kbd> to enter Cap case may switch ascii mode
1 parent 16e67cd commit ce4f761

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3748
-4852
lines changed

.github/workflows/release-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
if: startsWith(github.ref, 'refs/tags/')
4141
uses: ncipollo/release-action@v1
4242
with:
43-
artifacts: "package/*.zip"
43+
artifacts: "package/Squirrel-*.pkg"
4444
body: |
4545
${{ steps.release_log.outputs.changelog }}
4646
draft: true
@@ -55,4 +55,4 @@ jobs:
5555
prerelease: true
5656
title: "Nightly build"
5757
files: |
58-
package/*.zip
58+
package/Squirrel-*.pkg

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ lib/*
1010
data/opencc/
1111
data/plum/
1212
download/
13-
package/Squirrel.pkg
13+
package/Squirrel*.pkg
1414
package/sign/*.pem
1515
package/test-*
16+
package/sign_update
17+
package/*.xml
1618
*~
1719
.*.swp
1820
.DS_Store

Base.lproj/MainMenu.xib

-60
This file was deleted.

INSTALL.md

+33-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Prerequisites
88

9-
Install **Xcode 14.0 or above from App Store, to build Squirrel as a Universal
9+
Install **Xcode 14.0** or above from App Store, to build Squirrel as a Universal
1010
app.
1111

1212
Install **cmake**.
@@ -39,7 +39,7 @@ Optionally, checkout Rime plugins (a list of GitHub repo slugs):
3939
bash librime/install-plugins.sh rime/librime-sample # ...
4040
```
4141

42-
Popular plugins include [librime-lua](https://github.com/hchunhui/librime-lua) and [librime-octagram](https://github.com/lotem/librime-octagram)
42+
Popular plugins include [librime-lua](https://github.com/hchunhui/librime-lua), [librime-octagram](https://github.com/lotem/librime-octagram) and [librime-predict](https://github.com/rime/librime-predict)
4343

4444
### Shortcut: get the latest librime release
4545

@@ -100,20 +100,28 @@ port install boost -no_static
100100
git submodule update --init --recursive
101101
```
102102

103+
* There are a few environmental variables that you can define. Here's a list and possible values they may take:
104+
105+
``` sh
106+
export BOOST_ROOT="path_to_boost" # required
107+
export DEV_ID="Your Apple ID name" # include this to codesign, optional
108+
export BUILD_UNIVERSAL=1 # set to build universal binary
109+
export PLUM_TAG=":preset” # or ":extra", optional, build with a set of plum formulae
110+
export ARCHS='arm64 x86_64' # optional, if not defined, only active arch is used
111+
export MACOSX_DEPLOYMENT_TARGET='13.0' # optional, lower version than 13.0 is not tested and may not work properly
112+
```
113+
103114
* With all dependencies ready, build `Squirrel.app`:
104115
105116
``` sh
106117
make
107118
```
108119
109-
To build only for the native architecture, and/or specify the lowest supported macOS version, pass variable `ARCHS` and/or `MACOSX_DEPLOYMENT_TARGET` to `make`:
120+
* You can either define the environment variables in your shell/terminal, or append them as arguments to the make command. For example:
110121
111122
``` sh
112123
# for Universal macOS App
113-
make ARCHS='arm64 x86_64'
114-
115-
# for ARM macOS App
116-
make ARCHS='arm64'
124+
make ARCHS='arm64 x86_64' BUILD_UNIVERSAL=1
117125
```
118126
119127
## Install it on your Mac
@@ -126,7 +134,7 @@ Just add `package` after `make`
126134
make package ARCHS='arm64'
127135
```
128136
129-
Define or echo `DEV_ID` to automatically handle code signing and [notarization](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) (Apple Developer ID needed)
137+
Define `DEV_ID` to automatically handle code signing and [notarization](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) (Apple Developer ID needed)
130138
131139
To make this work, you need a `Developer ID Installer: (your name/org)` and set your name/org as `DEV_ID` env variable.
132140
@@ -147,9 +155,24 @@ Once built, you can install and try it live on your Mac computer:
147155
``` sh
148156
# Squirrel as a Universal app
149157
make install
158+
```
159+
160+
## Clean Up Artifacts
161+
162+
After installation or after a failed attempt, you may want to start over. Before you do so, **make sure you have cleaned up artifacts from previous build.**
150163
151-
# for Intel-based Mac only
152-
make ARCHS='x86_64' install
164+
To clean **Squirrel** artifacts, without touching dependencies, run:
165+
166+
``` sh
167+
make clean
153168
```
154169
170+
To clean up **dependencies**, including librime, librime plugins, plum and sparkle, run:
171+
172+
``` sh
173+
make clean-deps
174+
```
175+
176+
If you want to clean both, do both.
177+
155178
That's it, a verbal journal. Thanks for riming with Squirrel.

Makefile

+10-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ DEPS_CHECK = $(RIME_LIBRARY) $(PLUM_DATA) $(OPENCC_DATA) $(SPARKLE_FRAMEWORK)
2525

2626
OPENCC_DATA_OUTPUT = librime/share/opencc/*.*
2727
PLUM_DATA_OUTPUT = plum/output/*.*
28+
PLUM_OPENCC_OUTPUT = plum/output/opencc/*.*
2829
RIME_PACKAGE_INSTALLER = plum/rime-install
2930

3031
INSTALL_NAME_TOOL = $(shell xcrun -find install_name_tool)
@@ -62,6 +63,9 @@ $(OPENCC_DATA):
6263

6364
plum-data:
6465
$(MAKE) -C plum
66+
ifdef PLUM_TAG
67+
rime_dir=plum/output bash plum/rime-install $(PLUM_TAG)
68+
endif
6569
$(MAKE) copy-plum-data
6670

6771
opencc-data:
@@ -76,6 +80,7 @@ copy-plum-data:
7680
copy-opencc-data:
7781
mkdir -p data/opencc
7882
cp $(OPENCC_DATA_OUTPUT) data/opencc/
83+
cp $(PLUM_OPENCC_OUTPUT) data/opencc/ > /dev/null 2>&1 || true
7984

8085
deps: librime data
8186

@@ -112,21 +117,23 @@ $(SPARKLE_FRAMEWORK):
112117

113118
sparkle:
114119
xcodebuild -project Sparkle/Sparkle.xcodeproj -configuration Release $(BUILD_SETTINGS) build
120+
xcodebuild -project Sparkle/Sparkle.xcodeproj -scheme sign_update -configuration Release -derivedDataPath Sparkle/build $(BUILD_SETTINGS) build
115121
$(MAKE) copy-sparkle-framework
116122

117123
copy-sparkle-framework:
118124
mkdir -p Frameworks
119125
cp -RP Sparkle/build/Release/Sparkle.framework Frameworks/
126+
cp Sparkle/build/Build/Products/Release/sign_update package/
120127

121128
clean-sparkle:
122129
rm -rf Frameworks/* > /dev/null 2>&1 || true
123130
rm -rf Sparkle/build > /dev/null 2>&1 || true
124131

125-
.PHONY: package archive sign-archive
132+
.PHONY: package archive
126133

127134
package: release
128135
ifdef DEV_ID
129-
package/sign.bash $(DEV_ID)
136+
bash package/sign_app $(DEV_ID)
130137
endif
131138
bash package/make_package
132139
ifdef DEV_ID
@@ -140,10 +147,6 @@ endif
140147
archive: package
141148
bash package/make_archive
142149

143-
sign-archive:
144-
[ -n "${checksum}" ] || (echo >&2 'ERROR: $$checksum not specified.'; false)
145-
sign_key=sign/dsa_priv.pem bash package/make_archive
146-
147150
DSTROOT = /Library/Input Methods
148151
SQUIRREL_APP_ROOT = $(DSTROOT)/Squirrel.app
149152

@@ -176,4 +179,5 @@ clean:
176179
clean-deps:
177180
$(MAKE) -C plum clean
178181
$(MAKE) -C librime clean
182+
rm -rf librime/dist > /dev/null 2>&1 || true
179183
$(MAKE) clean-sparkle

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
【鼠鬚管】輸入法
1212
===
1313
[![Download](https://img.shields.io/github/v/release/rime/squirrel)](https://github.com/rime/squirrel/releases/latest)
14-
[![Build Status](https://travis-ci.org/rime/squirrel.svg)](https://travis-ci.org/rime/squirrel)
14+
[![Build Status](https://github.com/rime/squirrel/actions/workflows/commit-ci.yml/badge.svg)](https://github.com/rime/squirrel/actions/workflows)
1515
[![GitHub Tag](https://img.shields.io/github/tag/rime/squirrel.svg)](https://github.com/rime/squirrel)
1616

1717
式恕堂 版權所無
@@ -22,7 +22,7 @@
2222

2323
您可能還需要 Rime 用於其他操作系統的發行版:
2424

25-
* ibus-rimefcitx-rime 用於 Linux
25+
* 【中州韻】(ibus-rimefcitx-rime用於 Linux
2626
* 【小狼毫】用於 Windows
2727

2828
安裝輸入法
@@ -99,8 +99,7 @@
9999
問題與反饋
100100
---
101101

102-
發現程序有 BUG,或建議,或感想,請反饋到
103-
https://github.com/rime/home/issues
102+
發現程序有 BUG,或建議,或感想,請反饋到 [Rime 代碼之家討論區](https://github.com/rime/home/discussions)
104103

105104
聯繫方式
106105
---

Squirrel.entitlements

-23
This file was deleted.

0 commit comments

Comments
 (0)