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 = ""
|
2016-01-28 09:46:03 +00:00
|
|
|
$DotnetBundleOutput = ""
|
2015-11-17 08:39:46 +00:00
|
|
|
$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
|
2016-01-28 09:46:03 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
popd
|
2015-11-17 08:39:46 +00:00
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
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..
|
2015-11-18 04:32:02 +00:00
|
|
|
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
|
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" `
|
|
|
|
-dBuildVersion="$env:DOTNET_MSI_VERSION" `
|
|
|
|
-dDisplayVersion="$env:DOTNET_CLI_VERSION" `
|
2016-01-14 23:03:32 +00:00
|
|
|
-dReleaseSuffix="$env:ReleaseSuffix" `
|
2016-01-13 23:24:09 +00:00
|
|
|
-arch x64 `
|
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"
|
|
|
|
$AuthWsxRoot = Join-Path $RepoRoot "packaging\windows"
|
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
|
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
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="$DotnetMSIOutput" `
|
|
|
|
-arch x64 `
|
|
|
|
-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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-17 08:39:46 +00:00
|
|
|
if(!(Test-Path $inputDir))
|
|
|
|
{
|
|
|
|
throw "$inputDir not found"
|
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
if(!(Test-Path $PackageDir))
|
2015-11-17 08:39:46 +00:00
|
|
|
{
|
|
|
|
mkdir $PackageDir | Out-Null
|
|
|
|
}
|
|
|
|
|
2016-01-12 23:27:02 +00:00
|
|
|
$DotnetMSIOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.msi"
|
2016-01-28 09:46:03 +00:00
|
|
|
$DotnetBundleOutput = Join-Path $PackageDir "dotnet-win-x64.$env:DOTNET_CLI_VERSION.exe"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
Write-Host "Creating dotnet MSI at $DotnetMSIOutput"
|
2016-01-28 09:46:03 +00:00
|
|
|
Write-Host "Creating dotnet Bundle at $DotnetBundleOutput"
|
2015-11-17 08:39:46 +00:00
|
|
|
|
|
|
|
$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))
|
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
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
if(-Not (RunCandleForBundle))
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
if(-Not (RunLightForBundle))
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2016-01-28 09:46:03 +00:00
|
|
|
if(!(Test-Path $DotnetBundleOutput))
|
|
|
|
{
|
|
|
|
throw "Unable to create the dotnet bundle."
|
|
|
|
Exit -1
|
|
|
|
}
|
|
|
|
|
2015-11-25 01:48:58 +00:00
|
|
|
Write-Host -ForegroundColor Green "Successfully created dotnet MSI - $DotnetMSIOutput"
|
2016-01-28 09:46:03 +00:00
|
|
|
Write-Host -ForegroundColor Green "Successfully created dotnet bundle - $DotnetBundleOutput"
|
2015-11-25 01:48:58 +00:00
|
|
|
|
2016-02-09 18:27:03 +00:00
|
|
|
_ $RepoRoot\test\Installer\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"
|
2016-02-10 21:06:48 +00:00
|
|
|
& $PublishScript -file $DotnetBundleOutput
|
2015-11-18 04:32:02 +00:00
|
|
|
|
|
|
|
exit $LastExitCode
|