-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdefault.ps1
66 lines (45 loc) · 2.01 KB
/
default.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
63
64
65
66
properties {
$baseDirectory = (resolve-path .).ToString();
$buildDirectory = "$baseDirectory\build"
}
import-module .\tools\PSUpdateXml.psm1
task Default -depends BuildNuget
task Cleanup {
if (test-path $buildDirectory) {
rm $buildDirectory -recurse -force
}
}
task Build -depends Cleanup {
$v4_net_version = (ls "$env:windir\Microsoft.NET\Framework\v4.0*").Name
$solution = "$baseDirectory\PSHostsFile.sln"
exec { &"C:\Windows\Microsoft.NET\Framework\$v4_net_version\MSBuild.exe" $solution /T:"Clean,Build" /property:OutDir="$buildDirectory\" }
}
task Test -depends Build {
exec { & "$baseDirectory\packages\NUnit.Runners.2.6.0.12051\tools\nunit-console.exe" $buildDirectory\PSHostsFileTest.dll /xml "$buildDirectory\TestResults.xml" }
}
task BuildNuget -depends Build,Test {
$nugetTarget = "$buildDirectory\nuget"
$null = mkdir "$nugetTarget\lib\"
$null = mkdir "$nugetTarget\tools\"
cp "$buildDirectory\PSHostsFile.dll" "$nugetTarget\lib\"
cp "$buildDirectory\PSHostsFile.pdb" "$nugetTarget\lib\"
cp "$buildDirectory\PSHostsFile.dll" "$nugetTarget\tools\"
cp "$buildDirectory\PSHostsFile.pdb" "$nugetTarget\tools\"
$old = pwd
cd $nugetTarget
..\..\tools\nuget.exe spec -a ".\lib\PSHostsFile.dll"
update-xml "PSHostsFile.nuspec" {
set-xml -exactlyOnce "//version" "3.0.5"
set-xml -exactlyOnce "//owners" "fschwiet"
set-xml -exactlyOnce "//licenseUrl" "https://github.com/fschwiet/PSHostsFile/blob/master/LICENSE.txt"
set-xml -exactlyOnce "//projectUrl" "https://github.com/fschwiet/PSHostsFile/"
remove-xml -exactlyOnce "//iconUrl"
set-xml -exactlyOnce "//tags" "hosts-file hosts dns"
set-xml -exactlyOnce "//description" "Change your window's hosts file from C# or Powershell."
set-xml -exactlyOnce "//releaseNotes" ""
remove-xml -exactlyOnce "//dependencies"
}
..\..\tools\nuget pack "PSHostsFile.nuspec"
cd $old
}