Skip to content

Commit

Permalink
Merge pull request #122 from Cryolitia-Forks/release
Browse files Browse the repository at this point in the history
rfct(crates/lang_unicodes): migrate to opencc-rust
  • Loading branch information
KonghaYao authored Dec 28, 2024
2 parents 9b8bdac + 912f5ad commit 86d44e2
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 152 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,6 @@ jobs:
sudo apt update
sudo apt install -y nodejs llvm clang pkg-config libssl-dev
${{ matrix.platform.setup }}
- name: Build Node
working-directory: ./crates/lang_unicodes
run: |
npm i
npm run build
- name: Set up Homebrew
id: set-up-homebrew
if: ${{ runner.os == 'macOS' }}
Expand All @@ -120,19 +113,19 @@ jobs:
with:
toolchain: stable

- name: BUILD PROTO
- name: BUILD PROTO & lang-unicodes
run: |
cargo build -p lang-unicodes
cargo build -p cn-font-proto
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: build
target: ${{ matrix.platform.target }}
args: '--locked --release -p ffi'
args: '--locked --release -p ffi --no-default-features'
strip: false
env:
CARGO_WITH_NO_EXTRA: 'True'
HARFBUZZ_SYS_NO_PKG_CONFIG: 'True'

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

- name: Build Node
working-directory: ./crates/lang_unicodes
run: |
npm i
npm run build
- name: Build
working-directory: ./packages/wasm-edge
run: |
Expand Down
120 changes: 120 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ license = "Apache-2.0"
[dependencies]
cn-font-utils = { version = "0.1.0", path = "crates/cn_font_utils" }
harfbuzz_rs_now = "2.2.6"
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes" }
lang-unicodes = { version = "0.1.0", path = "crates/lang_unicodes", default-features = false }
log = "0.4.22"
md5 = "0.7.0"
opentype = "0.38.1"
prost = "0.13.3"
cn-font-proto = { version = "0.1.1", path = "crates/proto" }
cn-font-proto = { version = "0.1.1", path = "crates/proto", default-features = false }
rayon = "1.10.0"
unicode-range = { version = "0.1.0", path = "crates/unicode_range" }
woff = "0.3.3"
Expand All @@ -27,11 +27,14 @@ chrono = "0.4.38"
[dev-dependencies]
env_logger = "0.11.5"


[build-dependencies]
cross = "0.2.5"
tonic-build = "0.12.3"

[features]
default = ["with_extra"]
with_extra = ["lang-unicodes/with_extra", "cn-font-proto/with_extra"]

[workspace]
members = [
"crates/cn_font_utils",
Expand Down
12 changes: 6 additions & 6 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ zig = false # do not use zig cc for the builds
context = "." # the context folder to build the script in. defaults to `.`

[build.env]
passthrough = ["CARGO_WITH_NO_EXTRA", "HARFBUZZ_SYS_NO_PKG_CONFIG"]
passthrough = ["HARFBUZZ_SYS_NO_PKG_CONFIG"]

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

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

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

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

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

[target.x86_64-pc-windows-msvc]
Expand Down
8 changes: 8 additions & 0 deletions crates/lang_unicodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ lazy_static = "1.5.0"

[lib]
path = "src/lib.rs"

[build-dependencies]
lazy_static = { version = "1.5.0", optional = true }
opencc-rs = { version = "0.4.7", optional = true }

[features]
default = [ "with_extra" ]
with_extra = ["lazy_static", "opencc-rs"]
186 changes: 160 additions & 26 deletions crates/lang_unicodes/build.rs

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions crates/lang_unicodes/package.json

This file was deleted.

52 changes: 0 additions & 52 deletions crates/lang_unicodes/scripts/cn_char_rank.mjs

This file was deleted.

8 changes: 0 additions & 8 deletions crates/lang_unicodes/scripts/hangul.mjs

This file was deleted.

6 changes: 3 additions & 3 deletions crates/lang_unicodes/src/cjk_unicodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ mod tests {
#[test]
fn test() {
assert_eq!(HIRAGANA_AND_KATAKANA.len(), 192);
assert_eq!(ZH_COMMON.len(), 4329);
assert_eq!(ZH_SC.len(), 2508);
assert_eq!(ZH_TC.len(), 2481);
assert_eq!(ZH_COMMON.len(), 4524);
assert_eq!(ZH_SC.len(), 2313);
assert_eq!(ZH_TC.len(), 2308);
assert_eq!(HANGUL_SYL.len(), 2026);
}
}
6 changes: 4 additions & 2 deletions crates/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ prost = "0.13.3"
prost-types = { version = "0.13.3", optional = true }

[features]
default = ["with_extra"]
server = ["tonic"]
with_extra = ["tonic-build"]

[build-dependencies]
tonic-build = "0.12.3"
tonic-build = { version = "0.12.3", optional = true }

[lib]
path = "src/lib/mod.rs"
path = "src/lib/mod.rs"
Loading

0 comments on commit 86d44e2

Please sign in to comment.