DSInternals/Scripts/Build-Solution.ps1

41 lines
1.3 KiB
PowerShell
Raw Permalink Normal View History

2015-12-26 22:44:43 +00:00
#Requires -Version 3
2015-12-27 17:18:31 +00:00
<#
.SYNOPSIS
Compiles the binaries from source codes.
#>
2015-12-26 22:44:43 +00:00
2016-01-17 17:17:56 +00:00
$rootDir = Split-Path $PSScriptRoot -Parent
$solutionFile = Join-Path $rootDir 'Src\DSInternals.sln'
2016-02-23 19:33:05 +00:00
$buildDir = Join-Path $rootDir 'Build'
$logRootDir = Join-Path $buildDir 'log'
2015-12-26 22:44:43 +00:00
2015-12-27 17:18:31 +00:00
# We need the Invoke-MSBuild module to always invoke the latest msbuild.exe.
$modulePath = Join-Path $PSScriptRoot 'Modules\Invoke-MSBuild'
2015-12-26 22:44:43 +00:00
Import-Module $modulePath -ErrorAction Stop
2016-02-23 19:33:05 +00:00
$targets = 'Build' # 'Clean'
$configurations = 'Release', 'Debug'
2015-12-27 17:18:31 +00:00
$platforms = 'x86','x64'
2015-12-26 22:44:43 +00:00
2016-02-23 19:33:05 +00:00
# Delete the entire Build directory
2016-02-25 16:36:08 +00:00
if(Test-Path $buildDir)
{
del $buildDir -Recurse -Force
}
2016-02-23 19:33:05 +00:00
2015-12-27 17:18:31 +00:00
# Run all targets with all configurations and platforms
foreach($target in $targets)
{
foreach($configuration in $configurations)
{
foreach($platform in $platforms)
{
Write-Host "$($target)ing $configuration|$platform..."
2016-01-17 17:17:56 +00:00
$logDir = Join-Path $logRootDir "$configuration\$platform"
mkdir $logDir -Force | Out-Null
$result = Invoke-MsBuild -MsBuildParameters "/target:$target /property:Configuration=$configuration;Platform=$platform" `
2017-03-26 16:54:30 +00:00
-Path $solutionFile -BuildLogDirectoryPath $logDir -KeepBuildLogOnSuccessfulBuilds -ShowBuildOutputInNewWindow
echo ('Success: {0}' -f $result.BuildSucceeded)
2015-12-27 17:18:31 +00:00
}
}
}