From add08d399ff5c58b5f4718b41f774819fd52e17e Mon Sep 17 00:00:00 2001 From: Paul Higinbotham Date: Thu, 10 Feb 2022 15:40:20 -0800 Subject: [PATCH] Add warning messages when package precheck fails (#16867) --- tools/packaging/packaging.psm1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 3c9091a990..1437c5383e 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -159,6 +159,23 @@ function Start-PSPackage { # also ensure `Start-PSPackage` does what the user asks/expects, because once packages # are generated, it'll be hard to verify if they were built from the correct content. + Write-Warning -Message "Start-PSPackage: The build PreCheck has failed." + if (-not $Script:Options) { + Write-Warning -Message "Start-PSPackage: builid options variable is null indicating Start-PSBuild hasn't been run yet." + } + if (-not $PSModuleRestoreCorrect) { + Write-Warning -Message "Start-PSPackage: PSModuleRestoreCorrect variable is null indicating build -PSModuleRestore was not performed." + } + if ($Script:Options.Configuration -ne $Configuration) { + Write-Warning -Message "Start-PSPackage: Build configuration is incorrect: Expected: $Configuration Actual: $($Script:Options.Configuration)" + } + if ($Script:Options.Framework -ne $script:netCoreRuntime) { + Write-Warning -Message "Start-PSPackage: Build .NET version is incorrect: Expected: $($script:netCoreRuntime) Actual: $($Script:Options.Framework)" + } + if (($Type -notlike 'fxdependent*' -and $Type -ne 'tar-alpine') -and ($Script:Options.Runtime -ne $Runtime)) { + Write-Warning -Message "Start-PSPackage: Build RID does not match expected RID: Expected: $Runtime Actual: $($Script:Options.Runtime)" + } + $params = @('-Clean') if (!$IncludeSymbols.IsPresent) {