2023-11-08 15:12:16 +01:00
|
|
|
#
|
|
|
|
# POCO progen automation script
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# ------
|
|
|
|
# progen.ps1 [-poco_base dir]
|
|
|
|
# [-vs 140 | 150 | 160| 170]
|
|
|
|
# [-omit "Lib1X,LibY,LibZ,..."]
|
2023-11-09 09:10:34 +01:00
|
|
|
# [-samples]
|
|
|
|
# [-tests]
|
2023-11-08 15:12:16 +01:00
|
|
|
|
|
|
|
[CmdletBinding()]
|
|
|
|
Param
|
|
|
|
(
|
|
|
|
[Parameter()]
|
2023-11-08 15:35:11 +01:00
|
|
|
[string] $poco_base,
|
2023-11-08 15:12:16 +01:00
|
|
|
|
|
|
|
[Parameter()]
|
|
|
|
[ValidateSet(140, 150, 160, 170)]
|
2023-11-08 15:35:11 +01:00
|
|
|
[int] $vs = 140,
|
2023-11-08 15:12:16 +01:00
|
|
|
|
|
|
|
[string] $omit,
|
2023-11-09 09:10:34 +01:00
|
|
|
[switch] $samples = $false,
|
|
|
|
[switch] $tests = $false,
|
2023-11-08 15:12:16 +01:00
|
|
|
|
|
|
|
[switch] $help
|
|
|
|
)
|
|
|
|
|
|
|
|
function Process-Input
|
|
|
|
{
|
|
|
|
if ($help -eq $true)
|
|
|
|
{
|
|
|
|
Write-Host 'Usage:'
|
|
|
|
Write-Host '------'
|
|
|
|
Write-Host 'progen.ps1 [-poco_base <dir>]'
|
|
|
|
Write-Host ' [-vs 140 | 150 | 160 | 170]'
|
|
|
|
Write-Host ' [-omit "Lib1X,LibY,LibZ,..."]'
|
2023-11-09 09:10:34 +01:00
|
|
|
Write-Host ' [-samples]'
|
|
|
|
Write-Host ' [-tests]'
|
2023-11-08 15:12:16 +01:00
|
|
|
Exit
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host ""
|
|
|
|
Write-Host "--------------------"
|
|
|
|
Write-Host "Progen configuration:"
|
|
|
|
Write-Host "--------------------"
|
|
|
|
Write-Host "Poco Base: $poco_base"
|
|
|
|
Write-Host "Version: $vs"
|
2023-11-09 09:10:34 +01:00
|
|
|
Write-Host "Samples: $samples"
|
|
|
|
Write-Host "Tests: $tests"
|
2023-11-08 15:12:16 +01:00
|
|
|
|
|
|
|
if ($omit -ne '')
|
|
|
|
{
|
|
|
|
Write-Host "Omit: $omit"
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Host "----------------------------------------"
|
|
|
|
Write-Host ""
|
|
|
|
|
|
|
|
# NB: this won't work in PowerShell ISE
|
|
|
|
#Write-Host "Press Ctrl-C to exit or any other key to continue ..."
|
|
|
|
#$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-09 09:10:34 +01:00
|
|
|
function Run-Progen-Samples
|
|
|
|
{
|
|
|
|
process {
|
|
|
|
$sampleName = $_.BaseName.split(".")[0]
|
|
|
|
if($_.Name -eq "samples.progen") {
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Running Progen for $componentDir\$sampleName"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
$sampleProgenPath = "$($poco_base)\$($componentDir)\$($sampleName)\$($_)"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Running Progen for $componentDir\samples\$sampleName"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
$sampleProgenPath = "$($poco_base)\$($componentDir)\samples\$($sampleName)\$($_)"
|
|
|
|
}
|
|
|
|
Invoke-Expression "$progenPath /tool=vs$vs $sampleProgenPath"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Run-Progen-Components([string] $type)
|
2023-11-08 15:12:16 +01:00
|
|
|
{
|
2023-11-08 15:34:35 +01:00
|
|
|
if(Test-Path "$poco_base\ProGen\bin64\static_mt\progen.exe") {
|
|
|
|
$progenPath = Resolve-Path "$poco_base\ProGen\bin64\static_mt\progen.exe"
|
|
|
|
}
|
|
|
|
elseif(Test-Path "$poco_base\ProGen\bin64\static_md\progen.exe") {
|
|
|
|
$progenPath = Resolve-Path "$poco_base\ProGen\bin64\static_md\progen.exe"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$progenPath = Resolve-Path "$poco_base\ProGen\bin64\progen.exe"
|
|
|
|
}
|
2023-11-08 15:12:16 +01:00
|
|
|
Get-Content "$poco_base\components" | Foreach-Object {
|
|
|
|
|
|
|
|
$component = $_
|
|
|
|
$componentDir = $_.Replace("/", "\")
|
|
|
|
$componentArr = $_.split('/')
|
|
|
|
$componentName = $componentArr[$componentArr.Length - 1]
|
|
|
|
|
|
|
|
$omitArray = @()
|
|
|
|
$omit.Split(',') | ForEach-Object {
|
|
|
|
$omitArray += $_.Trim()
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($omitArray -NotContains $component)
|
|
|
|
{
|
|
|
|
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Running ProGen for $componentDir"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
|
2023-11-09 09:10:34 +01:00
|
|
|
if($type -eq "lib") {
|
|
|
|
$componentProgenPath = "$poco_base\$componentDir\$componentName.Progen"
|
|
|
|
Invoke-Expression "$progenPath /tool=vs$vs $componentProgenPath"
|
|
|
|
}
|
|
|
|
ElseIf ($tests -and ($type -eq "test")) {
|
|
|
|
$componentTestProgenPath = "$poco_base\$componentDir\testsuite\TestSuite.Progen"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Write-Host "| Running Progen for $componentDir\testsuite"
|
|
|
|
Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
|
|
|
Invoke-Expression "$progenPath /tool=vs$vs $componentTestProgenPath"
|
|
|
|
}
|
|
|
|
ElseIf ($samples -and ($type -eq "sample")) {
|
|
|
|
Get-Childitem "$poco_base\$($componentDir)" -Recurse |`
|
|
|
|
Where-Object {$_.Extension -Match ".progen" -And $_.DirectoryName -Like "*samples*" } `
|
|
|
|
| Run-Progen-Samples "$_"
|
|
|
|
}
|
2023-11-08 15:12:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Write-Host "-------------------------------"
|
|
|
|
Write-Host "# Skipping $componentDir"
|
|
|
|
Write-Host "-------------------------------"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Run
|
|
|
|
{
|
|
|
|
Process-Input
|
|
|
|
|
2023-11-09 09:10:34 +01:00
|
|
|
Run-Progen-Components "lib"
|
|
|
|
Run-Progen-Components "test"
|
|
|
|
Run-Progen-Components "sample"
|
2023-11-08 15:12:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Run
|