-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdefault.ps1
80 lines (64 loc) · 2.61 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
properties {
# Update this manually for each new version
$pack_version = "2.0.0.1"
$base_dir = resolve-path .
$lib_dir = join-path $base_dir "pack\lib"
$nuget_tool = join-path $base_dir ".nuget\nuget.exe"
# Previously, package versions and git-tags had to be in sync, but this is problematic in the long run
# due to git's separate commits for branch and tags
#$pack_version = (git describe --tags --abbrev=0).Replace("v", "")
$pack_author = "Joakim Larsson"
$pack_copyright = "Copyright © Joakim Larsson 2012"
# specify projects
$prevalence = @{
id="Kiwi.Prevalence";
title="Kiwi.Prevalence";
description = "Prevalence library for .NET";
project_dir = (join-path $base_dir Kiwi.Prevalence);
project = (join-path $base_dir Kiwi.Prevalence\Kiwi.Prevalence.csproj);
nuspec = (join-path $base_dir Kiwi.Prevalence\Kiwi.Prevalence.Nuspec);
}
$projects = ($prevalence)
# specify solutions to build
$net40 = @{ sln = (join-path $base_dir "Kiwi.Prevalence.sln"); out = (join-path $base_dir "pack\lib\net40") }
$solutions = ($net40)
}
#$framework = "4.0"
Framework("4.0")
task default -depends pack
task clean {
remove-item -force -recurse $lib_dir -ErrorAction SilentlyContinue
}
task update-assembly-info -depends clean {
$projects | foreach { (Generate-Assembly-Info $_) }
}
task build -depends update-assembly-info {
$solutions | foreach { msbuild $_.sln /target:"Build" /verbosity:quiet /nologo /p:Platform="Any CPU" /p:Configuration="Release" /p:OutDir=$($_.out)\ }
}
task pack -depends build {
$projects | foreach { `
& $nuget_tool pack $_.nuspec -p "id=$($_.id);version=$pack_version;title=$($_.title);author=$pack_author;description=$($_.description);copyright=$pack_copyright;libdir=..\pack\lib"
}
}
function Generate-Assembly-Info
{
param($project)
$asmInfo = "using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: CLSCompliantAttribute(true)]
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyTitleAttribute(""$($project.title)"")]
[assembly: AssemblyDescriptionAttribute(""$($project.description)"")]
[assembly: AssemblyCompanyAttribute(""$pack_author"")]
[assembly: AssemblyProductAttribute(""$($project.id) $version"")]
[assembly: AssemblyCopyrightAttribute(""$pack_copyright"")]
[assembly: AssemblyVersionAttribute(""$pack_version"")]
[assembly: AssemblyInformationalVersionAttribute(""$pack_version"")]
[assembly: AssemblyFileVersionAttribute(""$pack_version"")]
[assembly: AssemblyDelaySignAttribute(false)]
"
$file = join-path $project.project_dir "Properties\assemblyinfo.cs"
Write-Host "Generating assembly info file: $file"
Write-Output $asmInfo > $file
}