Skip to content

Commit

Permalink
refactor: restructure Rust components into workspace
Browse files Browse the repository at this point in the history
- Move Rust code from `installer-src` to `crates/installer` to utilize Cargo workspace for better project organization and build efficiency.
- Update Makefile and README to reflect new build instructions and project structure.
- Improve project modularity and prepare for future Rust components integration.
  • Loading branch information
gizmo-ds committed Apr 10, 2024
1 parent 32b99a4 commit 6a5bf30
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ test-data
.env.local
.vscode/*
!.vscode/extensions.json
target
24 changes: 12 additions & 12 deletions installer-src/Cargo.lock → Cargo.lock

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

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[workspace]
resolver = "2"
members = ["crates/installer"]

[profile.release]
lto = true
opt-level = 'z'
panic = 'abort'
strip = true
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ build-patch-loader:
@rm -rf build/*.css

build-installer: build-patch-loader
@cp build/patch-loader.js installer-src/assets/patch-loader.js
@cd installer-src && cargo build --release --locked --target x86_64-pc-windows-gnu
@cp installer-src/target/x86_64-pc-windows-gnu/release/vcc-auto-translate-installer.exe build/vcc-auto-translate-installer.exe
@cp build/patch-loader.js crates/installer/assets/patch-loader.js
@cargo build --release --locked --target x86_64-pc-windows-gnu
@cp target/x86_64-pc-windows-gnu/release/vcc-auto-translate-installer.exe build/

sha256sum:
@rm -f build/*.sha256; for file in build/*; do sha256sum $$file > $$file.sha256; done

compress: build-installer
compress:
@if [ -n "$(shell command -v upx 2> /dev/null)" ]; then for file in build/*.exe; do upx $$file; done; fi

clean:
@rm -f cmd/installer/vcc-auto-translate.js
@rm -f cmd/installer/localization/*.json
@rm -rf build
@cargo clean

dev: clean build-patch-loader
@rm -f installer-src/assets/patch-loader.js
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ VCC(VRChat Creator Companion) 的翻译脚本, 用于自动翻译 VCC 的界面.
```shell
pnpm install
pnpm run build:patch-loader
Copy-Item build/patch-loader.js installer-src/assets/patch-loader.js
cd installer-src
Copy-Item build/patch-loader.js crates/installer/assets/patch-loader.js
cargo build --release --locked
```

编译完成后, 你可以在`installer-src/target/release`目录找到编译好的自动安装工具.
编译完成后, 你可以在`target/release`目录找到编译好的自动安装工具.

## Related

Expand Down
File renamed without changes.
13 changes: 5 additions & 8 deletions installer-src/Cargo.toml → crates/installer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vcc-auto-translate-installer"
version = "1.6.0"
name = "installer"
version = "0.1.0"
edition = "2021"

[dependencies]
Expand All @@ -11,9 +11,6 @@ scopeguard = { version = "1.2.0", default-features = false }
[target.'cfg(windows)'.dependencies]
winreg = { version = "0.52.0" }

[profile.release]
lto = true
opt-level = 'z'
strip = true
codegen-units = 1
panic = "abort"
[[bin]]
name = "vcc-auto-translate-installer"
path = "src/main.rs"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6a5bf30

Please sign in to comment.