-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-standalone-packages.ps1
41 lines (31 loc) · 1.63 KB
/
build-standalone-packages.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Add-Type -assembly "system.io.compression.filesystem"
$path = Split-Path -Parent $MyInvocation.MyCommand.Definition
$bin = Join-Path $path "bin"
$templates = Join-Path $path "templates"
$compat = Join-Path $path "compat"
Write-Host "$bin"
ls ghc-devel*.nuspec -recurse -File | ForEach-Object {
$src = (Split-Path $_.FullName -Parent)
$tmp = Join-Path $bin "tmp_build"
$base = $_.BaseName
New-Item $tmp -Type Directory -Force | Out-Null
Write-Host "Packaging $_"
# Copy the files over
Copy-Item -Recurse -Force -Path (Join-Path $src "*") -Destination $tmp
Copy-Item -Recurse -Force -Path (Join-Path $templates "*") -Destination $tmp
Copy-Item -Recurse -Force -Path (Join-Path $compat "*") -Destination $tmp
Copy-Item -Recurse -Force -Path README.md -Destination $tmp
Remove-Item (Join-Path $tmp "*.nuspec")
# Move top scripts
$tools = Join-Path $tmp "tools"
Move-Item (Join-Path $tools "chocolateyInstall.ps1") (Join-Path $tmp "Install.ps1")
Move-Item (Join-Path $tools "chocolateyUninstall.ps1") (Join-Path $tmp "Uninstall.ps1")
$source = $tmp
$destination = Join-Path $bin ($base + '.zip')
If(Test-path $destination) {Remove-item $destination}
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)
Remove-Item -Path $tmp -Recurse -Force
Write-Host "Done packaging $base"
}
cd $path
Write-Host "Finished."