Skip to content

Commit

Permalink
Change line endings; improve package generation
Browse files Browse the repository at this point in the history
CreateFromDirectory fails if there is already a zip file, so we
remove it before hand. We generate the archive with the
`inform-*.*.*` root directory (before only its contents were
included), and we make sure to copy the LICENSE and README.md
files into the directory before zipping.
  • Loading branch information
dglmoore committed Jul 21, 2016
1 parent e36d057 commit ecdcfdc
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions dist/package.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
$version = (cmake . -Bbuild/production -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" | Select-String '-- inform version: ')
$version = $version.ToString().Split(' ')[3]

$prefix = "inform-$version"
$target = "dist/$prefix"
$archive = "$($target)_win-amd64.zip"

cmake . -Bbuild/production -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$target" | Out-Null
cd build/production
nmake
test/inform_unittest.exe
nmake install
cd ../..


Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($target, $archive, $compressionLevel, $false)
$version = (cmake . -Bbuild/production -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" | Select-String '-- inform version: ')
$version = $version.ToString().Split(' ')[3]

$prefix = "inform-$version"
$target = "dist/$prefix"
$archive = "$($target)_win-amd64.zip"

cmake . -Bbuild/production -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$target" | Out-Null
cd build/production
nmake
test/inform_unittest.exe
nmake install
cd ../..
Copy-Item LICENSE $target
Copy-Item README.md $target

Remove-Item -force $archive
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($target, $archive, $compressionLevel, $true)

0 comments on commit ecdcfdc

Please sign in to comment.