Skip to content

Commit 3d5c591

Browse files
committed
build: 更新工作区配置和依赖项
重构 Cargo.toml 文件,更新工作区成员路径和默认成员配置 添加新的工作区依赖项,包括异步运行时和序列化库 引入 Oak 解析器相关依赖项
1 parent cfbd5d8 commit 3d5c591

145 files changed

Lines changed: 9562 additions & 17309 deletions

File tree

Some content is hidden

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

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
charset = utf-8
33

44

5-
[*.pest]
5+
[*.json]
66
indent_style = space
77
indent_size = 4
88

.github/workflows/release.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI & Release
2+
3+
on:
4+
push:
5+
branches: [ master, dev ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ master, dev ]
9+
10+
jobs:
11+
check:
12+
name: Check (Lint & Fmt)
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Install Rust
17+
uses: dtolnay/rust-toolchain@stable
18+
with:
19+
components: rustfmt, clippy
20+
- name: Rust Cache
21+
uses: Swatinem/rust-cache@v2
22+
- name: Format check
23+
run: cargo fmt --all -- --check
24+
- name: Clippy check
25+
run: cargo clippy --all-targets --all-features -- -D warnings
26+
27+
build-rs:
28+
name: Build Rust (${{ matrix.target }})
29+
needs: [check]
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- os: ubuntu-latest
36+
target: x86_64-unknown-linux-gnu
37+
pkg_dir: rbq-linux-x64
38+
bin_name: rbq
39+
- os: ubuntu-latest
40+
target: aarch64-unknown-linux-gnu
41+
pkg_dir: rbq-linux-arm64
42+
bin_name: rbq
43+
- os: macos-latest
44+
target: x86_64-apple-darwin
45+
pkg_dir: rbq-darwin-x64
46+
bin_name: rbq
47+
- os: macos-latest
48+
target: aarch64-apple-darwin
49+
pkg_dir: rbq-darwin-arm64
50+
bin_name: rbq
51+
- os: windows-latest
52+
target: x86_64-pc-windows-msvc
53+
pkg_dir: rbq-win32-x64
54+
bin_name: rbq.exe
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Install Rust
60+
uses: dtolnay/rust-toolchain@stable
61+
with:
62+
targets: ${{ matrix.target }}
63+
64+
- name: Rust Cache
65+
uses: Swatinem/rust-cache@v2
66+
with:
67+
key: ${{ matrix.target }}
68+
69+
- name: Install cross (for linux arm64)
70+
if: matrix.target == 'aarch64-unknown-linux-gnu'
71+
run: cargo install cross
72+
73+
- name: Build binary
74+
run: |
75+
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
76+
cross build --release --target ${{ matrix.target }} -p rbq-tools
77+
else
78+
cargo build --release --target ${{ matrix.target }} -p rbq-tools
79+
fi
80+
shell: bash
81+
82+
- name: Copy binary to output directory
83+
run: |
84+
mkdir -p releases/${{ matrix.pkg_dir }}/bin
85+
cp target/${{ matrix.target }}/release/${{ matrix.bin_name }} releases/${{ matrix.pkg_dir }}/bin/
86+
shell: bash
87+
88+
- name: Upload artifact
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: ${{ matrix.pkg_dir }}
92+
path: releases/${{ matrix.pkg_dir }}
93+
94+
test:
95+
name: Tests
96+
needs: [build-rs]
97+
runs-on: ubuntu-latest
98+
steps:
99+
- uses: actions/checkout@v4
100+
- name: Install Rust
101+
uses: dtolnay/rust-toolchain@stable
102+
- name: Rust Cache
103+
uses: Swatinem/rust-cache@v2
104+
- name: Build
105+
run: cargo build --all-targets --all-features
106+
- name: Run tests
107+
run: cargo test --all-targets --all-features
108+
109+
release:
110+
name: Release (Publish to NPM & JSR)
111+
needs: [test]
112+
runs-on: ubuntu-latest
113+
if: startsWith(github.ref, 'refs/tags/v')
114+
steps:
115+
- uses: actions/checkout@v4
116+
117+
- name: Download Rust artifacts
118+
uses: actions/download-artifact@v4
119+
with:
120+
path: npm-packages
121+
122+
- name: Setup Node
123+
uses: actions/setup-node@v4
124+
with:
125+
node-version: '20'
126+
registry-url: 'https://registry.npmjs.org'
127+
cache: 'npm'
128+
129+
- name: Build TS & Publish (Dry Run)
130+
run: |
131+
npm install -g typescript
132+
node scripts/publish.js ts --dry-run
133+
env:
134+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
135+
JSR_URL: https://jsr.io

.github/workflows/rust.yml

Lines changed: 115 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,125 @@
1-
name: Rust
1+
name: CI
22

33
on:
44
push:
5-
branches: [ master, dev ]
5+
branches: [master, dev]
66
pull_request:
7-
branches: [ master, dev ]
7+
branches: [master, dev]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
812

913
jobs:
10-
build:
11-
runs-on: ${{ matrix.os }}
14+
rust-check:
15+
name: Rust Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install Rust toolchain
22+
uses: dtolnay/rust-toolchain@nightly
23+
with:
24+
components: rustfmt, clippy
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.cargo/registry
31+
~/.cargo/git
32+
target
33+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-cargo-
36+
37+
- name: Check formatting
38+
run: cargo fmt --all -- --check
39+
40+
- name: Run clippy
41+
run: cargo clippy --all-targets --all-features -- -D warnings
42+
43+
- name: Check compilation
44+
run: cargo check --all-targets --all-features
45+
46+
rust-test:
47+
name: Rust Test
1248
strategy:
49+
fail-fast: false
1350
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
51+
os: [ubuntu-latest, windows-latest, macos-latest]
52+
feature: [no-default, default, all]
53+
runs-on: ${{ matrix.os }}
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v4
57+
58+
- name: Install Rust toolchain
59+
uses: dtolnay/rust-toolchain@nightly
60+
61+
- name: Cache cargo registry
62+
uses: actions/cache@v4
63+
with:
64+
path: |
65+
~/.cargo/registry
66+
~/.cargo/git
67+
target
68+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
restore-keys: |
70+
${{ runner.os }}-cargo-
71+
72+
- name: Run tests (no-default features)
73+
if: matrix.feature == 'no-default'
74+
run: cargo test --workspace --no-default-features
75+
76+
- name: Run tests (default features)
77+
if: matrix.feature == 'default'
78+
run: cargo test --workspace
79+
80+
- name: Run tests (all features)
81+
if: matrix.feature == 'all'
82+
run: cargo test --workspace --all-features
83+
84+
js-check:
85+
name: JavaScript/TypeScript Check
86+
runs-on: ubuntu-latest
1587
steps:
16-
- run: git config --global core.autocrlf false
17-
- uses: actions/checkout@v2
18-
- name: Rust Nightly
19-
uses: actions-rs/toolchain@v1
88+
- name: Checkout repository
89+
uses: actions/checkout@v4
90+
91+
- name: Setup Node.js
92+
uses: actions/setup-node@v4
93+
with:
94+
node-version: "20"
95+
96+
- name: Install pnpm
97+
uses: pnpm/action-setup@v4
2098
with:
21-
toolchain: nightly
22-
override: true
23-
components: rustfmt, clippy
24-
- name: Build
25-
run: cargo build --release
26-
- name: Tests
27-
run: cargo test --release
99+
version: 10
100+
101+
- name: Get pnpm store directory
102+
shell: bash
103+
run: |
104+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
105+
id: pnpm-cache
106+
107+
- name: Setup pnpm cache
108+
uses: actions/cache@v4
109+
with:
110+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
111+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
112+
restore-keys: |
113+
${{ runner.os }}-pnpm-store-
114+
115+
- name: Install dependencies
116+
run: pnpm install --frozen-lockfile
117+
118+
- name: Run linter
119+
run: pnpm run lint
120+
121+
- name: Run tests
122+
run: pnpm run test
123+
124+
- name: Build project
125+
run: pnpm run build

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
# OS
22
.DS_Store/
33
thumbs.db
4-
time-travel.*
54

65
# IDE
76
.vscode/
87
.vs/
98
.idea/
10-
*.iml
119

1210
# Rust
1311
target/
1412
Cargo.lock
13+
.cargo/config.toml
14+
15+
# Node
16+
node_modules/
17+
cache/
18+
dist/
19+
20+
# Logs
21+
*.txt
22+
*.log

Cargo.toml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
[workspace]
2-
members = ["projects/*"]
3-
default-members = [
4-
"projects/terrain-core",
5-
"projects/terrain-ds",
2+
resolver = "3"
3+
members = [
4+
"compilers/*",
65
]
7-
exclude = [
8-
"projects/.DS_Store",
6+
default-members = [
7+
"compilers/*",
98
]
109

11-
[profile.release]
12-
lto = true
13-
panic = "abort"
10+
11+
[workspace.package]
12+
version = "0.0.0"
13+
edition = "2024"
14+
authors = ["RBQ Team"]
15+
license = "MIT OR Apache-2.0"
16+
repository = "https://github.com/nyar-vm/rusty-ruby"
17+
18+
[workspace.dependencies]
19+
async-stream = "0.3"
20+
tokio = { version = "1.36", features = ["rt-multi-thread", "macros", "net", "time", "sync", "io-util"] }
21+
async-trait = { version = "0.1" }
22+
serde = { version = "1.0.227", features = ["derive"] }
23+
serde_json = "1.0"
24+
tracing = "0.1"
25+
futures = "0.3"
26+
itertools = "0.14.0"
27+
clap = { version = "4.5", features = ["derive"] }
28+
dotenvy = "0.15"
29+
# 为 TUI 生成美观表格
30+
comfy-table = "7.1"
31+
# toml = "0.9.11+spec-1.1.0" # replaced by oak-toml
32+
# toml_edit = "0.24.0+spec-1.1.0" # replaced by oak-toml
33+
uuid = { version = "1.7", features = ["v4", "serde"] }
34+
chrono = { version = "0.4", features = ["serde"] }
35+
dashmap = "6.1.0"
36+
bytes = "1.5"
37+
byteorder = "1.5"
38+
39+
# Oak parsers
40+
oak-lsp = { path = "../oaks/projects/oak-lsp" }
41+
oak-core = { path = "../oaks/projects/oak-core" }
42+
oak-vfs = { path = "../oaks/projects/oak-vfs" }
43+
oak-mcp = { path = "../oaks/projects/oak-mcp" }
44+
oak-json = { path = "../oaks/examples/oak-json" }
45+
oak-toml = { path = "../oaks/examples/oak-toml" }
46+
oak-ruby = { path = "../oaks/examples/oak-ruby" }

0 commit comments

Comments
 (0)