diff --git a/tool/rawstr4c/make-distribution.ps1 b/tool/rawstr4c/make-distribution.ps1 new file mode 100644 index 0000000..a501bd9 --- /dev/null +++ b/tool/rawstr4c/make-distribution.ps1 @@ -0,0 +1,40 @@ +# --------------------------------------------------------------- +# SPDX-License-Identifier: GPL-3.0-or-later +# --------------------------------------------------------------- +# Script Name : make-distribution.ps1 +# Script Authors : Aoran Zeng +# Created On : <2025-07-21> +# Last Modified : <2025-07-21> +# +# Make rawstr4c distribution file (tar.gz) +# --------------------------------------------------------------- + +$files = @() + +# 获取相对路径的函数 +function Get-RelativePath($item) { + # K:\chsrc\tool\rawstr4c + # K:\chsrc\tool\rawstr4c\our-dist-file + # 注意我们必须要删掉这里的\,这就是 +1 的原因 + return $item.FullName.Substring((Get-Location).Path.Length + 1) +} + +# 添加 lib 目录(排除 .precomp) +$files += Get-ChildItem lib -Recurse | Where-Object { $_.FullName -notlike "*\.precomp*" } | ForEach-Object { Get-RelativePath $_ } + +# 添加其他目录 +$files += Get-ChildItem bin, doc, test -Recurse | ForEach-Object { Get-RelativePath $_ } + +# 添加根目录文件 +$rootFiles = @('META6.json', 'LICENSE', 'README.md') +foreach ($file in $rootFiles) { + if (Test-Path $file) { + $files += $file + } +} + +# 打包 +$archiveName = "rawstr4c-$(Get-Date -Format 'yyyyMMdd').tar.gz" +$files | tar -czf $archiveName -T - + +Write-Host "打包完成: $archiveName" -ForegroundColor Green