Skip to content

Commit

Permalink
Migrate code to Swift (#898)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
LEOYoon-Tsaw authored May 24, 2024
1 parent 16e67cd commit ce4f761
Show file tree
Hide file tree
Showing 57 changed files with 3,748 additions and 4,852 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: "package/*.zip"
artifacts: "package/Squirrel-*.pkg"
body: |
${{ steps.release_log.outputs.changelog }}
draft: true
Expand All @@ -55,4 +55,4 @@ jobs:
prerelease: true
title: "Nightly build"
files: |
package/*.zip
package/Squirrel-*.pkg
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ lib/*
data/opencc/
data/plum/
download/
package/Squirrel.pkg
package/Squirrel*.pkg
package/sign/*.pem
package/test-*
package/sign_update
package/*.xml
*~
.*.swp
.DS_Store
60 changes: 0 additions & 60 deletions Base.lproj/MainMenu.xib

This file was deleted.

43 changes: 33 additions & 10 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Prerequisites

Install **Xcode 14.0 or above from App Store, to build Squirrel as a Universal
Install **Xcode 14.0** or above from App Store, to build Squirrel as a Universal
app.

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

Popular plugins include [librime-lua](https://github.com/hchunhui/librime-lua) and [librime-octagram](https://github.com/lotem/librime-octagram)
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)

### Shortcut: get the latest librime release

Expand Down Expand Up @@ -100,20 +100,28 @@ port install boost -no_static
git submodule update --init --recursive
```

* There are a few environmental variables that you can define. Here's a list and possible values they may take:

``` sh
export BOOST_ROOT="path_to_boost" # required
export DEV_ID="Your Apple ID name" # include this to codesign, optional
export BUILD_UNIVERSAL=1 # set to build universal binary
export PLUM_TAG=":preset” # or ":extra", optional, build with a set of plum formulae
export ARCHS='arm64 x86_64' # optional, if not defined, only active arch is used
export MACOSX_DEPLOYMENT_TARGET='13.0' # optional, lower version than 13.0 is not tested and may not work properly
```
* With all dependencies ready, build `Squirrel.app`:
``` sh
make
```
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`:
* You can either define the environment variables in your shell/terminal, or append them as arguments to the make command. For example:
``` sh
# for Universal macOS App
make ARCHS='arm64 x86_64'

# for ARM macOS App
make ARCHS='arm64'
make ARCHS='arm64 x86_64' BUILD_UNIVERSAL=1
```
## Install it on your Mac
Expand All @@ -126,7 +134,7 @@ Just add `package` after `make`
make package ARCHS='arm64'
```
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)
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)
To make this work, you need a `Developer ID Installer: (your name/org)` and set your name/org as `DEV_ID` env variable.
Expand All @@ -147,9 +155,24 @@ Once built, you can install and try it live on your Mac computer:
``` sh
# Squirrel as a Universal app
make install
```
## Clean Up Artifacts
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.**
# for Intel-based Mac only
make ARCHS='x86_64' install
To clean **Squirrel** artifacts, without touching dependencies, run:
``` sh
make clean
```
To clean up **dependencies**, including librime, librime plugins, plum and sparkle, run:
``` sh
make clean-deps
```
If you want to clean both, do both.
That's it, a verbal journal. Thanks for riming with Squirrel.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ DEPS_CHECK = $(RIME_LIBRARY) $(PLUM_DATA) $(OPENCC_DATA) $(SPARKLE_FRAMEWORK)

OPENCC_DATA_OUTPUT = librime/share/opencc/*.*
PLUM_DATA_OUTPUT = plum/output/*.*
PLUM_OPENCC_OUTPUT = plum/output/opencc/*.*
RIME_PACKAGE_INSTALLER = plum/rime-install

INSTALL_NAME_TOOL = $(shell xcrun -find install_name_tool)
Expand Down Expand Up @@ -62,6 +63,9 @@ $(OPENCC_DATA):

plum-data:
$(MAKE) -C plum
ifdef PLUM_TAG
rime_dir=plum/output bash plum/rime-install $(PLUM_TAG)
endif
$(MAKE) copy-plum-data

opencc-data:
Expand All @@ -76,6 +80,7 @@ copy-plum-data:
copy-opencc-data:
mkdir -p data/opencc
cp $(OPENCC_DATA_OUTPUT) data/opencc/
cp $(PLUM_OPENCC_OUTPUT) data/opencc/ > /dev/null 2>&1 || true

deps: librime data

Expand Down Expand Up @@ -112,21 +117,23 @@ $(SPARKLE_FRAMEWORK):

sparkle:
xcodebuild -project Sparkle/Sparkle.xcodeproj -configuration Release $(BUILD_SETTINGS) build
xcodebuild -project Sparkle/Sparkle.xcodeproj -scheme sign_update -configuration Release -derivedDataPath Sparkle/build $(BUILD_SETTINGS) build
$(MAKE) copy-sparkle-framework

copy-sparkle-framework:
mkdir -p Frameworks
cp -RP Sparkle/build/Release/Sparkle.framework Frameworks/
cp Sparkle/build/Build/Products/Release/sign_update package/

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

.PHONY: package archive sign-archive
.PHONY: package archive

package: release
ifdef DEV_ID
package/sign.bash $(DEV_ID)
bash package/sign_app $(DEV_ID)
endif
bash package/make_package
ifdef DEV_ID
Expand All @@ -140,10 +147,6 @@ endif
archive: package
bash package/make_archive

sign-archive:
[ -n "${checksum}" ] || (echo >&2 'ERROR: $$checksum not specified.'; false)
sign_key=sign/dsa_priv.pem bash package/make_archive

DSTROOT = /Library/Input Methods
SQUIRREL_APP_ROOT = $(DSTROOT)/Squirrel.app

Expand Down Expand Up @@ -176,4 +179,5 @@ clean:
clean-deps:
$(MAKE) -C plum clean
$(MAKE) -C librime clean
rm -rf librime/dist > /dev/null 2>&1 || true
$(MAKE) clean-sparkle
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
【鼠鬚管】輸入法
===
[![Download](https://img.shields.io/github/v/release/rime/squirrel)](https://github.com/rime/squirrel/releases/latest)
[![Build Status](https://travis-ci.org/rime/squirrel.svg)](https://travis-ci.org/rime/squirrel)
[![Build Status](https://github.com/rime/squirrel/actions/workflows/commit-ci.yml/badge.svg)](https://github.com/rime/squirrel/actions/workflows)
[![GitHub Tag](https://img.shields.io/github/tag/rime/squirrel.svg)](https://github.com/rime/squirrel)

式恕堂 版權所無
Expand All @@ -22,7 +22,7 @@

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

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

安裝輸入法
Expand Down Expand Up @@ -99,8 +99,7 @@
問題與反饋
---

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

聯繫方式
---
Expand Down
23 changes: 0 additions & 23 deletions Squirrel.entitlements

This file was deleted.

Loading

0 comments on commit ce4f761

Please sign in to comment.