From 7446252dcab3a46682d4374272d820a9a4625d54 Mon Sep 17 00:00:00 2001 From: Nino Belusic Date: Thu, 9 Nov 2023 09:10:34 +0100 Subject: [PATCH] feat: add running progen for tests and samples #4248 --- progen.ps1 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/progen.ps1 b/progen.ps1 index f31e856e8..384525448 100644 --- a/progen.ps1 +++ b/progen.ps1 @@ -6,6 +6,8 @@ # progen.ps1 [-poco_base dir] # [-vs 140 | 150 | 160| 170] # [-omit "Lib1X,LibY,LibZ,..."] +# [-samples] +# [-tests] [CmdletBinding()] Param @@ -18,6 +20,8 @@ Param [int] $vs = 140, [string] $omit, + [switch] $samples = $false, + [switch] $tests = $false, [switch] $help ) @@ -31,6 +35,8 @@ function Process-Input Write-Host 'progen.ps1 [-poco_base ]' Write-Host ' [-vs 140 | 150 | 160 | 170]' Write-Host ' [-omit "Lib1X,LibY,LibZ,..."]' + Write-Host ' [-samples]' + Write-Host ' [-tests]' Exit } else @@ -41,6 +47,8 @@ function Process-Input Write-Host "--------------------" Write-Host "Poco Base: $poco_base" Write-Host "Version: $vs" + Write-Host "Samples: $samples" + Write-Host "Tests: $tests" if ($omit -ne '') { @@ -56,7 +64,27 @@ function Process-Input } } -function Run-Progen-Components +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) { if(Test-Path "$poco_base\ProGen\bin64\static_mt\progen.exe") { $progenPath = Resolve-Path "$poco_base\ProGen\bin64\static_mt\progen.exe" @@ -81,13 +109,27 @@ function Run-Progen-Components if ($omitArray -NotContains $component) { - $componentProgenPath = "$poco_base\$componentDir\$componentName.Progen" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Write-Host "| Running ProGen for $componentDir" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" - Invoke-Expression "$progenPath /tool=vs$vs $componentProgenPath" + 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 "$_" + } } else { @@ -102,7 +144,9 @@ function Run { Process-Input - Run-Progen-Components + Run-Progen-Components "lib" + Run-Progen-Components "test" + Run-Progen-Components "sample" }