From 6b447423a0e121060268eb3693dda0959b6a60f7 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Mon, 4 Feb 2019 11:48:48 -0800 Subject: [PATCH] Add instrumentation for Start-PSPackage (#8811) Add instrumentation for start-PSPackage saying what parameters it thinks you used --- tools/packaging/packaging.psm1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 16ed17f92e..1172516487 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -93,6 +93,7 @@ function Start-PSPackage { } $Script:Options = Get-PSOptions + $actualParams = @() $crossGenCorrect = $false if ($Runtime -match "arm") { @@ -100,6 +101,7 @@ function Start-PSPackage { $crossGenCorrect = $true } elseif ($Script:Options.CrossGen) { + $actualParams += '-CrossGen' $crossGenCorrect = $true } @@ -108,11 +110,15 @@ function Start-PSPackage { # Require PSModuleRestore for packaging without symbols # But Disallow it when packaging with symbols if (!$IncludeSymbols.IsPresent -and $Script:Options.PSModuleRestore) { + $actualParams += '-PSModuleRestore' $PSModuleRestoreCorrect = $true } elseif ($IncludeSymbols.IsPresent -and !$Script:Options.PSModuleRestore) { $PSModuleRestoreCorrect = $true } + else { + $actualParams += '-PSModuleRestore' + } $precheckFailed = if ($Type -eq 'fxdependent' -or $Type -eq 'tar-alpine') { ## We do not check for runtime and crossgen for framework dependent package. @@ -141,6 +147,8 @@ function Start-PSPackage { # This check serves as a simple gate to ensure that the user knows what he is doing, and # 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. + + $params = @('-Clean') # CrossGen cannot be done for framework dependent package as it is runtime agnostic. @@ -152,6 +160,8 @@ function Start-PSPackage { $params += '-PSModuleRestore' } + $actualParams += '-Runtime ' + $Script:Options.Runtime + if ($Type -eq 'fxdependent') { $params += '-Runtime', 'fxdependent' } else { @@ -159,7 +169,9 @@ function Start-PSPackage { } $params += '-Configuration', $Configuration + $actualParams += '-Configuration ' + $Script:Options.Configuration + Write-Warning "Build started with unexpected parameters 'Start-PSBuild $actualParams" throw "Please ensure you have run 'Start-PSBuild $params'!" }