From 35167ab4592dd7cfc625e6b5ecc3bd612d3a47cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 25 Oct 2018 23:58:36 +0100 Subject: [PATCH] Work on dependecies update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rework PS script and AppVeyor to remove Nukeeper (isn't able to search updates including preview packages) Signed-off-by: José Simões --- appveyor.yml | 1 - update-dependencies.ps1 | 42 ++++++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 77d8a99e..3a972ab9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -91,7 +91,6 @@ on_failure: & $env:APPVEYOR_BUILD_FOLDER\appveyor-discord.ps1 failure $env:APPVEYOR_DISCORD_WEBHOOK_URL on_success: - - dotnet tool install --global NuKeeper - ps: .\update-dependencies.ps1 cache: diff --git a/update-dependencies.ps1 b/update-dependencies.ps1 index 618aeb1c..4ff1fb1b 100644 --- a/update-dependencies.ps1 +++ b/update-dependencies.ps1 @@ -23,7 +23,8 @@ else "lib-Windows.Devices.Pwm", "lib-Windows.Devices.Spi", "lib-nanoFramework.Networking.Sntp", - "lib-nanoFramework.Hardware.Stm32") + "lib-nanoFramework.Hardware.Stm32", + "lib-nanoFramework.System.Math") ForEach($library in $librariesToUpdate) { @@ -46,30 +47,29 @@ else # find solution file in repository $solutionFile = (Get-ChildItem -Path ".\" -Include "*.sln" -Recurse) - # run NuKeeper inspect - if ($env:APPVEYOR_REPO_BRANCH -like '*release*' -or $env:APPVEYOR_REPO_BRANCH -like '*master*') - { - # use NuGet ONLY for release and master branches - $nukeeperInspect = NuKeeper inspect --source https://api.nuget.org/v3/index.json - } - else - { - # use NuGet and MyGet for all others - $nukeeperInspect = NuKeeper inspect - } + # find packages.config + $packagesConfig = (Get-ChildItem -Path ".\" -Include "packages.config" -Recurse) + + # load packages.config as XML doc + [xml]$packagesDoc = Get-Content $packagesConfig - "NuGet update inspection result:" | Write-Host -ForegroundColor Cyan - $nukeeperInspect | Write-Host -ForegroundColor White + $nodes = $packagesDoc.SelectNodes("*").SelectNodes("*") - $packageCountMatch = [regex]::Match($nukeeperInspect, "Found (\d) possible updates").captures.groups[1].value - [int]$packageCount = 0 - [int]::TryParse($packageCountMatch, [ref]$packageCount) + $packageList = @() + + foreach ($node in $nodes) + { + # filter out NuProj packages + if($node.id -notlike "NuProj*") + { + $packageList += $node.id + } + } - if ($packageCount -gt 0) + if ($packageList.length -gt 0) { - # get packages to update - $packageListRaw = [regex]::Match($nukeeperInspect, "(?>possible updates([^$]*)Found)").captures.Groups[1].Value; - [array]$packageList = $packageListRaw.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries).Replace([Environment]::NewLine, "") + "NuGet packages to update:" | Write-Host -ForegroundColor White + $packageList | Write-Host -ForegroundColor White # restore NuGet packages, need to do this before anything else if ($env:APPVEYOR_REPO_BRANCH -like '*release*' -or $env:APPVEYOR_REPO_BRANCH -like '*master*')