|
| 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]$DotnetMSIOutput, |
| 7 | + [Parameter(Mandatory=$true)][string]$WixRoot, |
| 8 | + [Parameter(Mandatory=$true)][string]$ProductMoniker, |
| 9 | + [Parameter(Mandatory=$true)][string]$DotnetMSIVersion, |
| 10 | + [Parameter(Mandatory=$true)][string]$SDKBundleVersion, |
| 11 | + [Parameter(Mandatory=$true)][string]$DotnetCLINugetVersion, |
| 12 | + [Parameter(Mandatory=$true)][string]$UpgradeCode, |
| 13 | + [Parameter(Mandatory=$true)][string]$DependencyKeyName, |
| 14 | + [Parameter(Mandatory=$true)][string]$Architecture |
| 15 | +) |
| 16 | + |
| 17 | +$InstallFileswsx = ".\manifest-install-files.wxs" |
| 18 | +$InstallFilesWixobj = "manifest-install-files.wixobj" |
| 19 | + |
| 20 | +function RunHeat |
| 21 | +{ |
| 22 | + $result = $true |
| 23 | + pushd "$WixRoot" |
| 24 | + |
| 25 | + Write-Information "Running heat.." |
| 26 | + |
| 27 | + $heatOutput = .\heat.exe dir `"$inputDir`" -template fragment ` |
| 28 | + -sreg -ag ` |
| 29 | + -var var.DotnetSrc ` |
| 30 | + -cg InstallFiles ` |
| 31 | + -srd ` |
| 32 | + -dr DOTNETHOME ` |
| 33 | + -out manifest-install-files.wxs |
| 34 | + |
| 35 | + Write-Information "Heat output: $heatOutput" |
| 36 | + |
| 37 | + if($LastExitCode -ne 0) |
| 38 | + { |
| 39 | + $result = $false |
| 40 | + Write-Information "Heat failed with exit code $LastExitCode." |
| 41 | + } |
| 42 | + |
| 43 | + popd |
| 44 | + Write-Information "RunHeat result: $result" |
| 45 | + return $result |
| 46 | +} |
| 47 | + |
| 48 | +function RunCandle |
| 49 | +{ |
| 50 | + $result = $true |
| 51 | + pushd "$WixRoot" |
| 52 | + |
| 53 | + Write-Information "Running candle.." |
| 54 | + |
| 55 | + $candleOutput = .\candle.exe -nologo ` |
| 56 | + -dDotnetSrc="$inputDir" ` |
| 57 | + -dMicrosoftEula="$PSScriptRoot\dummyeula.rtf" ` |
| 58 | + -dProductMoniker="$ProductMoniker" ` |
| 59 | + -dBuildVersion="$DotnetMSIVersion" ` |
| 60 | + -dSDKBundleVersion="$SDKBundleVersion" ` |
| 61 | + -dNugetVersion="$DotnetCLINugetVersion" ` |
| 62 | + -dUpgradeCode="$UpgradeCode" ` |
| 63 | + -dDependencyKeyName="$DependencyKeyName" ` |
| 64 | + -arch "$Architecture" ` |
| 65 | + -ext WixDependencyExtension.dll ` |
| 66 | + "$PSScriptRoot\manifests.wxs" ` |
| 67 | + "$PSScriptRoot\provider.wxs" ` |
| 68 | + $InstallFileswsx |
| 69 | + |
| 70 | + Write-Information "Candle output: $candleOutput" |
| 71 | + |
| 72 | + if($LastExitCode -ne 0) |
| 73 | + { |
| 74 | + $result = $false |
| 75 | + Write-Information "Candle failed with exit code $LastExitCode." |
| 76 | + } |
| 77 | + |
| 78 | + popd |
| 79 | + return $result |
| 80 | +} |
| 81 | + |
| 82 | +function RunLight |
| 83 | +{ |
| 84 | + $result = $true |
| 85 | + pushd "$WixRoot" |
| 86 | + |
| 87 | + Write-Information "Running light.." |
| 88 | + $CabCache = Join-Path $WixRoot "cabcache" |
| 89 | + |
| 90 | + $lightOutput = .\light.exe -nologo -ext WixUIExtension -ext WixDependencyExtension -ext WixUtilExtension ` |
| 91 | + -cultures:en-us ` |
| 92 | + manifests.wixobj ` |
| 93 | + provider.wixobj ` |
| 94 | + $InstallFilesWixobj ` |
| 95 | + -b "$inputDir" ` |
| 96 | + -b "$PSScriptRoot" ` |
| 97 | + -reusecab ` |
| 98 | + -cc "$CabCache" ` |
| 99 | + -out $DotnetMSIOutput |
| 100 | + |
| 101 | + Write-Information "Light output: $lightOutput" |
| 102 | + |
| 103 | + if($LastExitCode -ne 0) |
| 104 | + { |
| 105 | + $result = $false |
| 106 | + Write-Information "Light failed with exit code $LastExitCode." |
| 107 | + } |
| 108 | + |
| 109 | + popd |
| 110 | + return $result |
| 111 | +} |
| 112 | + |
| 113 | +if(!(Test-Path $inputDir)) |
| 114 | +{ |
| 115 | + throw "$inputDir not found" |
| 116 | +} |
| 117 | + |
| 118 | +Write-Information "Creating manifests MSI at $DotnetMSIOutput" |
| 119 | + |
| 120 | +if([string]::IsNullOrEmpty($WixRoot)) |
| 121 | +{ |
| 122 | + Exit -1 |
| 123 | +} |
| 124 | + |
| 125 | +if(-Not (RunHeat)) |
| 126 | +{ |
| 127 | + Write-Information "Heat failed" |
| 128 | + Exit -1 |
| 129 | +} |
| 130 | + |
| 131 | +if(-Not (RunCandle)) |
| 132 | +{ |
| 133 | + Write-Information "Candle failed" |
| 134 | + Exit -1 |
| 135 | +} |
| 136 | + |
| 137 | +if(-Not (RunLight)) |
| 138 | +{ |
| 139 | + Write-Information "Light failed" |
| 140 | + Exit -1 |
| 141 | +} |
| 142 | + |
| 143 | +if(!(Test-Path $DotnetMSIOutput)) |
| 144 | +{ |
| 145 | + throw "Unable to create the manifests MSI." |
| 146 | + Exit -1 |
| 147 | +} |
| 148 | + |
| 149 | +Write-Information "Successfully created manifests MSI - $DotnetMSIOutput" |
| 150 | + |
| 151 | +exit $LastExitCode |
0 commit comments