summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-21 21:33:47 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-21 21:33:47 +0800
commit09d64357180e0797b8dcdcaf14b4d3a634effc29 (patch)
treeb71376b5f4d3d07365edc37957cf21186c80e359
parent90dcfdd8b81948fa9aabf9ea36761e7d7bc1061b (diff)
Keep compile_info.rs in git and reorder deploy checksdeploy/nightly
Remove compile_info.rs from .gitignore to keep it in version control, preventing test failures when the template hasn't been processed yet. Also reorder deployment script checks to verify git status before running tests, ensuring a clean state before testing begins.
-rw-r--r--.gitignore1
-rw-r--r--scripts/dev/deploy.ps132
-rwxr-xr-xscripts/dev/deploy.sh32
-rw-r--r--src/data/compile_info.rs25
4 files changed, 57 insertions, 33 deletions
diff --git a/.gitignore b/.gitignore
index 7a87e83..4938de3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,6 @@
/deploy/
# Generated from templates
-/src/data/compile_info.rs
/scripts/setup/windows/setup_jv_cli.iss
_*.rs
diff --git a/scripts/dev/deploy.ps1 b/scripts/dev/deploy.ps1
index 5332f1d..9774b75 100644
--- a/scripts/dev/deploy.ps1
+++ b/scripts/dev/deploy.ps1
@@ -35,22 +35,6 @@ if (-not (Test-Path $coreLibPath)) {
exit 1
}
-# Test core library
-Write-Host "Testing Core Library `".\..\VersionControl\Cargo.toml`""
-cargo test --manifest-path ..\VersionControl\Cargo.toml --workspace --quiet > $null 2>&1
-if ($LASTEXITCODE -ne 0) {
- Write-Warning "Core library tests failed. Aborting build."
- exit 1
-}
-
-# Test workspace
-Write-Host "Testing Command Line `".\Cargo.toml`""
-cargo test --workspace --quiet > $null 2>&1
-if ($LASTEXITCODE -ne 0) {
- Write-Warning "Workspace tests failed. Aborting build."
- exit 1
-}
-
# Check if main git worktree is clean
$gitStatus = git status --porcelain
if ($gitStatus) {
@@ -67,6 +51,22 @@ if ($coreGitStatus) {
exit 1
}
+# Test core library
+Write-Host "Testing Core Library `".\..\VersionControl\Cargo.toml`""
+cargo test --manifest-path ..\VersionControl\Cargo.toml --workspace --quiet > $null 2>&1
+if ($LASTEXITCODE -ne 0) {
+ Write-Warning "Core library tests failed. Aborting build."
+ exit 1
+}
+
+# Test workspace
+Write-Host "Testing Command Line `".\Cargo.toml`""
+cargo test --workspace --quiet > $null 2>&1
+if ($LASTEXITCODE -ne 0) {
+ Write-Warning "Workspace tests failed. Aborting build."
+ exit 1
+}
+
# Build
$env:FORCE_BUILD=$(Get-Date -Format 'mmss')
Write-Host "Building Command Line `".\Cargo.toml`""
diff --git a/scripts/dev/deploy.sh b/scripts/dev/deploy.sh
index 9ade49d..2bbf042 100755
--- a/scripts/dev/deploy.sh
+++ b/scripts/dev/deploy.sh
@@ -15,22 +15,6 @@ if [ ! -d "$coreLibPath" ]; then
exit 1
fi
-# Test core library
-echo "Testing Core Library \"../VersionControl/Cargo.toml\""
-cargo test --manifest-path ../VersionControl/Cargo.toml --workspace --quiet > /dev/null 2>&1
-if [ $? -ne 0 ]; then
- echo "Core library tests failed. Aborting build."
- exit 1
-fi
-
-# Test workspace
-echo "Testing Command Line \"./Cargo.toml\""
-cargo test --workspace --quiet > /dev/null 2>&1
-if [ $? -ne 0 ]; then
- echo "Workspace tests failed. Aborting build."
- exit 1
-fi
-
# Check if main git worktree is clean
git_status=$(git status --porcelain)
if [ -n "$git_status" ]; then
@@ -47,6 +31,22 @@ if [ -n "$core_git_status" ]; then
exit 1
fi
+# Test core library
+echo "Testing Core Library \"../VersionControl/Cargo.toml\""
+cargo test --manifest-path ../VersionControl/Cargo.toml --workspace --quiet > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "Core library tests failed. Aborting build."
+ exit 1
+fi
+
+# Test workspace
+echo "Testing Command Line \"./Cargo.toml\""
+cargo test --workspace --quiet > /dev/null 2>&1
+if [ $? -ne 0 ]; then
+ echo "Workspace tests failed. Aborting build."
+ exit 1
+fi
+
# Build
echo "Building Command Line \"./Cargo.toml\""
if FORCE_BUILD=$(date +%s) cargo build --workspace --release --quiet > /dev/null 2>&1; then
diff --git a/src/data/compile_info.rs b/src/data/compile_info.rs
new file mode 100644
index 0000000..d06f9b1
--- /dev/null
+++ b/src/data/compile_info.rs
@@ -0,0 +1,25 @@
+#[derive(serde::Serialize)]
+pub struct CompileInfo {
+ pub date: String,
+ pub target: String,
+ pub platform: String,
+ pub toolchain: String,
+
+ pub cli_version: String,
+ pub build_branch: String,
+ pub build_commit: String,
+}
+
+impl Default for CompileInfo {
+ fn default() -> Self {
+ Self {
+ date: "<<<date>>>".to_string(),
+ target: "<<<target>>>".to_string(),
+ platform: "<<<platform>>>".to_string(),
+ toolchain: "<<<toolchain>>>".to_string(),
+ cli_version: "<<<version>>>".to_string(),
+ build_branch: "<<<branch>>>".to_string(),
+ build_commit: "<<<commit>>>".to_string(),
+ }
+ }
+}