summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-01-23 03:35:13 +0800
committer魏曹先生 <1992414357@qq.com>2026-01-23 03:35:13 +0800
commitdd800eb6394a0ba5b3216bbf4dfc4a90a717599e (patch)
treea3505a7b447f0dfb15c7a500e397c39c25eb51a9
parent5b5e3b2b9375fea3e47c28c2a4d47ef4fe349cd5 (diff)
Increase codegen-units and add dev deployment scripts
-rw-r--r--Cargo.toml2
-rw-r--r--deploy.ps110
-rwxr-xr-xdeploy.sh2
-rw-r--r--dev_deploy.ps127
-rw-r--r--dev_deploy.sh15
-rw-r--r--tools/build_helper/src/bin/exporter.rs18
6 files changed, 62 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 5b66066..3dd3903 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ version = "0.1.0-dev"
opt-level = 0
debug = true
split-debuginfo = "unpacked"
-codegen-units = 16
+codegen-units = 64
incremental = true
lto = false
panic = "unwind"
diff --git a/deploy.ps1 b/deploy.ps1
index 8a6820f..d547c95 100644
--- a/deploy.ps1
+++ b/deploy.ps1
@@ -5,14 +5,6 @@ $scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath -Parent
Set-Location $scriptDir
-# Hide .cargo and .temp directories before build
-if (Test-Path .cargo) {
- attrib +h .cargo
-}
-if (Test-Path .temp) {
- attrib +h .temp
-}
-
# Check for ISCC
$isccPath = Get-Command ISCC -ErrorAction SilentlyContinue
if (-not $isccPath) {
@@ -28,7 +20,7 @@ if ($LASTEXITCODE -ne 0) {
} else {
# Build succeeded
# Export
- if (cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter) {
+ if (cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter release) {
Copy-Item -Path templates\compile_info.rs.template -Destination src\data\compile_info.rs -Force
ISCC /Q .\setup\windows\setup_jv_cli.iss
}
diff --git a/deploy.sh b/deploy.sh
index 972b494..0ad0926 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -8,7 +8,7 @@ cd "$(dirname "$0")" || exit 1
# Build
if FORCE_BUILD=$(date +%s) cargo build --workspace --release; then
# Export
- if cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter; then
+ if cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter release; then
# Copy compile_info.rs.template to compile_info.rs after successful export
cp -f templates/compile_info.rs src/data/compile_info.rs
fi
diff --git a/dev_deploy.ps1 b/dev_deploy.ps1
new file mode 100644
index 0000000..abfac0e
--- /dev/null
+++ b/dev_deploy.ps1
@@ -0,0 +1,27 @@
+# Require : Cargo (Rust)
+
+# Set location to script directory
+$scriptPath = $MyInvocation.MyCommand.Path
+$scriptDir = Split-Path $scriptPath -Parent
+Set-Location $scriptDir
+
+# Hide .cargo and .temp directories before build
+if (Test-Path .cargo) {
+ attrib +h .cargo
+}
+if (Test-Path .temp) {
+ attrib +h .temp
+}
+
+# Build
+$env:FORCE_BUILD=$(Get-Date -Format 'mm')
+cargo build --workspace
+if ($LASTEXITCODE -ne 0) {
+ # Build failed
+} else {
+ # Build succeeded
+ # Export
+ if (cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter debug) {
+ Copy-Item -Path templates\compile_info.rs.template -Destination src\data\compile_info.rs -Force
+ }
+}
diff --git a/dev_deploy.sh b/dev_deploy.sh
new file mode 100644
index 0000000..2e295de
--- /dev/null
+++ b/dev_deploy.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Require : Cargo (Rust)
+
+# Change to the directory where the script is located
+cd "$(dirname "$0")" || exit 1
+
+# Build
+if FORCE_BUILD=$(date +%M) cargo build --workspace; then
+ # Export
+ if cargo run --manifest-path tools/build_helper/Cargo.toml --bin exporter debug; then
+ # Copy compile_info.rs.template to compile_info.rs after successful export
+ cp -f templates/compile_info.rs src/data/compile_info.rs
+ fi
+fi
diff --git a/tools/build_helper/src/bin/exporter.rs b/tools/build_helper/src/bin/exporter.rs
index c8f7ba2..c20694b 100644
--- a/tools/build_helper/src/bin/exporter.rs
+++ b/tools/build_helper/src/bin/exporter.rs
@@ -7,13 +7,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let start_time = std::time::Instant::now();
+ let preferred_target = std::env::args()
+ .nth(1)
+ .unwrap_or_else(|| "debug".to_string());
let target_dir = current_target_dir().expect("Failed to get target directory");
let publish_dir = current_publish_dir().expect("Failed to get publish directory");
let publish_binaries = publish_binaries().expect("Failed to get publish binaries");
let copy_configs = copy_configs().expect("Failed to get copy configurations");
// Final, export binaries to publish directory
- let copied_files = export(target_dir, publish_dir, publish_binaries, copy_configs)?;
+ let copied_files = export(
+ target_dir,
+ publish_dir,
+ publish_binaries,
+ copy_configs,
+ preferred_target,
+ )?;
let duration = start_time.elapsed();
println!(
@@ -33,6 +42,7 @@ fn export(
publish_dir: std::path::PathBuf,
publish_binaries: Vec<String>,
copy_configs: Vec<CopyConfig>,
+ preferred_target: String,
) -> Result<usize, Box<dyn std::error::Error>> {
let mut copied_files = 0;
@@ -70,6 +80,12 @@ fn export(
if let Some(file_name) = path.file_name().and_then(|n| n.to_str())
&& publish_binaries.contains(&file_name.to_string())
{
+ // Check if the path contains the preferred_target string
+ let path_str = path.to_string_lossy();
+ if !path_str.contains(&preferred_target) {
+ continue;
+ }
+
let dest_path = bin_dir.join(file_name);
if let Some(parent) = dest_path.parent() {