-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.ps1
57 lines (47 loc) · 1.68 KB
/
build.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
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[string[]]
$Target = $null,
[ValidatePattern('^(\d+\.\d+\.\d+)?$')]
$Version = '',
[switch]
$Release,
[string]
[ValidateSet('Debug', 'Release')]
$Configuration = 'Release',
[string]
[ValidatePattern('^(\d+\.\d+|\*)$')]
$MSBuildVersion = '*',
[ValidateSet('quiet', 'normal', 'detailed')]
$Verbosity = 'normal'
)
process
{
$buildDir = Join-Path $PSScriptRoot 'build'
$buildPackages = Join-Path $buildDir 'packages'
# Restore any tools needed during the build process
& (Join-Path $buildDir nuget.exe) restore (Join-Path $buildDir packages.config) -PackagesDirectory $buildPackages
# Locate the Invoke-Build script file
$invokeBuild = Get-ChildItem (Join-Path $buildPackages 'Invoke-Build.*\tools') | Resolve-Path
Write-Verbose "Using 'Invoke-Build' from `"$invokeBuild`""
# Get the location of MSBuild.exe
$msbuild = & (Join-Path $invokeBuild 'Resolve-MSBuild.ps1') $MSBuildVersion
Write-Verbose "Using 'msbuild.exe' at `"$msbuild`""
# Run the build script
Get-ChildItem (Join-Path $buildDir '*.build.ps1') |
ForEach {
$buildParameters = @{
MSBuild = $msbuild
RepositoryRoot = $PSScriptRoot
Target = $Target
Version = $Version
Release = $Release
Configuration = $Configuration
Verbosity = $Verbosity
}
Write-Host -NoNewline 'Building '
Write-Host -ForegroundColor Green $_
& (Join-Path $invokeBuild 'Invoke-Build.ps1') -Task $Targets -File $_ @buildParameters
}
}