diff --git a/PSCompatibilityCollector/build.ps1 b/PSCompatibilityCollector/build.ps1 index d015d4453..fd70aa716 100644 --- a/PSCompatibilityCollector/build.ps1 +++ b/PSCompatibilityCollector/build.ps1 @@ -57,7 +57,13 @@ function Invoke-CrossCompatibilityModuleBuild Push-Location $script:BinModSrcDir try { - dotnet publish -f $Framework -c $Configuration + if ( test-path "$HOME/.dotnet/dotnet" ) { + $dotnet = "$HOME/.dotnet/dotnet" + } + else { + $dotnet = "dotnet" + } + & $dotnet publish -f $Framework -c $Configuration } finally { diff --git a/Tests/Engine/CustomizedRule.tests.ps1 b/Tests/Engine/CustomizedRule.tests.ps1 index 301586667..9425e2fdc 100644 --- a/Tests/Engine/CustomizedRule.tests.ps1 +++ b/Tests/Engine/CustomizedRule.tests.ps1 @@ -97,10 +97,10 @@ Describe "Test importing correct customized rules" { It "will show the custom rules when given a glob" { # needs fixing for Linux $expectedNumRules = 4 - if ($IsLinux) - { - $expectedNumRules = 3 - } + #if ($IsLinux) + #{ + # $expectedNumRules = 3 + #} $customizedRulePath = Get-ScriptAnalyzerRule -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -match $measure} $customizedRulePath.Count | Should -Be $expectedNumRules } @@ -113,10 +113,10 @@ Describe "Test importing correct customized rules" { It "will show the custom rules when given glob with recurse switch" { # needs fixing for Linux $expectedNumRules = 5 - if ($IsLinux) - { - $expectedNumRules = 4 - } + #if ($IsLinux) + #{ + # $expectedNumRules = 4 + #} $customizedRulePath = Get-ScriptAnalyzerRule -RecurseCustomRulePath -CustomizedRulePath $directory\samplerule\samplerule* | Where-Object {$_.RuleName -eq $measure} $customizedRulePath.Count | Should -Be $expectedNumRules } diff --git a/appveyor.yml b/appveyor.yml index d3f02b1be..81bcb51a4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,15 +3,15 @@ environment: BuildConfiguration: Release DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # For faster CI builds matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PowerShellEdition: PowerShellCore - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PowerShellEdition: WindowsPowerShell - - APPVEYOR_BUILD_WORKER_IMAGE: WMF 4 - PowerShellEdition: WindowsPowerShell - PSVersion: 4 - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu PowerShellEdition: PowerShellCore +# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# PowerShellEdition: PowerShellCore +# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 +# PowerShellEdition: WindowsPowerShell +# - APPVEYOR_BUILD_WORKER_IMAGE: WMF 4 +# PowerShellEdition: WindowsPowerShell +# PSVersion: 4 # cache Nuget packages and dotnet CLI cache cache: @@ -34,7 +34,9 @@ build_script: - pwsh: | if ($env:PowerShellEdition -eq 'PowerShellCore') { Set-Location $env:APPVEYOR_BUILD_FOLDER + Write-Verbose -Verbose "calling build.ps1" ./build.ps1 -Configuration "$env:BuildConfiguration" -PSVersion 6 + Write-Verbose -Verbose "calling PSCompatibility/build.ps1" ./PSCompatibilityCollector/build.ps1 -Configuration "$env:BuildConfiguration" -Framework 'netstandard2.0' } diff --git a/build.psm1 b/build.psm1 index b7bffba05..c1cba780b 100644 --- a/build.psm1 +++ b/build.psm1 @@ -156,10 +156,11 @@ function Start-ScriptAnalyzerBuild ) BEGIN { + Write-Verbose -Verbose "Start-ScriptAnalyzerBuild BEGIN" # don't allow the build to be started unless we have the proper Cli version # this will not actually install dotnet if it's already present, but it will # install the proper version - Install-Dotnet + Install-Dotnet -Verbose if ( -not (Test-SuitableDotnet) ) { $requiredVersion = Get-GlobalJsonSdkVersion $foundVersion = Get-InstalledCLIVersion @@ -168,6 +169,7 @@ function Start-ScriptAnalyzerBuild } END { + Write-Verbose -Verbose "Start-ScriptAnalyzerBuild END" # Build docs either when -Documentation switch is being specified or the first time in a clean repo $documentationFileExists = Test-Path (Join-Path $PSScriptRoot 'out\PSScriptAnalyzer\en-us\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll-Help.xml') if ( $Documentation -or -not $documentationFileExists ) @@ -246,11 +248,15 @@ function Start-ScriptAnalyzerBuild try { Push-Location $projectRoot/Rules Write-Progress "Building ScriptAnalyzer for PSVersion '$PSVersion' using framework '$framework' and configuration '$Configuration'" + Write-Verbose -verbose "Building ScriptAnalyzer for PSVersion '$PSVersion' using framework '$framework' and configuration '$Configuration'" if ( -not $script:DotnetExe ) { $script:DotnetExe = Get-DotnetExe } $buildOutput = & $script:DotnetExe build --framework $framework --configuration "$config" 2>&1 - if ( $LASTEXITCODE -ne 0 ) { throw "$buildOutput" } + if ( $LASTEXITCODE -ne 0 ) { + $buildOutput | Write-Verbose -Verbose + throw "$buildOutput" + } } catch { Write-Warning $_ @@ -261,6 +267,7 @@ function Start-ScriptAnalyzerBuild Pop-Location } + Write-Verbose -Verbose "Publish-File to ${script:destinationDir}" Publish-File $itemsToCopyCommon $script:destinationDir $itemsToCopyBinaries = @( @@ -390,6 +397,7 @@ function Install-Dotnet Push-Location $PSScriptRoot $installScriptPath = Receive-DotnetInstallScript $installScriptName = [System.IO.Path]::GetFileName($installScriptPath) + Write-Verbose -Verbose "installscript is $installScriptPath" If ( $PSCmdlet.ShouldProcess("$installScriptName for $version")) { & "${installScriptPath}" -c release -version $version } @@ -397,9 +405,11 @@ function Install-Dotnet # set up the executable variable if ( -not $script:DotnetExe ) { $script:DotnetExe = Get-DotnetExe + Write-Verbose -Verbose "Setting DotnetExe variable to ${script:DotnetExe}" } } catch { + Write-Warning "Failure build.psm1 line 407" throw $_ } finally { @@ -543,6 +553,7 @@ function Get-InstalledCLIVersion { } } catch { + Write-Warning "${script:DotnetExe} --list-sdks" Write-Verbose -Verbose "$_" $installedVersions = & $script:DotnetExe --version 2>$null } @@ -607,7 +618,9 @@ function Receive-DotnetInstallScript } $uri = "https://dot.net/v1/${installScriptName}" + Write-Verbose -Verbose "downloading $urt" $installScript = Receive-File -Uri $uri + Write-Verbose -Verbose "InstallScript is $installScript" return $installScript.FullName } @@ -640,9 +653,13 @@ function Get-DotnetExe $dotnetHuntPath = "$HOME/.dotnet/dotnet" Write-Verbose -Verbose "checking non-Windows $dotnetHuntPath" if ( test-path $dotnetHuntPath ) { + Write-Verbose -Verbose "$dotnetHuntPath found" $script:DotnetExe = $dotnetHuntPath return $dotnetHuntPath } + else { + Write-Verbose -Verbose "$dotnetHuntPath not found" + } } Write-Warning "Could not find dotnet executable" diff --git a/tools/appveyor.psm1 b/tools/appveyor.psm1 index 65dd71304..b0637b8f2 100644 --- a/tools/appveyor.psm1 +++ b/tools/appveyor.psm1 @@ -33,9 +33,17 @@ function Invoke-AppVeyorInstall { # the build script sorts out the problems of WMF4 and earlier versions of dotnet CLI Write-Verbose -Verbose "Installing required .Net CORE SDK" - Write-Verbose "& $buildScriptDir/build.ps1 -bootstrap" $buildScriptDir = (Resolve-Path "$PSScriptRoot/..").Path - & "$buildScriptDir/build.ps1" -bootstrap + Write-Verbose -Verbose "& $buildScriptDir/build.ps1 -bootstrap" + try { + & "$buildScriptDir/build.ps1" -bootstrap + Write-Verbose -Verbose "exiting Invoke-AppVeyorInstall ($LASTEXITCODE)" + $GLOBAL:LASTEXITCODE = $LASTEXITCODE = 0 + Write-Verbose -Verbose "bootstrap complete: $(get-date)" + } + catch { + Write-Warning "error in invocation of build.ps1 from Invoke-AppVeyorInstall" + } } # Implements AppVeyor 'test_script' step @@ -95,12 +103,19 @@ function Invoke-AppveyorTest { function Invoke-AppveyorFinish { $stagingDirectory = (Resolve-Path ..).Path $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - Add-Type -AssemblyName 'System.IO.Compression.FileSystem' - [System.IO.Compression.ZipFile]::CreateFromDirectory((Join-Path $pwd 'out'), $zipFile) - @( - # add test results as an artifact - (Get-ChildItem TestResults.xml) - # You can add other artifacts here - (Get-ChildItem $zipFile) - ) | ForEach-Object { Push-AppveyorArtifact $_.FullName } + $targetDir = Join-Path $pwd out + if ( ! ( test-path $targetDir ) ) { + # provide some additional data to help with debugging + Get-ChildItem $PWD | Write-Verbose -Verbose + } + else { + Add-Type -AssemblyName 'System.IO.Compression.FileSystem' + [System.IO.Compression.ZipFile]::CreateFromDirectory($targetDir, $zipFile) + @( + # add test results as an artifact + (Get-ChildItem TestResults.xml) + # You can add other artifacts here + (Get-ChildItem $zipFile) + ) | ForEach-Object { Push-AppveyorArtifact $_.FullName } + } }