Refactor cgmanifest generator to include all components (#16326)

This commit is contained in:
Travis Plunk 2021-10-29 16:29:40 -07:00 committed by GitHub
parent c44c39c92b
commit 727326d78c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 745 additions and 51 deletions

View file

@ -0,0 +1,27 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
function Set-GWVariable {
param(
[Parameter(Mandatory = $true)]
[string]$Name,
[Parameter(Mandatory = $true)]
[string]$Value
)
Write-Verbose "Setting CI variable $Name to $Value" -Verbose
if ($env:GITHUB_ENV) {
"$Name=$Value" | Out-File $env:GITHUB_ENV -Append
}
}
function Get-GWTempPath {
$temp = [System.IO.Path]::GetTempPath()
if ($env:RUNNER_TEMP) {
$temp = $env:RUNNER_TEMP
}
Write-Verbose "Get CI Temp path: $temp" -Verbose
return $temp
}

View file

@ -30,18 +30,16 @@ jobs:
git fetch --prune --unshallow --tags
- name: Execute Update .NET script
run: |
Import-Module .github/workflows/GHWorkflowHelper
$currentVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
Write-Verbose "OLD_VERSION=$currentVersion" -Verbose
"OLD_VERSION=$currentVersion" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name OLD_VERSION -Value $currentVersion
./tools/UpdateDotnetRuntime.ps1 -UpdateMSIPackaging -UseInternalFeed
$newVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
Write-Verbose "NEW_VERSION=$newVersion" -Verbose
"NEW_VERSION=$newVersion" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name NEW_VERSION -Value $newVersion
if ($currentVersion -ne $newVersion) {
Write-Verbose "CREATE_PR=true" -Verbose
"CREATE_PR=true" | Out-File $env:GITHUB_ENV -Append
Set-GWVariable -Name CREATE_PR -Value 'true'
}
- name: Microsoft Teams Notifier
uses: skitionek/notify-microsoft-teams@master
@ -58,5 +56,26 @@ jobs:
title: "Update .NET SDK version from `${{ env.OLD_VERSION }}` to `${{ env.NEW_VERSION }}`"
base: master
branch: dotnet_update
update-tpn:
name: Update Notices File
timeout-minutes: 15
runs-on: windows-latest
if: github.repository == 'PowerShell/PowerShell'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Notices file
run: |
Invoke-WebRequest -Uri https://aka.ms/pwsh-daily-tpn -OutFile ./ThirdPartyNotices.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cprtpn
with:
commit-message: "Update to the latest license and the cgmanifest with missing or updated components"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Update to the latest license and the cgmanifest with missing or updated components"
reviewers: travisez13
base: master
draft: false
branch: update-cgmanifest

View file

@ -4,9 +4,9 @@
name: Update cgmanifest
on:
workflow_dispatch:
schedule:
# At 13:00 UTC every day.
- cron: '0 13 * * *'
pull_request:
branches:
- master
defaults:
run:
@ -15,6 +15,8 @@ defaults:
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
CGMANIFEST_PATH: ''
NUGET_PACKAGES: ${{ github.workspace }}\.nuget\packages
jobs:
update-cgmanifest:
@ -25,6 +27,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache DotNet
uses: actions/cache@v2
with:
path: |
~\AppData\Local\Microsoft\dotnet
${{ github.workspace }}\.nuget\packages
key: ${{ runner.os }}-${{ hashFiles('**\DotnetRuntimeMetadata.json') }}-${{ hashFiles('**\nuget.config') }}
- name: Sync tags
run: |
git fetch --prune --unshallow --tags
@ -35,30 +44,14 @@ jobs:
run: |
Import-Module ./build.psm1
Start-PSBootStrap
- name: Update Notices file
run: |
Invoke-WebRequest -Uri https://aka.ms/pwsh-daily-tpn -OutFile ./ThirdPartyNotices.txt
- name: Execute script to update cgmanifest
- name: Verify cgmanifest is up to date
run: |
Import-Module ./build.psm1
Find-Dotnet
./tools/findMissingNotices.ps1
- name: Microsoft Teams Notifier
uses: skitionek/notify-microsoft-teams@master
if: failure()
- name: Upload cgmanifest
uses: actions/upload-artifact@v2
if: always() && env.CGMANIFEST_PATH != ''
with:
webhook_url: ${{ secrets.PS_BUILD_TEAMS_CHANNEL }}
overwrite: "{title: `Failure in updating cgmanifest. Look at ${workflow_link}`}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
id: cpr
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
with:
commit-message: "Update to the latest license and the cgmanifest with missing or updated components"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Update to the latest license and the cgmanifest with missing or updated components"
reviewers: travisez13
base: master
draft: false
branch: update-cgmanifest
name: cgmanifest
path: ${{ env.CGMANIFEST_PATH }}

View file

@ -1,5 +1,65 @@
{
"Registrations": [
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "DotNetAnalyzers.DocumentationAnalyzers.Unstable",
"Version": "1.0.0.59"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "DotNetAnalyzers.DocumentationAnalyzers",
"Version": "1.0.0-beta.59"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Markdig.Signed",
"Version": "0.22.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.ApplicationInsights",
"Version": "2.18.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Bcl.AsyncInterfaces",
"Version": "5.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.CodeAnalysis.Analyzers",
"Version": "3.3.2"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
@ -20,6 +80,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.CodeAnalysis.NetAnalyzers",
"Version": "6.0.0"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
@ -30,6 +100,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Extensions.ObjectPool",
"Version": "5.0.10"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -90,6 +170,36 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.PowerShell.MarkdownRender",
"Version": "7.2.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.PowerShell.Native",
"Version": "7.2.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Win32.Registry.AccessControl",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -100,6 +210,56 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Win32.SystemEvents",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Microsoft.Windows.Compatibility",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Namotion.Reflection",
"Version": "2.0.3"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "Newtonsoft.Json",
"Version": "13.0.1"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "NJsonSchema",
"Version": "10.5.2"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -250,6 +410,56 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.linux-arm.runtime.native.System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.linux-arm64.runtime.native.System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.linux-x64.runtime.native.System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.native.System.Data.SqlClient.sni",
"Version": "4.7.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.native.System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -310,6 +520,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "runtime.osx-x64.runtime.native.System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -460,6 +680,36 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "StyleCop.Analyzers.Unstable",
"Version": "1.2.0.354"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "StyleCop.Analyzers",
"Version": "1.2.0-beta.354"
}
},
"DevelopmentDependency": true
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.CodeDom",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -480,6 +730,66 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ComponentModel.Composition.Registration",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ComponentModel.Composition",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Configuration.ConfigurationManager",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Data.Odbc",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Data.OleDb",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Data.SqlClient",
"Version": "4.8.3"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -500,6 +810,66 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Diagnostics.EventLog",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Diagnostics.PerformanceCounter",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.DirectoryServices.AccountManagement",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.DirectoryServices.Protocols",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.DirectoryServices",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Drawing.Common",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -510,6 +880,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Formats.Asn1",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -520,6 +900,26 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.IO.Packaging",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.IO.Ports",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -550,6 +950,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Management",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -560,6 +970,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Net.Http.WinHttpHandler",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -580,6 +1000,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Private.ServiceModel",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -590,6 +1020,16 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Reflection.Context",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -690,6 +1130,26 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Runtime.Caching",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Runtime.CompilerServices.Unsafe",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -730,6 +1190,56 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Security.AccessControl",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Security.Cryptography.Pkcs",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Security.Cryptography.ProtectedData",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Security.Cryptography.Xml",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Security.Permissions",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -740,6 +1250,86 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.Duplex",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.Http",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.NetTcp",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.Primitives",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.Security",
"Version": "4.9.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceModel.Syndication",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.ServiceProcess.ServiceController",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Speech",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -760,6 +1350,26 @@
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Text.Encodings.Web",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Threading.AccessControl",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
@ -799,6 +1409,16 @@
}
},
"DevelopmentDependency": false
},
{
"Component": {
"Type": "nuget",
"Nuget": {
"Name": "System.Windows.Extensions",
"Version": "6.0.0"
}
},
"DevelopmentDependency": false
}
]
}

11
prquantifier.yaml Normal file
View file

@ -0,0 +1,11 @@
# https://github.com/microsoft/PullRequestQuantifier/blob/main/docs/prquantifier-yaml.md
Excluded:
# defaults
- '*.csproj'
- prquantifier.yaml
- package-lock.json
- '*.md'
- '*.sln'
# autogenerated files
- cgmanifest.json
- assets/wix/files.wxs

View file

@ -5,14 +5,19 @@
# which is used to generate the notice file.
# Requires the module dotnet.project.assets from the PowerShell Gallery authored by @TravisEz13
param(
[switch] $Fix
)
Import-Module dotnet.project.assets
Import-Module "$PSScriptRoot\..\.github\workflows\GHWorkflowHelper" -Force
. "$PSScriptRoot\..\tools\buildCommon\startNativeExecution.ps1"
$existingRegistrationTable = @{}
$existingRegistrationsJson = Get-Content $PSScriptRoot\..\cgmanifest.json | ConvertFrom-Json -AsHashtable
$existingRegistrationsJson.Registrations | ForEach-Object {
$registration = [Registration]$_
if($registration.Component) {
if ($registration.Component) {
$name = $registration.Component.Name()
$existingRegistrationTable.Add($name, $registration)
}
@ -73,7 +78,8 @@ Class Nuget {
function New-NugetComponent {
param(
[string]$name,
[string]$version
[string]$version,
[switch]$DevelopmentDependency
)
$nuget = [Nuget]@{
@ -87,7 +93,7 @@ function New-NugetComponent {
$registration = [Registration]@{
Component = $Component
DevelopmentDependency = $false
DevelopmentDependency = $DevelopmentDependency
}
return $registration
@ -120,7 +126,7 @@ Function Get-CGRegistrations {
[System.Collections.Generic.Dictionary[string, Registration]] $RegistrationTable
)
$newRegistrations = $Registrations
$registrationChanged = $false
$dotnetTargetName = 'net6.0'
$dotnetTargetNameWin7 = 'net6.0-windows7.0'
@ -169,13 +175,7 @@ Function Get-CGRegistrations {
}
$null = New-PADrive -Path $PSScriptRoot\..\src\$folder\obj\project.assets.json -Name $folder
try {
$targets = Get-ChildItem -Path "${folder}:/targets/$target" -ErrorAction Stop | Where-Object {
$_.Type -eq 'package' -and
$_.Name -notlike 'DotNetAnalyzers.DocumentationAnalyzers*' -and
$_.Name -notlike 'StyleCop*' -and
$_.Name -notlike 'Microsoft.CodeAnalysis.Analyzers*' -and
$_.Name -notlike 'Microsoft.CodeAnalysis.NetAnalyzers*'
} | select-object -ExpandProperty name
$targets = Get-ChildItem -Path "${folder}:/targets/$target" -ErrorAction Stop | Where-Object { $_.Type -eq 'package' } | select-object -ExpandProperty name
} catch {
Get-ChildItem -Path "${folder}:/targets" | Out-String | Write-Verbose -Verbose
throw
@ -190,23 +190,32 @@ Function Get-CGRegistrations {
$parts = ($target -split '\|')
$name = $parts[0]
$targetVersion = $parts[1]
$pattern = [regex]::Escape($name) + " "
$tpnMatch = Select-String -Path $PSScriptRoot\..\ThirdPartyNotices.txt -Pattern $pattern
# Add the registration to the cgmanifest if the TPN does not contain the name of the target OR
# the exisitng CG contains the registration, because if the existing CG contains the registration,
# that might be the only reason it is in the TPN.
if ((!$tpnMatch -or $existingRegistrationTable.ContainsKey($name)) -and !$RegistrationTable.ContainsKey($target)) {
$registration = New-NugetComponent -Name $name -Version $targetVersion
if (!$RegistrationTable.ContainsKey($target)) {
$DevelopmentDependency = $false
if (!$existingRegistrationTable.ContainsKey($name) -or $existingRegistrationTable.$name.Component.Version() -ne $targetVersion) {
$registrationChanged = $true
}
if ($existingRegistrationTable.ContainsKey($name) -and $existingRegistrationTable.$name.DevelopmentDependency) {
$DevelopmentDependency = $true
}
$registration = New-NugetComponent -Name $name -Version $targetVersion -DevelopmentDependency:$DevelopmentDependency
$RegistrationTable.Add($target, $registration)
}
}
return $registrationChanged
}
$registrations = [System.Collections.Generic.Dictionary[string, Registration]]::new()
$lastCount = 0
$registrationChanged = $false
foreach ($runtime in "win7-x64", "linux-x64", "osx-x64", "alpine-x64", "win-arm", "linux-arm", "linux-arm64", "osx-arm64", "win-arm64", "win7-x86") {
Get-CGRegistrations -Runtime $runtime -RegistrationTable $registrations
$registrationChanged = (Get-CGRegistrations -Runtime $runtime -RegistrationTable $registrations) -or $registrationChanged
$count = $registrations.Count
$newCount = $count - $lastCount
$lastCount = $count
@ -216,5 +225,20 @@ foreach ($runtime in "win7-x64", "linux-x64", "osx-x64", "alpine-x64", "win-arm"
$newRegistrations = $registrations.Keys | Sort-Object | ForEach-Object { $registrations[$_] }
$count = $newRegistrations.Count
@{Registrations = $newRegistrations } | ConvertTo-Json -depth 99 | Set-Content $PSScriptRoot\..\cgmanifest.json
$newJson = @{Registrations = $newRegistrations } | ConvertTo-Json -depth 99
if ($Fix -and $registrationChanged) {
$cgManifestPath = (Resolve-Path -Path $PSScriptRoot\..\cgmanifest.json).ProviderPath
$newJson | Set-Content $cgManifestPath
Set-GWVariable -Name CGMANIFEST_PATH -Value $cgManifestPath
}
if (!$Fix -and $registrationChanged) {
$temp = Get-GWTempPath
$tempJson = Join-Path -Path $temp -ChildPath "cgmanifest$((Get-Date).ToString('yyyMMddHHmm')).json"
$newJson | Set-Content $tempJson -Encoding utf8NoBOM
Set-GWVariable -Name CGMANIFEST_PATH -Value $tempJson
throw "cgmanifest is out of date. run ./tools/findMissingNotices.ps1 -Fix. Generated cgmanifest is here: $tempJson"
}
Write-Verbose "$count registrations created!" -Verbose

View file

@ -4210,7 +4210,7 @@ function Test-PackageManifest {
}
Process {
Write-Verbose "Processing $($man.files) files..." -verbose
Write-Verbose "Processing $($man.files.count) files..." -verbose
$man.files | ForEach-Object {
$filePath = Join-Path $PackagePath -childPath $_.fileName
$checksumObj = $_.checksums | Where-Object {$_.algorithm -eq 'sha256'}