Skip to content

Commit de32ec5

Browse files
committed
Add make-distribution.ps1
1 parent 3520891 commit de32ec5

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ---------------------------------------------------------------
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
# ---------------------------------------------------------------
4+
# Script Name : make-distribution.ps1
5+
# Script Authors : Aoran Zeng <[email protected]>
6+
# Created On : <2025-07-21>
7+
# Last Modified : <2025-07-21>
8+
#
9+
# Make rawstr4c distribution file (tar.gz)
10+
# ---------------------------------------------------------------
11+
12+
$files = @()
13+
14+
# 获取相对路径的函数
15+
function Get-RelativePath($item) {
16+
# K:\chsrc\tool\rawstr4c
17+
# K:\chsrc\tool\rawstr4c\our-dist-file
18+
# 注意我们必须要删掉这里的\,这就是 +1 的原因
19+
return $item.FullName.Substring((Get-Location).Path.Length + 1)
20+
}
21+
22+
# 添加 lib 目录(排除 .precomp)
23+
$files += Get-ChildItem lib -Recurse | Where-Object { $_.FullName -notlike "*\.precomp*" } | ForEach-Object { Get-RelativePath $_ }
24+
25+
# 添加其他目录
26+
$files += Get-ChildItem bin, doc, test -Recurse | ForEach-Object { Get-RelativePath $_ }
27+
28+
# 添加根目录文件
29+
$rootFiles = @('META6.json', 'LICENSE', 'README.md')
30+
foreach ($file in $rootFiles) {
31+
if (Test-Path $file) {
32+
$files += $file
33+
}
34+
}
35+
36+
# 打包
37+
$archiveName = "rawstr4c-$(Get-Date -Format 'yyyyMMdd').tar.gz"
38+
$files | tar -czf $archiveName -T -
39+
40+
Write-Host "打包完成: $archiveName" -ForegroundColor Green

0 commit comments

Comments
 (0)