|
| 1 | +# Copyright (c) .NET Foundation and contributors. All rights reserved. |
| 2 | +# Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| 3 | + |
| 4 | +param( |
| 5 | + [Parameter(Mandatory=$true)][string]$inputDir, |
| 6 | + [Parameter(Mandatory=$true)][string]$MSBuildExtensionsMSIOutput, |
| 7 | + [Parameter(Mandatory=$true)][string]$WixRoot, |
| 8 | + [Parameter(Mandatory=$true)][string]$ProductMoniker, |
| 9 | + [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, |
| 10 | + [Parameter(Mandatory=$true)][string]$DotnetCLIDisplayVersion, |
| 11 | + [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion, |
| 12 | + [Parameter(Mandatory=$true)][string]$UpgradeCode, |
| 13 | + [Parameter(Mandatory=$true)][string]$Architecture |
| 14 | +) |
| 15 | + |
| 16 | +. "$PSScriptRoot\..\..\..\scripts\common\_common.ps1" |
| 17 | +$RepoRoot = Convert-Path "$PSScriptRoot\..\..\.." |
| 18 | + |
| 19 | +$InstallFileswsx = "install-files.wxs" |
| 20 | +$InstallFilesWixobj = "install-files.wixobj" |
| 21 | + |
| 22 | +function RunHeat |
| 23 | +{ |
| 24 | + $result = $true |
| 25 | + pushd "$WixRoot" |
| 26 | + |
| 27 | + Write-Output Running heat.. |
| 28 | + |
| 29 | + .\heat.exe dir `"$inputDir`" -template fragment -sreg -gg -var var.DotnetSrc -cg InstallFiles -srd -dr MSBUILDEXTENSIONSHOME -out $InstallFileswsx | Out-Host |
| 30 | + |
| 31 | + if($LastExitCode -ne 0) |
| 32 | + { |
| 33 | + $result = $false |
| 34 | + Write-Output "Heat failed with exit code $LastExitCode." |
| 35 | + } |
| 36 | + |
| 37 | + popd |
| 38 | + return $result |
| 39 | +} |
| 40 | + |
| 41 | +function RunCandle |
| 42 | +{ |
| 43 | + $result = $true |
| 44 | + pushd "$WixRoot" |
| 45 | + |
| 46 | + Write-Output Running candle.. |
| 47 | + $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions" |
| 48 | + |
| 49 | + .\candle.exe -nologo ` |
| 50 | + -dDotnetSrc="$inputDir" ` |
| 51 | + -dMicrosoftEula="$RepoRoot\packaging\windows\clisdk\dummyeula.rtf" ` |
| 52 | + -dProductMoniker="$ProductMoniker" ` |
| 53 | + -dBuildVersion="$DotnetMSIVersion" ` |
| 54 | + -dDisplayVersion="$DotnetCLIDisplayVersion" ` |
| 55 | + -dNugetVersion="$DotnetCLINugetVersion" ` |
| 56 | + -dUpgradeCode="$UpgradeCode" ` |
| 57 | + -arch "$Architecture" ` |
| 58 | + -ext WixDependencyExtension.dll ` |
| 59 | + "$AuthWsxRoot\msbuildextensions.wxs" ` |
| 60 | + "$AuthWsxRoot\provider.wxs" ` |
| 61 | + "$AuthWsxRoot\registrykeys.wxs" ` |
| 62 | + $InstallFileswsx | Out-Host |
| 63 | + |
| 64 | + if($LastExitCode -ne 0) |
| 65 | + { |
| 66 | + $result = $false |
| 67 | + Write-Output "Candle failed with exit code $LastExitCode." |
| 68 | + } |
| 69 | + |
| 70 | + popd |
| 71 | + return $result |
| 72 | +} |
| 73 | + |
| 74 | +function RunLight |
| 75 | +{ |
| 76 | + $result = $true |
| 77 | + pushd "$WixRoot" |
| 78 | + |
| 79 | + Write-Output Running light.. |
| 80 | + $CabCache = Join-Path $WixRoot "cabcache" |
| 81 | + $AuthWsxRoot = Join-Path $RepoRoot "packaging\windows\msbuildextensions" |
| 82 | + |
| 83 | + .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` |
| 84 | + -cultures:en-us ` |
| 85 | + msbuildextensions.wixobj ` |
| 86 | + provider.wixobj ` |
| 87 | + registrykeys.wixobj ` |
| 88 | + $InstallFilesWixobj ` |
| 89 | + -b "$inputDir" ` |
| 90 | + -b "$AuthWsxRoot" ` |
| 91 | + -reusecab ` |
| 92 | + -cc "$CabCache" ` |
| 93 | + -out $MSBuildExtensionsMSIOutput | Out-Host |
| 94 | + |
| 95 | + if($LastExitCode -ne 0) |
| 96 | + { |
| 97 | + $result = $false |
| 98 | + Write-Output "Light failed with exit code $LastExitCode." |
| 99 | + } |
| 100 | + |
| 101 | + popd |
| 102 | + return $result |
| 103 | +} |
| 104 | + |
| 105 | +if(!(Test-Path $inputDir)) |
| 106 | +{ |
| 107 | + throw "$inputDir not found" |
| 108 | +} |
| 109 | + |
| 110 | +Write-Output "Creating MSBuild Extensions MSI at $MSBuildExtensionsMSIOutput" |
| 111 | + |
| 112 | +if([string]::IsNullOrEmpty($WixRoot)) |
| 113 | +{ |
| 114 | + Exit -1 |
| 115 | +} |
| 116 | + |
| 117 | +if(-Not (RunHeat)) |
| 118 | +{ |
| 119 | + Exit -1 |
| 120 | +} |
| 121 | + |
| 122 | +if(-Not (RunCandle)) |
| 123 | +{ |
| 124 | + Exit -1 |
| 125 | +} |
| 126 | + |
| 127 | +if(-Not (RunLight)) |
| 128 | +{ |
| 129 | + Exit -1 |
| 130 | +} |
| 131 | + |
| 132 | +if(!(Test-Path $MSBuildExtensionsMSIOutput)) |
| 133 | +{ |
| 134 | + throw "Unable to create the MSBuild Extensions msi." |
| 135 | + Exit -1 |
| 136 | +} |
| 137 | + |
| 138 | +Write-Output -ForegroundColor Green "Successfully created MSBuild Extensions MSI - $MSBuildExtensionsMSIOutput" |
| 139 | + |
| 140 | +exit $LastExitCode |
0 commit comments