-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtask.ps1
57 lines (47 loc) · 1.5 KB
/
task.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
$msbuild = "E:\VisualStudio\MSBuild\15.0\Bin\MSBuild.exe"
function Build
{
param(
[string]$target = "both"
)
$config = "/p:Configuration=Release"
$x64 = "/p:Platform=X64"
$x86 = "/p:Platform=X86"
switch($target)
{
"both" {
&$msbuild $config $x64
&$msbuild $config $x86
}
"64" { &$msbuild $config $x64 }
"86" { &$msbuild $config $x86 }
}
}
function Dist
{
param (
[Parameter(Mandatory = $true)][int16]$major,
[Parameter(Mandatory = $true)][int16]$minor,
[Parameter(Mandatory = $true)][int16]$patch
)
Remove-Item -Recurse .\obj, .\bin, .\dist -ErrorAction SilentlyContinue
$ver = "$($major).$($minor).$($patch)"
BumpVersion $ver
Build
New-Item -ItemType directory .\dist
Compress-Archive -Path .\bin\x64, .\bin\x86 -DestinationPath ".\dist\PowershellRM_$($ver)_x64_x86_dll.zip"
&".\SkinPackager.exe" .\skinDefinition.json
}
function BumpVersion
{
param (
[Parameter(Mandatory = $true)][string]$ver
)
$prop = Get-Content ".\Properties\AssemblyInfo.cs" -Encoding UTF8
$prop -replace 'AssemblyVersion\("[\d\.]*"\)', "AssemblyVersion(`"$ver`")" |
Set-Content ".\Properties\AssemblyInfo.cs" -Encoding UTF8
$skinDef = Get-Content ".\skinDefinition.json" | ConvertFrom-Json
$skinDef.version = $ver
$skinDef.output = "./dist/PowershellRM_$($ver).rmskin"
$skinDef | ConvertTo-Json | Set-Content ".\skinDefinition.json" -Encoding UTF8
}