dotnet-installer/packaging/windows/generatebundle.ps1
Sridhar Periyasamy d4a3190bfc Refactor the build scripts
- Bifurcate Package and Publish targets to enable signing.
- Move publish from bash/ps into c#.
- Create multiple targets to create MSIs and Bundles.
2016-03-07 12:20:50 -08:00

104 lines
2.4 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]$DotnetMSIFile,
[Parameter(Mandatory=$true)][string]$DotnetBundleOutput,
[Parameter(Mandatory=$true)][string]$WixRoot
)
. "$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"
.\candle.exe -nologo `
-dDotnetSrc="$inputDir" `
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
-dReleaseSuffix="$env:ReleaseSuffix" `
-dMsiSourcePath="$DotnetMSIFile" `
-arch "$env: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"
.\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
}
if(!(Test-Path $DotnetMSIFile))
{
throw "$DotnetMSIFile not found"
}
Write-Host "Creating dotnet 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 dotnet bundle - $DotnetBundleOutput"
_ $RepoRoot\test\Installer\testmsi.ps1 @("$DotnetMSIFile")
exit $LastExitCode