|
23 | 23 | "lib-Windows.Devices.Pwm", |
24 | 24 | "lib-Windows.Devices.Spi", |
25 | 25 | "lib-nanoFramework.Networking.Sntp", |
26 | | - "lib-nanoFramework.Hardware.Stm32") |
| 26 | + "lib-nanoFramework.Hardware.Stm32", |
| 27 | + "lib-nanoFramework.System.Math") |
27 | 28 |
|
28 | 29 | ForEach($library in $librariesToUpdate) |
29 | 30 | { |
|
46 | 47 | # find solution file in repository |
47 | 48 | $solutionFile = (Get-ChildItem -Path ".\" -Include "*.sln" -Recurse) |
48 | 49 |
|
49 | | - # run NuKeeper inspect |
50 | | - if ($env:APPVEYOR_REPO_BRANCH -like '*release*' -or $env:APPVEYOR_REPO_BRANCH -like '*master*') |
51 | | - { |
52 | | - # use NuGet ONLY for release and master branches |
53 | | - $nukeeperInspect = NuKeeper inspect --source https://api.nuget.org/v3/index.json |
54 | | - } |
55 | | - else |
56 | | - { |
57 | | - # use NuGet and MyGet for all others |
58 | | - $nukeeperInspect = NuKeeper inspect |
59 | | - } |
| 50 | + # find packages.config |
| 51 | + $packagesConfig = (Get-ChildItem -Path ".\" -Include "packages.config" -Recurse) |
60 | 52 |
|
61 | | - "NuGet update inspection result:" | Write-Host -ForegroundColor Cyan |
62 | | - $nukeeperInspect | Write-Host -ForegroundColor White |
| 53 | + # load packages.config as XML doc |
| 54 | + [xml]$packagesDoc = Get-Content $packagesConfig |
63 | 55 |
|
64 | | - $packageCountMatch = [regex]::Match($nukeeperInspect, "Found (\d) possible updates").captures.groups[1].value |
65 | | - [int]$packageCount = 0 |
66 | | - [int]::TryParse($packageCountMatch, [ref]$packageCount) |
| 56 | + $nodes = $packagesDoc.SelectNodes("*").SelectNodes("*") |
67 | 57 |
|
68 | | - if ($packageCount -gt 0) |
69 | | - { |
70 | | - # get packages to update |
71 | | - $packageListRaw = [regex]::Match($nukeeperInspect, "(?>possible updates([^$]*)Found)").captures.Groups[1].Value; |
72 | | - [array]$packageList = $packageListRaw.Split([Environment]::NewLine, [StringSplitOptions]::RemoveEmptyEntries).Replace([Environment]::NewLine, "") |
| 58 | + $packageList = @(,@()) |
73 | 59 |
|
74 | | - # restore NuGet packages, need to do this before anything else |
75 | | - if ($env:APPVEYOR_REPO_BRANCH -like '*release*' -or $env:APPVEYOR_REPO_BRANCH -like '*master*') |
76 | | - { |
77 | | - # use NuGet ONLY for release and master branches |
78 | | - nuget restore $solutionFile[0] -Source https://api.nuget.org/v3/index.json |
79 | | - } |
80 | | - else |
| 60 | + foreach ($node in $nodes) |
| 61 | + { |
| 62 | + # filter out NuProj packages |
| 63 | + if($node.id -notlike "NuProj*") |
81 | 64 | { |
82 | | - # use NuGet and MyGet for all others |
83 | | - nuget restore $solutionFile[0] -Source https://www.myget.org/F/nanoframework-dev/api/v3/index.json -Source https://api.nuget.org/v3/index.json |
| 65 | + if($packageList) |
| 66 | + { |
| 67 | + $packageList += , ($node.id, $node.version) |
| 68 | + } |
| 69 | + else |
| 70 | + { |
| 71 | + $packageList = , ($node.id, $node.version) |
| 72 | + } |
84 | 73 | } |
85 | | - |
| 74 | + } |
| 75 | + |
| 76 | + if ($packageList.length -gt 0) |
| 77 | + { |
| 78 | + "NuGet packages to update:" | Write-Host -ForegroundColor White |
| 79 | + $packageList | Write-Host -ForegroundColor White |
| 80 | + |
| 81 | + # restore NuGet packages, need to do this before anything else |
| 82 | + nuget restore $solutionFile[0] -Source https://www.myget.org/F/nanoframework-dev/api/v3/index.json -Source https://api.nuget.org/v3/index.json |
| 83 | + |
86 | 84 | # rename nfproj files to csproj |
87 | 85 | Get-ChildItem -Path ".\" -Include "*.nfproj" -Recurse | |
88 | 86 | Foreach-object { |
|
95 | 93 | foreach ($package in $packageList) |
96 | 94 | { |
97 | 95 | # get package name and target version |
98 | | - $packageDetails = [regex]::Match($package, "(.*)(( from)(.*)(to )(.*)( in))") |
99 | | - $packageName = $packageDetails.captures.Groups[1].Value.Trim(); |
100 | | - $packageOriginVersion = $packageDetails.captures.Groups[4].Value.Trim(); |
101 | | - $packageTargetVersion = $packageDetails.captures.Groups[6].Value.Trim(); |
| 96 | + $packageName = $package[0] |
| 97 | + $packageOriginVersion = $package[1] |
102 | 98 |
|
103 | 99 | # update package |
104 | 100 | if ($env:APPVEYOR_REPO_BRANCH -like '*release*' -or $env:APPVEYOR_REPO_BRANCH -like '*master*') |
105 | 101 | { |
106 | | - # use NuGet ONLY for release and master branches |
107 | | - $updatePackage = nuget update $solutionFile[0].FullName -Source https://api.nuget.org/v3/index.json |
| 102 | + # don't allow prerelease for release and master branches |
| 103 | + $updatePackage = nuget update $solutionFile[0].FullName -Source https://api.nuget.org/v3/index.json -Source https://api.nuget.org/v3/index.json |
108 | 104 | } |
109 | 105 | else |
110 | 106 | { |
111 | | - # use NuGet and MyGet for all others |
112 | | - $updatePackage = nuget update $solutionFile[0].FullName -Source https://www.myget.org/F/nanoframework-dev/api/v3/index.json -Source https://api.nuget.org/v3/index.json |
| 107 | + # allow prerelease for all others |
| 108 | + $updatePackage = nuget update $solutionFile[0].FullName -Source https://www.myget.org/F/nanoframework-dev/api/v3/index.json -Source https://api.nuget.org/v3/index.json -PreRelease |
| 109 | + } |
| 110 | + |
| 111 | + # need to get target version |
| 112 | + # load packages.config as XML doc |
| 113 | + [xml]$packagesDoc = Get-Content $packagesConfig |
| 114 | + |
| 115 | + $nodes = $packagesDoc.SelectNodes("*").SelectNodes("*") |
| 116 | + |
| 117 | + foreach ($node in $nodes) |
| 118 | + { |
| 119 | + # find this package |
| 120 | + if($node.id -match $packageName) |
| 121 | + { |
| 122 | + $packageTargetVersion = $node.version |
| 123 | + } |
113 | 124 | } |
114 | 125 |
|
115 | | - # grab csproj from update output |
116 | | - $projectPath = [regex]::Match($updatePackage, "((project ')(.*)(', targeting))").captures.Groups[3].Value |
| 126 | + # find csproj |
| 127 | + $projectPath = (Get-ChildItem -Path ".\" -Include "*.csproj" -Recurse) |
117 | 128 |
|
118 | 129 | # replace NFMDP_PE_LoadHints |
119 | 130 | $filecontent = Get-Content($projectPath) |
|
0 commit comments