2015-11-17 08:39:46 +00:00
|
|
|
# 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(
|
2016-03-07 20:20:50 +00:00
|
|
|
[Parameter(Mandatory=$true)][string]$inputDir,
|
|
|
|
[Parameter(Mandatory=$true)][string]$DotnetMSIOutput,
|
2016-03-07 22:52:41 +00:00
|
|
|
[Parameter(Mandatory=$true)][string]$WixRoot,
|
|
|
|
[Parameter(Mandatory=$true)][string]$DotnetMSIVersion,
|
|
|
|
[Parameter(Mandatory=$true)][string]$DotnetCLIVersion,
|
|
|
|
[Parameter(Mandatory=$true)][string]$Architecture,
|
|
|
|
[Parameter(Mandatory=$true)][string]$ReleaseSuffix
|
2015-11-17 08:39:46 +00:00
|
|
|
)
|
|
|
|
|
2016-03-18 00:54:01 +00:00
|
|
|
. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1"
|
|
|
|
$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.."
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
$InstallFileswsx = "install-files.wxs"
|
|
|
|
$InstallFilesWixobj = "install-files.wixobj"
|
|
|
|
|
|
|
|
function RunHeat
|
|
|
|
{
|
2016-01-28 09:46:03 +00:00
|
|
|
$result = $true
|
|
|
|
pushd "$WixRoot"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
Write-Host Running heat..
|
|
|
|
|
2015-11-21 01:44:48 +00:00
|
|
|
.\heat.exe dir `"$inputDir`" -template fragment -sreg -gg -var var.DotnetSrc -cg InstallFiles -srd -dr DOTNETHOME -out $InstallFileswsx | Out-Host
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
if($LastExitCode -ne 0)
|
|
|
|
{
|
|
|
|
$result = $false
|
|
|
|
Write-Host "Heat failed with exit code $LastExitCode."
|
|
|
|
}
|
|
|
|
|
|
|
|
popd
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
function RunCandle
|
|
|
|
{
|
|
|
|
$result = $true
|
|
|
|
pushd "$WixRoot"
|
|
|
|
|
|
|
|
Write-Host Running candle..
|
2016-03-18 00:54:01 +00:00
|
|
|
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\clisdk"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
.\candle.exe -nologo `
|
|
|
|
-dDotnetSrc="$inputDir" `
|
2016-01-13 23:24:09 +00:00
|
|
|
-dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" `
|
2016-03-07 22:52:41 +00:00
|
|
|
-dBuildVersion="$DotnetMSIVersion" `
|
|
|
|
-dDisplayVersion="$DotnetCLIVersion" `
|
|
|
|
-dReleaseSuffix="$ReleaseSuffix" `
|
|
|
|
-arch "$Architecture" `
|
2015-11-18 04:32:02 +00:00
|
|
|
-ext WixDependencyExtension.dll `
|
|
|
|
"$AuthWsxRoot\dotnet.wxs" `
|
|
|
|
"$AuthWsxRoot\provider.wxs" `
|
|
|
|
"$AuthWsxRoot\registrykeys.wxs" `
|
2016-01-14 23:03:32 +00:00
|
|
|
"$AuthWsxRoot\checkbuildtype.wxs" `
|
2015-11-21 01:44:48 +00:00
|
|
|
$InstallFileswsx | Out-Host
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
if($LastExitCode -ne 0)
|
|
|
|
{
|
|
|
|
$result = $false
|
|
|
|
Write-Host "Candle failed with exit code $LastExitCode."
|
|
|
|
}
|
|
|
|
|
|
|
|
popd
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
function RunLight
|
|
|
|
{
|
|
|
|
$result = $true
|
|
|
|
pushd "$WixRoot"
|
|
|
|
|
|
|
|
Write-Host Running light..
|
2016-01-28 09:46:03 +00:00
|
|
|
$CabCache = Join-Path $WixRoot "cabcache"
|
2016-03-18 00:54:01 +00:00
|
|
|
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\clisdk"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
.\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
|
2015-11-18 04:32:02 +00:00
|
|
|
-cultures:en-us `
|
|
|
|
dotnet.wixobj `
|
|
|
|
provider.wixobj `
|
|
|
|
registrykeys.wixobj `
|
2016-01-14 23:03:32 +00:00
|
|
|
checkbuildtype.wixobj `
|
2015-11-18 04:32:02 +00:00
|
|
|
$InstallFilesWixobj `
|
2016-01-28 09:46:03 +00:00
|
|
|
-b "$inputDir" `
|
|
|
|
-b "$AuthWsxRoot" `
|
|
|
|
-reusecab `
|
|
|
|
-cc "$CabCache" `
|
2015-11-21 01:44:48 +00:00
|
|
|
-out $DotnetMSIOutput | Out-Host
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
if($LastExitCode -ne 0)
|
|
|
|
{
|
|
|
|
$result = $false
|
|
|
|
Write-Host "Light failed with exit code $LastExitCode."
|
|
|
|
}
|
|
|
|
|
|
|
|
popd
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(Test-Path $inputDir))
|
|
|
|
{
|
|
|
|
throw "$inputDir not found"
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"
|
|
|
|
|
|
|
|
if([string]::IsNullOrEmpty($WixRoot))
|
|
|
|
{
|
2015-12-28 19:47:21 +00:00
|
|
|
Exit -1
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(-Not (RunHeat))
|
2016-01-28 09:46:03 +00:00
|
|
|
{
|
2015-12-28 19:47:21 +00:00
|
|
|
Exit -1
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(-Not (RunCandle))
|
|
|
|
{
|
2015-12-28 19:47:21 +00:00
|
|
|
Exit -1
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(-Not (RunLight))
|
|
|
|
{
|
2015-12-28 19:47:21 +00:00
|
|
|
Exit -1
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!(Test-Path $DotnetMSIOutput))
|
|
|
|
{
|
|
|
|
throw "Unable to create the dotnet msi."
|
2015-12-28 19:47:21 +00:00
|
|
|
Exit -1
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
2015-11-25 01:48:58 +00:00
|
|
|
Write-Host -ForegroundColor Green "Successfully created dotnet MSI - $DotnetMSIOutput"
|
2015-11-18 04:32:02 +00:00
|
|
|
|
|
|
|
exit $LastExitCode
|