mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-14 08:29:32 +08:00
Add make-distribution.ps1
This commit is contained in:
parent
3520891247
commit
de32ec5aa7
40
tool/rawstr4c/make-distribution.ps1
Normal file
40
tool/rawstr4c/make-distribution.ps1
Normal file
@ -0,0 +1,40 @@
|
||||
# ---------------------------------------------------------------
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# ---------------------------------------------------------------
|
||||
# Script Name : make-distribution.ps1
|
||||
# Script Authors : Aoran Zeng <ccmywish@qq.com>
|
||||
# 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
|
Loading…
x
Reference in New Issue
Block a user