-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to generate compatibility suppression files.
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
Tools/GenerateCompatibilitySuppressionFiles/GenerateCompatibilitySuppressionFiles.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## --------------------------------------------------------------------------------------- | ||
## ILGPU | ||
## Copyright (c) 2022 ILGPU Project | ||
## www.ilgpu.net | ||
## | ||
## File: GenerateCompatibilitySuppressionFile.ps1 | ||
## | ||
## This file is part of ILGPU and is distributed under the University of Illinois Open | ||
## Source License. See LICENSE.txt for details. | ||
## --------------------------------------------------------------------------------------- | ||
|
||
using namespace System.IO | ||
|
||
$basePath = [Path]::Combine($PSScriptRoot, '..\..') | ||
$srcPath = [Path]::Combine($basePath, 'Src') | ||
|
||
# Reset by deleting existing compatibility suppression files. | ||
# Otherwise, the existing suppression rules are never removed. | ||
Write-Host ` | ||
"Removing Existing Compatibility Suppression Files:" ` | ||
-ForegroundColor Yellow | ||
|
||
$files = ` | ||
Get-ChildItem ` | ||
-path $srcPath ` | ||
-Filter "CompatibilitySuppressions.xml" ` | ||
-Recurse ` | ||
-File | ||
ForEach ($file in $files) { | ||
Write-Host " - $($file.FullName)" -ForegroundColor Red | ||
Remove-Item $file.FullName | ||
} | ||
|
||
# Regenerate compatibility suppression files. | ||
# Set GitHub Actions environment variable to enable building all | ||
# configurations. | ||
$propsFilePath = [Path]::Combine($srcPath, 'Directory.Build.props') | ||
$xml = New-Object XML | ||
$xml.Load($propsFilePath) | ||
$node = $xml.SelectSingleNode( | ||
'/Project/*/LibraryPackageValidationBaselineVersion'); | ||
|
||
Write-Host ` | ||
"Generating Compatibility Suppression Files for:" ` | ||
"$($node.InnerText)" ` | ||
-ForegroundColor Yellow | ||
|
||
$env:GITHUB_ACTIONS = 'true' | ||
dotnet pack /p:GenerateCompatibilitySuppressionFile=true $srcPath |