dotnet-installer/packaging/windows/sharedframework/generatebundle.ps1
2016-03-25 12:50:37 -07:00

107 lines
3 KiB
PowerShell

# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
param(
[Parameter(Mandatory=$true)][string]$SharedFxMSIFile,
[Parameter(Mandatory=$true)][string]$SharedHostMSIFile,
[Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
[Parameter(Mandatory=$true)][string]$WixRoot,
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
[Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
[Parameter(Mandatory=$true)][string]$SharedFrameworkNugetName,
[Parameter(Mandatory=$true)][string]$SharedFrameworkNugetVersion,
[Parameter(Mandatory=$true)][string]$SharedFrameworkUpgradeCode,
[Parameter(Mandatory=$true)][string]$Architecture,
[Parameter(Mandatory=$true)][string]$ReleaseSuffix
)
. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1"
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
function RunCandleForBundle
{
$result = $true
pushd "$WixRoot"
Write-Host Running candle for bundle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\sharedframework"
.\candle.exe -nologo `
-dMicrosoftEula="$RepoRoot\packaging\osx\sharedframework\resources\en.lproj\eula.rtf" `
-dBuildVersion="$DotnetMSIVersion" `
-dDisplayVersion="$DotnetCLIVersion" `
-dReleaseSuffix="$ReleaseSuffix" `
-dSharedFXMsiSourcePath="$SharedFxMSIFile" `
-dSharedHostMsiSourcePath="$SharedHostMSIFile" `
-dFrameworkName="$SharedFrameworkNugetName" `
-dFrameworkDisplayVersion="$SharedFrameworkNugetVersion" `
-dFrameworkUpgradeCode="$SharedFrameworkUpgradeCode" `
-arch "$Architecture" `
-ext WixBalExtension.dll `
-ext WixUtilExtension.dll `
-ext WixTagExtension.dll `
"$AuthWsxRoot\bundle.wxs" | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Candle failed with exit code $LastExitCode."
}
popd
return $result
}
function RunLightForBundle
{
$result = $true
pushd "$WixRoot"
Write-Host Running light for bundle..
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\sharedframework"
.\light.exe -nologo `
-cultures:en-us `
bundle.wixobj `
-ext WixBalExtension.dll `
-ext WixUtilExtension.dll `
-ext WixTagExtension.dll `
-b "$AuthWsxRoot" `
-out $DotnetBundleOutput | Out-Host
if($LastExitCode -ne 0)
{
$result = $false
Write-Host "Light failed with exit code $LastExitCode."
}
popd
return $result
}
Write-Host "Creating shared framework bundle at $DotnetBundleOutput"
if([string]::IsNullOrEmpty($WixRoot))
{
Exit -1
}
if(-Not (RunCandleForBundle))
{
Exit -1
}
if(-Not (RunLightForBundle))
{
Exit -1
}
if(!(Test-Path $DotnetBundleOutput))
{
throw "Unable to create the dotnet bundle."
Exit -1
}
Write-Host -ForegroundColor Green "Successfully created shared framework bundle - $DotnetBundleOutput"
exit $LastExitCode