From eaf7a8f9dc9a42a9ccef8646944e946364372b80 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 9 May 2025 10:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8C=85=E5=B7=A5?= =?UTF-8?q?=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .run/build_project2tar.ps1.run.xml | 6 +++++ build/build_project2tar.ps1 | 37 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .run/build_project2tar.ps1.run.xml create mode 100644 build/build_project2tar.ps1 diff --git a/.gitignore b/.gitignore index 247631c..0128db1 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ target/ /.idea/ /src.tar /src/main/java/org/jcnc/snow/compiler/ir.tar +/SCompiler.tar diff --git a/.run/build_project2tar.ps1.run.xml b/.run/build_project2tar.ps1.run.xml new file mode 100644 index 0000000..a360594 --- /dev/null +++ b/.run/build_project2tar.ps1.run.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/build/build_project2tar.ps1 b/build/build_project2tar.ps1 new file mode 100644 index 0000000..2abdd75 --- /dev/null +++ b/build/build_project2tar.ps1 @@ -0,0 +1,37 @@ +$tarName = "SCompiler.tar" + +# 切换到脚本所在目录的上一级目录(假设作为项目根目录) +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$projectRoot = Split-Path -Parent $scriptDir +Set-Location $projectRoot + +Write-Output "当前工作目录:$(Get-Location)" + +# 如果旧的 tar 包存在,先删除 +if (Test-Path $tarName) { + Write-Output "发现旧的 $tarName,正在删除..." + Remove-Item $tarName +} + +# 创建新的 tar 包并排除某些文件和目录 +Write-Output "正在创建新的 $tarName ..." + +$excludeOptions = @( + "--exclude=$tarName" + "--exclude=build_project2tar.ps1" + "--exclude=.git" + "--exclude=.idea" + "--exclude=.run" + "--exclude=target" + "--exclude=.gitignore" +) + +# 调用 tar 命令 +& tar -cf $tarName $excludeOptions * + +# 验证结果 +if (Test-Path $tarName) { + Write-Output "✅ 成功创建 $tarName" +} else { + Write-Output "❌ 创建失败,请检查 tar 命令或排除项" +}