From 8323975fbceb59eaeca58d30dcf9450479705da1 Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Tue, 8 Sep 2026 03:34:49 -0400 Subject: [PATCH 1/3] 1.0.0: support Windows PowerShell 5.1 license validation --- packaging/VerifyLicenseHeaders.ps1 | 31 +++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/packaging/VerifyLicenseHeaders.ps1 b/packaging/VerifyLicenseHeaders.ps1 index 371a0735c..23ea13388 100644 --- a/packaging/VerifyLicenseHeaders.ps1 +++ b/packaging/VerifyLicenseHeaders.ps1 @@ -5,6 +5,29 @@ $ErrorActionPreference = 'Stop' $root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path +function Get-RepositoryRelativePath { + param( [Parameter( Mandatory = $true )][string] $Path ) + + $rootPath = [IO.Path]::GetFullPath( $root ) + $fullPath = [IO.Path]::GetFullPath( $Path ) + + if ( $fullPath.Equals( $rootPath, [StringComparison]::OrdinalIgnoreCase ) ) { + return '.' + } + + $separator = [IO.Path]::DirectorySeparatorChar.ToString() + $rootPrefix = $rootPath + if ( -not $rootPrefix.EndsWith( $separator, [StringComparison]::Ordinal ) ) { + $rootPrefix += $separator + } + + if ( -not $fullPath.StartsWith( $rootPrefix, [StringComparison]::OrdinalIgnoreCase ) ) { + throw "Path '$fullPath' is not within repository root '$rootPath'." + } + + return $fullPath.Substring( $rootPrefix.Length ).Replace( '\', '/' ) +} + function Get-ProjectAssemblyName { param( [Parameter( Mandatory = $true )][string] $ProjectPath ) @@ -52,7 +75,7 @@ function Get-ProjectDescription { function Get-LicenseKind { param( [Parameter( Mandatory = $true )][string] $ProjectPath ) - $relative = [IO.Path]::GetRelativePath( $root, $ProjectPath ).Replace( '\\', '/' ) + $relative = Get-RepositoryRelativePath -Path $ProjectPath if ( $relative -eq 'Icod.Terminal.csproj' ) { return 'LGPL' } @@ -166,7 +189,8 @@ foreach ( $project in $projects ) { $expectedHeader = Get-ProjectHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind if ( -not $content.StartsWith( $expectedHeader, [StringComparison]::Ordinal ) ) { - $failures.Add( "Project header mismatch: $([IO.Path]::GetRelativePath( $root, $project.FullName ))" ) + $relativePath = Get-RepositoryRelativePath -Path $project.FullName + $failures.Add( "Project header mismatch: $relativePath" ) } } @@ -183,7 +207,8 @@ foreach ( $source in $sources ) { $expectedHeader = Get-CSharpHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind if ( -not $content.StartsWith( $expectedHeader, [StringComparison]::Ordinal ) ) { - $failures.Add( "C# header mismatch: $([IO.Path]::GetRelativePath( $root, $source.FullName ))" ) + $relativePath = Get-RepositoryRelativePath -Path $source.FullName + $failures.Add( "C# header mismatch: $relativePath" ) } } From df7f31cc9aa004ac95fe891ebeb2a57c9bd2e492 Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Tue, 8 Sep 2026 03:35:28 -0400 Subject: [PATCH 2/3] 1.0.0: exercise license verifier under Windows PowerShell 5.1 --- .github/workflows/pull-request.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 8f2c28347..b8534ad21 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -35,6 +35,10 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Verify license headers under Windows PowerShell 5.1 + if: runner.os == 'Windows' + shell: powershell + run: ./packaging/VerifyLicenseHeaders.ps1 - name: Verify runtime and source integration shell: pwsh run: ./packaging/VerifyRuntime.ps1 -Configuration '${{ env.CONFIGURATION }}' From e49a8b72646551925310b0b0854f822e8e030a72 Mon Sep 17 00:00:00 2001 From: Timothy Bruce Date: Tue, 8 Sep 2026 03:37:21 -0400 Subject: [PATCH 3/3] 1.0.0: normalize license template newlines across PowerShell hosts --- packaging/VerifyLicenseHeaders.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/VerifyLicenseHeaders.ps1 b/packaging/VerifyLicenseHeaders.ps1 index 23ea13388..ecbf1c13e 100644 --- a/packaging/VerifyLicenseHeaders.ps1 +++ b/packaging/VerifyLicenseHeaders.ps1 @@ -186,7 +186,7 @@ foreach ( $project in $projects ) { $assemblyName = Get-ProjectAssemblyName -ProjectPath $project.FullName $description = Get-ProjectDescription -AssemblyName $assemblyName $licenseKind = Get-LicenseKind -ProjectPath $project.FullName - $expectedHeader = Get-ProjectHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind + $expectedHeader = ( Get-ProjectHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind ).Replace( "`r`n", "`n" ) if ( -not $content.StartsWith( $expectedHeader, [StringComparison]::Ordinal ) ) { $relativePath = Get-RepositoryRelativePath -Path $project.FullName @@ -204,7 +204,7 @@ foreach ( $source in $sources ) { $assemblyName = Get-ProjectAssemblyName -ProjectPath $projectPath $description = Get-ProjectDescription -AssemblyName $assemblyName $licenseKind = Get-LicenseKind -ProjectPath $projectPath - $expectedHeader = Get-CSharpHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind + $expectedHeader = ( Get-CSharpHeader -AssemblyName $assemblyName -Description $description -LicenseKind $licenseKind ).Replace( "`r`n", "`n" ) if ( -not $content.StartsWith( $expectedHeader, [StringComparison]::Ordinal ) ) { $relativePath = Get-RepositoryRelativePath -Path $source.FullName