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(
|
2015-12-28 19:47:21 +00:00
|
|
|
[Parameter(Mandatory=$true)][string]$inputDir
|
2015-11-17 08:39:46 +00:00
|
|
|
)
|
|
|
|
|
2015-12-28 19:47:21 +00:00
|
|
|
. "$PSScriptRoot\..\..\scripts\common\_common.ps1"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
$DotnetMSIOutput = ""
|
|
|
|
$WixRoot = ""
|
|
|
|
$InstallFileswsx = "install-files.wxs"
|
|
|
|
$InstallFilesWixobj = "install-files.wixobj"
|
|
|
|
|
|
|
|
function AcquireWixTools
|
|
|
|
{
|
|
|
|
pushd "$Stage2Dir\bin"
|
|
|
|
|
|
|
|
Write-Host Restoring Wixtools..
|
|
|
|
|
2015-11-18 04:32:02 +00:00
|
|
|
$result = $env:TEMP
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
.\dotnet restore $RepoRoot\packaging\windows\WiXTools --packages $result | Out-Null
|
|
|
|
|
|
|
|
if($LastExitCode -ne 0)
|
|
|
|
{
|
|
|
|
$result = ""
|
|
|
|
Write-Host "dotnet restore failed with exit code $LastExitCode."
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-11-18 04:32:02 +00:00
|
|
|
$result = Join-Path $result WiX\3.10.0.2103-pre1\tools
|
2015-11-17 08:39:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
popd
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
function RunHeat
|
|
|
|
{
|
|
|
|
$result = $true
|
|
|
|
pushd "$WixRoot"
|
|
|
|
|
|
|
|
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..
|
2015-11-18 04:32:02 +00:00
|
|
|
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
2016-01-12 23:27:02 +00:00
|
|
|
.\candle.exe -dDotnetSrc="$inputDir" -dMicrosoftEula="$RepoRoot\packaging\osx\resources\en.lproj\eula.rtf" -dBuildVersion="$env:DOTNET_CLI_VERSION" -arch x64 `
|
2015-11-18 04:32:02 +00:00
|
|
|
-ext WixDependencyExtension.dll `
|
|
|
|
"$AuthWsxRoot\dotnet.wxs" `
|
|
|
|
"$AuthWsxRoot\provider.wxs" `
|
|
|
|
"$AuthWsxRoot\registrykeys.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..
|
|
|
|
|
2015-11-18 04:32:02 +00:00
|
|
|
.\light -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension `
|
|
|
|
-cultures:en-us `
|
|
|
|
dotnet.wixobj `
|
|
|
|
provider.wixobj `
|
|
|
|
registrykeys.wixobj `
|
|
|
|
$InstallFilesWixobj `
|
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"
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(Test-Path $PackageDir))
|
|
|
|
{
|
|
|
|
mkdir $PackageDir | Out-Null
|
|
|
|
}
|
|
|
|
|
2016-01-12 23:27:02 +00:00
|
|
|
$DotnetMSIOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.msi"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"
|
|
|
|
|
|
|
|
$WixRoot = AcquireWixTools
|
|
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
{
|
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-12-28 19:47:21 +00:00
|
|
|
_ $PSScriptRoot\testmsi.ps1 @("$DotnetMSIOutput")
|
2015-11-17 08:39:46 +00:00
|
|
|
|
2015-11-18 04:32:02 +00:00
|
|
|
$PublishScript = Join-Path $PSScriptRoot "..\..\scripts\publish\publish.ps1"
|
|
|
|
& $PublishScript -file $DotnetMSIOutput
|
|
|
|
|
|
|
|
exit $LastExitCode
|