forked from msgpack/msgpack-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pack.ps1
62 lines (50 loc) · 1.97 KB
/
Pack.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
param([Switch]$Rebuild)
[string]$temp = '.\nugettmp'
[string]$builder = "$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
[string]$sln = 'MsgPack.sln'
[string]$slnCompat = 'MsgPack.compats.sln'
[string]$slnWindows = 'MsgPack.Windows.sln'
[string]$nuspec = 'MsgPack.nuspec'
$buildOptions = @()
if( $Rebuild )
{
$buildOptions += '/t:Rebuild'
}
$buildOptions += '/p:Configuration=Release'
# Unity
if ( ![IO.Directory]::Exists( ".\MsgPack-CLI" ) )
{
New-Item .\MsgPack-CLI -Type Directory | Out-Null
}
else
{
Remove-Item .\MsgPack-CLI\* -Recurse
}
if ( ![IO.Directory]::Exists( ".\MsgPack-CLI\mpu" ) )
{
New-Item .\MsgPack-CLI\mpu -Type Directory | Out-Null
}
# build
&$builder $sln $buildOptions
&$builder $slnCompat $buildOptions
&$builder $slnWindows $buildOptions
$winFile = New-Object IO.FileInfo( ".\bin\portable-net45+win+wpa81\MsgPack.dll" )
$xamarinFile = New-Object IO.FileInfo( ".\bin\MonoTouch10\MsgPack.dll" )
if( ( $winFile.LastWriteTime - $xamarinFile.LastWriteTime ).Days -ne 0 )
{
# It might that I forgot building in xamarin when winRT build and xamarin build last write time are differ more than 1day.
Write-Error "Last write times between WinRT binary and Xamarin library are very differ. Do you forget to place latest Xamarin build (on Mac) or latest WinRT build (on Windows) on ./bin ?"
return
}
.\.nuget\nuget.exe pack $nuspec -Symbols
Copy-Item .\bin\* .\MsgPack-CLI\ -Recurse -Exclude @("*.vshost.*")
Copy-Item .\tools\mpu\bin\* .\MsgPack-CLI\mpu\ -Recurse -Exclude @("*.vshost.*")
[Reflection.Assembly]::LoadWithPartialName( "System.IO.Compression.FileSystem" ) | Out-Null
# 'latest' should be rewritten with semver manually.
if ( [IO.File]::Exists( ".\MsgPack.Cli.latest.zip" ) )
{
Remove-Item .\MsgPack.Cli.latest.zip
}
[IO.Compression.ZipFile]::CreateFromDirectory( ".\MsgPack-CLI", ".\MsgPack.Cli.latest.zip" )
Remove-Item .\MsgPack-CLI -Recurse
Write-Host "Package creation finished. Ensure AssemblyInfo.cs is updated and .\SetFileVersions.ps1 was executed."