Skip to content

Commit a90b03b

Browse files
authored
Fix semver issue with updating cgmanifest (PowerShell#24132)
1 parent 828c327 commit a90b03b

File tree

2 files changed

+55
-41
lines changed

2 files changed

+55
-41
lines changed

tools/cgmanifest.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"$schema": "https://json.schemastore.org/component-detection-manifest.json",
32
"Registrations": [
43
{
54
"Component": {
@@ -36,7 +35,7 @@
3635
"Type": "nuget",
3736
"Nuget": {
3837
"Name": "Json.More.Net",
39-
"Version": "2.0.0"
38+
"Version": "2.0.1.2"
4039
}
4140
},
4241
"DevelopmentDependency": false
@@ -46,7 +45,7 @@
4645
"Type": "nuget",
4746
"Nuget": {
4847
"Name": "JsonPointer.Net",
49-
"Version": "4.0.0"
48+
"Version": "5.0.0"
5049
}
5150
},
5251
"DevelopmentDependency": false
@@ -56,7 +55,7 @@
5655
"Type": "nuget",
5756
"Nuget": {
5857
"Name": "JsonSchema.Net",
59-
"Version": "6.0.2"
58+
"Version": "7.0.1"
6059
}
6160
},
6261
"DevelopmentDependency": false
@@ -66,7 +65,7 @@
6665
"Type": "nuget",
6766
"Nuget": {
6867
"Name": "Markdig.Signed",
69-
"Version": "0.34.0"
68+
"Version": "0.37.0"
7069
}
7170
},
7271
"DevelopmentDependency": false
@@ -86,7 +85,7 @@
8685
"Type": "nuget",
8786
"Nuget": {
8887
"Name": "Microsoft.Bcl.AsyncInterfaces",
89-
"Version": "5.0.0"
88+
"Version": "8.0.0"
9089
}
9190
},
9291
"DevelopmentDependency": false
@@ -106,7 +105,7 @@
106105
"Type": "nuget",
107106
"Nuget": {
108107
"Name": "Microsoft.CodeAnalysis.Common",
109-
"Version": "4.8.0"
108+
"Version": "4.9.2"
110109
}
111110
},
112111
"DevelopmentDependency": false
@@ -116,7 +115,7 @@
116115
"Type": "nuget",
117116
"Nuget": {
118117
"Name": "Microsoft.CodeAnalysis.CSharp",
119-
"Version": "4.8.0"
118+
"Version": "4.9.2"
120119
}
121120
},
122121
"DevelopmentDependency": false
@@ -126,7 +125,7 @@
126125
"Type": "nuget",
127126
"Nuget": {
128127
"Name": "Microsoft.Extensions.ObjectPool",
129-
"Version": "5.0.10"
128+
"Version": "8.0.4"
130129
}
131130
},
132131
"DevelopmentDependency": false
@@ -226,7 +225,7 @@
226225
"Type": "nuget",
227226
"Nuget": {
228227
"Name": "Microsoft.Windows.Compatibility",
229-
"Version": "8.0.2"
228+
"Version": "8.0.7"
230229
}
231230
},
232231
"DevelopmentDependency": false
@@ -246,7 +245,7 @@
246245
"Type": "nuget",
247246
"Nuget": {
248247
"Name": "runtime.android-arm.runtime.native.System.IO.Ports",
249-
"Version": "9.0.0-preview.1.24080.9"
248+
"Version": "9.0.0-preview.3.24172.9"
250249
}
251250
},
252251
"DevelopmentDependency": false
@@ -256,7 +255,7 @@
256255
"Type": "nuget",
257256
"Nuget": {
258257
"Name": "runtime.android-arm64.runtime.native.System.IO.Ports",
259-
"Version": "9.0.0-preview.1.24080.9"
258+
"Version": "9.0.0-preview.3.24172.9"
260259
}
261260
},
262261
"DevelopmentDependency": false
@@ -266,7 +265,7 @@
266265
"Type": "nuget",
267266
"Nuget": {
268267
"Name": "runtime.android-x64.runtime.native.System.IO.Ports",
269-
"Version": "9.0.0-preview.1.24080.9"
268+
"Version": "9.0.0-preview.3.24172.9"
270269
}
271270
},
272271
"DevelopmentDependency": false
@@ -276,7 +275,7 @@
276275
"Type": "nuget",
277276
"Nuget": {
278277
"Name": "runtime.android-x86.runtime.native.System.IO.Ports",
279-
"Version": "9.0.0-preview.1.24080.9"
278+
"Version": "9.0.0-preview.3.24172.9"
280279
}
281280
},
282281
"DevelopmentDependency": false
@@ -306,7 +305,7 @@
306305
"Type": "nuget",
307306
"Nuget": {
308307
"Name": "runtime.linux-bionic-arm64.runtime.native.System.IO.Ports",
309-
"Version": "9.0.0-preview.1.24080.9"
308+
"Version": "9.0.0-preview.3.24172.9"
310309
}
311310
},
312311
"DevelopmentDependency": false
@@ -316,7 +315,7 @@
316315
"Type": "nuget",
317316
"Nuget": {
318317
"Name": "runtime.linux-bionic-x64.runtime.native.System.IO.Ports",
319-
"Version": "9.0.0-preview.1.24080.9"
318+
"Version": "9.0.0-preview.3.24172.9"
320319
}
321320
},
322321
"DevelopmentDependency": false
@@ -326,7 +325,7 @@
326325
"Type": "nuget",
327326
"Nuget": {
328327
"Name": "runtime.linux-musl-arm.runtime.native.System.IO.Ports",
329-
"Version": "9.0.0-preview.1.24080.9"
328+
"Version": "9.0.0-preview.3.24172.9"
330329
}
331330
},
332331
"DevelopmentDependency": false
@@ -336,7 +335,7 @@
336335
"Type": "nuget",
337336
"Nuget": {
338337
"Name": "runtime.linux-musl-arm64.runtime.native.System.IO.Ports",
339-
"Version": "9.0.0-preview.1.24080.9"
338+
"Version": "9.0.0-preview.3.24172.9"
340339
}
341340
},
342341
"DevelopmentDependency": false
@@ -346,7 +345,7 @@
346345
"Type": "nuget",
347346
"Nuget": {
348347
"Name": "runtime.linux-musl-x64.runtime.native.System.IO.Ports",
349-
"Version": "9.0.0-preview.1.24080.9"
348+
"Version": "9.0.0-preview.3.24172.9"
350349
}
351350
},
352351
"DevelopmentDependency": false
@@ -366,7 +365,7 @@
366365
"Type": "nuget",
367366
"Nuget": {
368367
"Name": "runtime.maccatalyst-arm64.runtime.native.System.IO.Ports",
369-
"Version": "9.0.0-preview.1.24080.9"
368+
"Version": "9.0.0-preview.3.24172.9"
370369
}
371370
},
372371
"DevelopmentDependency": false
@@ -376,7 +375,7 @@
376375
"Type": "nuget",
377376
"Nuget": {
378377
"Name": "runtime.maccatalyst-x64.runtime.native.System.IO.Ports",
379-
"Version": "9.0.0-preview.1.24080.9"
378+
"Version": "9.0.0-preview.3.24172.9"
380379
}
381380
},
382381
"DevelopmentDependency": false
@@ -556,7 +555,7 @@
556555
"Type": "nuget",
557556
"Nuget": {
558557
"Name": "System.Diagnostics.DiagnosticSource",
559-
"Version": "8.0.0"
558+
"Version": "8.0.1"
560559
}
561560
},
562561
"DevelopmentDependency": false
@@ -616,7 +615,7 @@
616615
"Type": "nuget",
617616
"Nuget": {
618617
"Name": "System.Drawing.Common",
619-
"Version": "8.0.2"
618+
"Version": "8.0.7"
620619
}
621620
},
622621
"DevelopmentDependency": false
@@ -626,7 +625,7 @@
626625
"Type": "nuget",
627626
"Nuget": {
628627
"Name": "System.Formats.Asn1",
629-
"Version": "8.0.0"
628+
"Version": "8.0.1"
630629
}
631630
},
632631
"DevelopmentDependency": false
@@ -666,7 +665,7 @@
666665
"Type": "nuget",
667666
"Nuget": {
668667
"Name": "System.Net.Http.WinHttpHandler",
669-
"Version": "8.0.0"
668+
"Version": "8.0.1"
670669
}
671670
},
672671
"DevelopmentDependency": false
@@ -746,7 +745,7 @@
746745
"Type": "nuget",
747746
"Nuget": {
748747
"Name": "System.Security.AccessControl",
749-
"Version": "6.0.0"
748+
"Version": "6.0.1"
750749
}
751750
},
752751
"DevelopmentDependency": false
@@ -776,7 +775,7 @@
776775
"Type": "nuget",
777776
"Nuget": {
778777
"Name": "System.Security.Cryptography.Xml",
779-
"Version": "8.0.0"
778+
"Version": "8.0.1"
780779
}
781780
},
782781
"DevelopmentDependency": false
@@ -931,5 +930,6 @@
931930
},
932931
"DevelopmentDependency": false
933932
}
934-
]
933+
],
934+
"$schema": "https://json.schemastore.org/component-detection-manifest.json"
935935
}

tools/findMissingNotices.ps1

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ if (!$IsWindows) {
8888
Write-Warning "Always using $winDesktopSdk since this is not windows!!!"
8989
}
9090

91+
function ConvertTo-SemVer {
92+
param(
93+
[String] $Version
94+
)
95+
96+
[System.Management.Automation.SemanticVersion]$desiredVersion = [System.Management.Automation.SemanticVersion]::Empty
97+
98+
try {
99+
$desiredVersion = $Version
100+
} catch {
101+
<#
102+
Json.More.Net broke the rules and published 2.0.1.2 as 2.0.1.
103+
So, I'm making the logic work for that scenario by
104+
thorwing away any part that doesn't match non-pre-release semver portion
105+
#>
106+
$null = $Version -match '^(\d+\.\d+\.\d+)).*'
107+
$desiredVersion = $matches[1]
108+
}
109+
110+
return $desiredVersion
111+
}
112+
91113
function New-NugetComponent {
92114
param(
93115
[string]$name,
@@ -125,23 +147,15 @@ function Get-NuGetPublicVersion {
125147
return $nugetPublicVersionCache[$Name]
126148
}
127149

128-
try {
129-
[System.Management.Automation.SemanticVersion]$desiredVersion = $Version
130-
} catch {
131-
[Version]$desiredVersion = $Version
132-
}
150+
[System.Management.Automation.SemanticVersion]$desiredVersion = ConvertTo-SemVer -Version $Version
133151

134152
$publicVersion = $null
135153
$publicVersion = Find-Package -Name $Name -AllowPrereleaseVersions -source $packageSourceName -AllVersions -ErrorAction SilentlyContinue | ForEach-Object {
136-
try {
137-
$packageVersion = [System.Management.Automation.SemanticVersion]$_.Version
138-
} catch {
139-
# Fall back to using [version] if it is not a semantic version
140-
$packageVersion = $_.Version
141-
}
142-
154+
[System.Management.Automation.SemanticVersion]$packageVersion = ConvertTo-SemVer -Version $_.Version
143155
$_ | Add-Member -Name SemVer -MemberType NoteProperty -Value $packageVersion -PassThru
144-
} | Where-Object { $_.SemVer -le $desiredVersion } | Sort-Object -Property semver -Descending | Select-Object -First 1 -ExpandProperty Version
156+
} | Where-Object {
157+
$_.SemVer -le $desiredVersion
158+
} | Sort-Object -Property semver -Descending | Select-Object -First 1 -ExpandProperty Version
145159

146160
if(!$publicVersion) {
147161
Write-Warning "No public version found for $Name, using $Version"

0 commit comments

Comments
 (0)