-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPack.ps1
More file actions
61 lines (49 loc) · 1.67 KB
/
Pack.ps1
File metadata and controls
61 lines (49 loc) · 1.67 KB
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
param([Switch]$Rebuild)
#<#
# Merge nuspec templates.
#
# $baseFile: A file path to the base template file to be merged.
#
# $mergingFile: A file path to the base template file to be merging.
#
# $outputFile: A file path to the temporary merged *.nuspec file.
##>
function MergeXml([string]$baseFile, [string]$mergingFile, [string]$outputFile )
{
$baseXml = ( Select-Xml $baseFile -XPath '/' ).Node
$mergingXml = ( Select-Xml $mergingFile -XPath '/' ).Node
$baseMetadata = $baseXml.SelectSingleNode( '/package/metadata' )
foreach( $appendingMetadata in $mergingXml.SelectSingleNode( '/package/metadata' ).ChildNodes )
{
$baseMetadata.AppendChild( $baseXml.ImportNode( $appendingMetadata, $true ) ) | Out-Null
}
$basePackage = $baseXml.SelectSingleNode( '/package' )
$basePackage.AppendChild( $baseXml.ImportNode( $mergingXml.SelectSingleNode( '/package/files' ), $true ) ) | Out-Null
$baseXml.OuterXml | Out-File $outputFile
}
#<#
# Creates NuGet package for specified kind.
#
# $kind: The specifier of package kind.
##>
function CreatePackage( [string]$kind )
{
$tempNuspec = ".\MsgPack-RPC-$kind.nuspec"
MergeXml '.\MsgPack-RPC.nuspec.xml' ".\MsgPack-RPC-$kind.nuspec.xml" $tempNuspec
.\.nuget\nuget.exe pack $tempNuspec
Remove-Item $tempNuspec
}
[string]$temp = '.\nugettmp'
[string]$builder = "$env:windir\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
[string]$sln = 'MsgPack-RPC.sln'
$buildOptions = @()
if( $Rebuild )
{
$buildOptions += '/t:Rebuild'
}
$buildOptions += '/p:Configuration=Release'
&$builder $sln $buildOptions
CreatePackage 'full'
CreatePackage 'core'
CreatePackage 'client'
CreatePackage 'server'