-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathdefault.ps1
81 lines (59 loc) · 2.25 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
properties {
$baseDirectory = resolve-path .
$buildDirectory = ($buildDirectory, "$baseDirectory\build") | select -first 1
$version = "2.0.2"
$shortDescription = "A library for writing console applications. Extends Mono.Options to support separate commands from one console application."
}
import-module .\tools\PSUpdateXML.psm1
. .\psake_ext.ps1
task default -depends Build,RunTests,BuildNuget
task Cleanup {
if (test-path $buildDirectory) {
rm $buildDirectory -recurse
}
}
task GenerateAssemblyInfo {
$trimmedVersion = $version;
if ($trimmedVersion.indexOf("-") -gt -1) {
$trimmedVersion = $trimmedVersion.Substring(0, $trimmedVersion.indexOf("-"));
}
$projectFiles = ls -path $base_dir -include *.csproj -recurse
$projectFiles | write-host
foreach($projectFile in $projectFiles) {
$projectDir = [System.IO.Path]::GetDirectoryName($projectFile)
$projectName = [System.IO.Path]::GetFileName($projectDir)
$asmInfo = [System.IO.Path]::Combine($projectDir, [System.IO.Path]::Combine("Properties", "AssemblyInfo.cs"))
Generate-Assembly-Info `
-file $asmInfo `
-title "$projectName $version" `
-description $shortDescription `
-company "n/a" `
-product "ManyConsole $version" `
-version "$trimmedVersion" `
-fileversion "$trimmedVersion" `
-copyright "Copyright Frank Schwieterman 2019" `
-clsCompliant "false"
}
}
task Build -depends Cleanup,GenerateAssemblyInfo {
exec { & dotnet build ManyConsole -o "$buildDirectory\ManyConsole" -c Release }
exec { & dotnet build ManyConsoleModeCommand -o "$buildDirectory\ManyConsoleModeCommand" -c Release }
}
task RunTests {
exec { & dotnet test --logger trx }
}
task BuildNuget -depends Build {
$nugetTarget = "$buildDirectory\nuget"
$null = mkdir "$nugetTarget\"
cp .\ManyConsole.nuspec "$nugetTarget\"
$old = pwd
cd $nugetTarget
update-xml "ManyConsole.nuspec" {
for-xml "//package/metadata" {
set-xml -exactlyOnce "//version" "$version"
set-xml -exactlyOnce "//description" $shortDescription
}
}
..\..\tools\nuget pack "ManyConsole.nuspec"
cd $old
}