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 命令或排除项" +}