Files
TinyORM/tools/ExportInHeader.ps1
silverqx a847f533d7 comment
2022-01-01 17:22:47 +01:00

33 lines
742 B
PowerShell

#!/usr/bin/env pwsh
# Detect SHAREDLIB_EXPORT in header files
Set-StrictMode -Version 3.0
$hppFiles = Get-ChildItem -Path ..\include\*.hpp -Recurse
$cppFiles = Get-ChildItem -Path ..\src\*.cpp -Recurse
foreach ($hppFile in $hppFiles)
{
$cppFile = $hppFile -replace '\\include\\', '\src\'
$cppFile = $cppFile -replace '\.hpp', '.cpp'
$hasCpp = @($cppFiles | Where-Object FullName -CEQ $cppFile)
if ($hasCpp.Count -gt 1)
{
throw 'More results for ' + $cppFile
}
if ($hasCpp.Count -eq 1)
{
continue
}
$containsExport = @(Select-String -Path $hppFile -Pattern 'SHAREDLIB_EXPORT')
if ($containsExport.Count -eq 0)
{
continue
}
Write-Output $hppFile.FullName
}