-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathpack.ps1
More file actions
99 lines (75 loc) · 2.46 KB
/
pack.ps1
File metadata and controls
99 lines (75 loc) · 2.46 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
param(
[bool]$clean = $true,
[bool]$unittests = $true
)
# Initialization
$rootFolder = Split-Path -parent $script:MyInvocation.MyCommand.Path
. $rootFolder\nuget.include.ps1
. $rootFolder\build.include.ps1
. $rootFolder\tests.include.ps1
# Solution
$solutionFolder = Join-Path $rootFolder "PortableLeagueAPI"
$outputFolder = Join-Path $rootFolder "bin"
$projects = @(
"LeagueAPI.PCL.Test\PortableLeagueAPI.Test.csproj",
"PortableLeagueApi.Interfaces\PortableLeagueApi.Interfaces.csproj",
"PortableLeagueApi.Core\PortableLeagueApi.Core.csproj",
"PortableLeagueAPI.Champion\PortableLeagueApi.Champion.csproj",
"PortableLeagueApi.Game\PortableLeagueApi.Game.csproj",
"PortableLeagueApi.League\PortableLeagueApi.League.csproj",
"PortableLeagueApi.Static\PortableLeagueApi.Static.csproj",
"PortableLeagueApi.Stats\PortableLeagueApi.Stats.csproj",
"PortableLeagueApi.Summoner\PortableLeagueApi.Summoner.csproj",
"PortableLeagueApi.Team\PortableLeagueApi.Team.csproj",
"LeagueAPI.PCL\PortableLeagueAPI.csproj"
)
# Do not build a .nupkg for these projects
$excludeNupkgProjects = @(
$projects[0]
)
# Clean
if($clean) { Packages-Clean $rootFolder }
$newPackagesVersions = @{}
$config = "Release"
# Projects to build
$projects | ForEach-Object {
$project = $_
# Build project
Build-Project -rootFolder $rootFolder `
-outputFolder $outputFolder `
-project $project `
-config $config
# Build .nupkg if project is not excluded and needed
if(-not ($excludeNupkgProjects -contains $project)) {
$projectFolder = Get-Project-Folder -rootFolder $rootFolder `
-project $project
$packageId = Get-Package-Id -rootFolder $rootFolder `
-project $project
$nuSpecFromNuget = Get-MostRecentNugetSpec -nugetPackageId $packageId
$version = Get-Last-NuGet-Version -spec $nuSpecFromNuget
$assemblyVersion = Get-Assembly-Version -projectFolder $projectFolder
$isNewVersion = $false
if($assemblyVersion -ne $version) {
$version = $assemblyVersion
$isNewVersion = $true
}
$newPackagesVersions.Add($packageId, $version)
Update-Nuspec -rootFolder $rootFolder `
-project $project `
-newPackagesVersions $newPackagesVersions
if($isNewVersion){
Build-Nupkg -rootFolder $rootFolder `
-outputFolder $outputFolder `
-project $project `
-version $version `
-config $config
}
}
else {
if($unittests) {
$buildFolder = Join-Path $outputFolder $config
TestRunner-Nunit -rootFolder $rootFolder `
-buildFolder $buildFolder
}
}
}