Skip to content

Commit 86d44e2

Browse files
authored
Merge pull request #122 from Cryolitia-Forks/release
rfct(crates/lang_unicodes): migrate to opencc-rust
2 parents 9b8bdac + 912f5ad commit 86d44e2

File tree

17 files changed

+338
-152
lines changed

17 files changed

+338
-152
lines changed

.github/workflows/cross-build.yml

+3-16
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,6 @@ jobs:
9191
sudo apt update
9292
sudo apt install -y nodejs llvm clang pkg-config libssl-dev
9393
${{ matrix.platform.setup }}
94-
95-
- name: Build Node
96-
working-directory: ./crates/lang_unicodes
97-
run: |
98-
npm i
99-
npm run build
100-
10194
- name: Set up Homebrew
10295
id: set-up-homebrew
10396
if: ${{ runner.os == 'macOS' }}
@@ -120,19 +113,19 @@ jobs:
120113
with:
121114
toolchain: stable
122115

123-
- name: BUILD PROTO
116+
- name: BUILD PROTO & lang-unicodes
124117
run: |
118+
cargo build -p lang-unicodes
125119
cargo build -p cn-font-proto
126120
127121
- name: Build binary
128122
uses: houseabsolute/actions-rust-cross@v0
129123
with:
130124
command: build
131125
target: ${{ matrix.platform.target }}
132-
args: '--locked --release -p ffi'
126+
args: '--locked --release -p ffi --no-default-features'
133127
strip: false
134128
env:
135-
CARGO_WITH_NO_EXTRA: 'True'
136129
HARFBUZZ_SYS_NO_PKG_CONFIG: 'True'
137130

138131
- name: Rename Package On Mac
@@ -186,12 +179,6 @@ jobs:
186179
- name: Update Rust
187180
run: /home/runner/.cargo/bin/rustup target add wasm32-wasip1
188181

189-
- name: Build Node
190-
working-directory: ./crates/lang_unicodes
191-
run: |
192-
npm i
193-
npm run build
194-
195182
- name: Build
196183
working-directory: ./packages/wasm-edge
197184
run: |

Cargo.lock

+120
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ license = "Apache-2.0"
1111
[dependencies]
1212
cn-font-utils = { version = "0.1.0", path = "crates/cn_font_utils" }
1313
harfbuzz_rs_now = "2.2.6"
14-
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes" }
14+
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes", default-features = false }
1515
log = "0.4.22"
1616
md5 = "0.7.0"
1717
opentype = "0.38.1"
1818
prost = "0.13.3"
19-
cn-font-proto = { version = "0.1.1", path = "crates/proto" }
19+
cn-font-proto = { version = "0.1.1", path = "crates/proto", default-features = false }
2020
rayon = "1.10.0"
2121
unicode-range = { version = "0.1.0", path = "crates/unicode_range" }
2222
woff = "0.3.3"
@@ -27,11 +27,14 @@ chrono = "0.4.38"
2727
[dev-dependencies]
2828
env_logger = "0.11.5"
2929

30-
3130
[build-dependencies]
3231
cross = "0.2.5"
3332
tonic-build = "0.12.3"
3433

34+
[features]
35+
default = ["with_extra"]
36+
with_extra = ["lang-unicodes/with_extra", "cn-font-proto/with_extra"]
37+
3538
[workspace]
3639
members = [
3740
"crates/cn_font_utils",

Cross.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,31 @@ zig = false # do not use zig cc for the builds
55
context = "." # the context folder to build the script in. defaults to `.`
66

77
[build.env]
8-
passthrough = ["CARGO_WITH_NO_EXTRA", "HARFBUZZ_SYS_NO_PKG_CONFIG"]
8+
passthrough = ["HARFBUZZ_SYS_NO_PKG_CONFIG"]
99

1010
[target.aarch64-unknown-linux-gnu]
1111
pre-build = [
12-
"apt update && apt install -y nodejs llvm clang pkg-config libssl-dev",
12+
"apt update && apt install -y llvm clang pkg-config libssl-dev",
1313
]
1414

1515
[target.x86_64-unknown-linux-gnu]
1616
pre-build = [
17-
"apt update && apt install -y nodejs llvm clang pkg-config libssl-dev",
17+
"apt update && apt install -y llvm clang pkg-config libssl-dev",
1818
]
1919

2020
[target.x86_64-unknown-linux-musl]
2121
pre-build = [
22-
"apt update && apt install -y nodejs llvm clang pkg-config libssl-dev",
22+
"apt update && apt install -y llvm clang pkg-config libssl-dev",
2323
]
2424

2525
[target.aarch64-unknown-linux-musl]
2626
pre-build = [
27-
"apt update && apt install -y nodejs llvm clang pkg-config libssl-dev",
27+
"apt update && apt install -y llvm clang pkg-config libssl-dev",
2828
]
2929

3030
[target.riscv64gc-unknown-linux-gnu]
3131
pre-build = [
32-
"apt update && apt install -y nodejs llvm clang pkg-config libssl-dev",
32+
"apt update && apt install -y llvm clang pkg-config libssl-dev",
3333
]
3434

3535
[target.x86_64-pc-windows-msvc]

crates/lang_unicodes/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ lazy_static = "1.5.0"
1414

1515
[lib]
1616
path = "src/lib.rs"
17+
18+
[build-dependencies]
19+
lazy_static = { version = "1.5.0", optional = true }
20+
opencc-rs = { version = "0.4.7", optional = true }
21+
22+
[features]
23+
default = [ "with_extra" ]
24+
with_extra = ["lazy_static", "opencc-rs"]

crates/lang_unicodes/build.rs

+160-26
Large diffs are not rendered by default.

crates/lang_unicodes/package.json

-16
This file was deleted.

crates/lang_unicodes/scripts/cn_char_rank.mjs

-52
This file was deleted.

crates/lang_unicodes/scripts/hangul.mjs

-8
This file was deleted.

crates/lang_unicodes/src/cjk_unicodes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ mod tests {
7272
#[test]
7373
fn test() {
7474
assert_eq!(HIRAGANA_AND_KATAKANA.len(), 192);
75-
assert_eq!(ZH_COMMON.len(), 4329);
76-
assert_eq!(ZH_SC.len(), 2508);
77-
assert_eq!(ZH_TC.len(), 2481);
75+
assert_eq!(ZH_COMMON.len(), 4524);
76+
assert_eq!(ZH_SC.len(), 2313);
77+
assert_eq!(ZH_TC.len(), 2308);
7878
assert_eq!(HANGUL_SYL.len(), 2026);
7979
}
8080
}

crates/proto/Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ prost = "0.13.3"
1515
prost-types = { version = "0.13.3", optional = true }
1616

1717
[features]
18+
default = ["with_extra"]
1819
server = ["tonic"]
20+
with_extra = ["tonic-build"]
1921

2022
[build-dependencies]
21-
tonic-build = "0.12.3"
23+
tonic-build = { version = "0.12.3", optional = true }
2224

2325
[lib]
24-
path = "src/lib/mod.rs"
26+
path = "src/lib/mod.rs"

0 commit comments

Comments
 (0)