增加打包工具
This commit is contained in:
parent
f29e6eccb5
commit
eaf7a8f9dc
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,3 +42,4 @@ target/
|
||||
/.idea/
|
||||
/src.tar
|
||||
/src/main/java/org/jcnc/snow/compiler/ir.tar
|
||||
/SCompiler.tar
|
||||
|
||||
6
.run/build_project2tar.ps1.run.xml
Normal file
6
.run/build_project2tar.ps1.run.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="build_project2tar.ps1" type="PowerShellRunType" factoryName="PowerShell" scriptUrl="$PROJECT_DIR$/build/build_project2tar.ps1" executablePath="C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe">
|
||||
<envs />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
37
build/build_project2tar.ps1
Normal file
37
build/build_project2tar.ps1
Normal file
@ -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 命令或排除项"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user