@@ -504,7 +504,7 @@ function BuildAndLoadPlc {
504
504
param (
505
505
[string ]$appYamlFile ,
506
506
[string ]$appName ,
507
- [bool ]$summaryResult
507
+ [ref ]$summaryResult
508
508
)
509
509
# Check if the application folder is not empty
510
510
if (-Not ($appYamlFile ))
@@ -536,22 +536,28 @@ function BuildAndLoadPlc {
536
536
cd $appFolder
537
537
# apax install
538
538
$result = run- command - command " apax install"
539
- $result.output | foreach-object { write-output $_ }
539
+ if ($ ($result.Success ) -match " True" )
540
+ {
541
+ Write-Output " Command 'apax install' finished succesfully in $appFolder "
542
+ }
543
+ else
544
+ {
545
+ $result.error | foreach-object { write-output $_ }
546
+ }
540
547
# apax plcsim
541
548
$plcSimProjPath = [System.IO.Path ]::GetFullPath((Join-Path - Path $appFolder - ChildPath " ..\..\tools\src\PlcSimAdvancedStarter\PlcSimAdvancedStarterTool\PlcSimAdvancedStarterTool.csproj" ))
542
549
$result = Start-DotNetTool - ProjectName $plcSimProjPath - Arguments " -- startplcsim -x $appName -n $plcName -t $plcIpAddress "
543
550
$result.output | foreach-object { write-output $_ }
544
551
# apax hwu
545
552
$result = Run- Command - Command " apax hwu"
546
- $result.Output | ForEach-Object { Write-Output $_ }
547
553
if ($ ($result.Success ) -match " True" )
548
554
{
549
555
$textToWrite = " ,OK"
550
556
}
551
557
else
552
558
{
553
559
$textToWrite = " ,NOK"
554
- $summaryResult = 0
560
+ $summaryResult.Value = $false
555
561
}
556
562
Write-Result - TextToWrite $textToWrite - LogFilePath $logFilePath - AppendToSameLine
557
563
# apax swfd
@@ -564,18 +570,17 @@ function BuildAndLoadPlc {
564
570
else
565
571
{
566
572
$textToWrite = " ,NOK"
567
- $summaryResult = 0
573
+ $summaryResult.Value = $false
568
574
}
569
575
Write-Result - TextToWrite $textToWrite - LogFilePath $logFilePath - AppendToSameLine
570
- return $summaryResult
571
576
}
572
577
573
578
# Build and start HMI
574
579
function BuildAndStartHmi {
575
580
param (
576
581
[string ]$appYamlFile ,
577
582
[string ]$appName ,
578
- [bool ]$summaryResult
583
+ [ref ]$summaryResult
579
584
)
580
585
# Check if the application folder is not empty
581
586
if (-Not ($appYamlFile ))
@@ -619,7 +624,7 @@ function BuildAndStartHmi {
619
624
else
620
625
{
621
626
$textToWrite = " ,NOK"
622
- $summaryResult = 0
627
+ $summaryResult.Value = $false
623
628
}
624
629
Write-Result - TextToWrite $textToWrite - LogFilePath $logFilePath - AppendToSameLine
625
630
# get blazor projects
@@ -644,7 +649,7 @@ function BuildAndStartHmi {
644
649
else
645
650
{
646
651
$textToWrite = " ,NOK"
647
- $summaryResult = 0
652
+ $summaryResult.Value = $false
648
653
}
649
654
$result.output | foreach-object { write-output $_ }
650
655
Write-Result - TextToWrite $textToWrite - LogFilePath $logFilePath - AppendToSameLine
@@ -657,7 +662,6 @@ function BuildAndStartHmi {
657
662
}
658
663
659
664
cd $startDir
660
- return $summaryResult
661
665
}
662
666
663
667
# Function to create the log file
@@ -792,7 +796,7 @@ if ($appYamls)
792
796
$createResult = CreateFile - DirectoryPath $resultPath - FileNamePrefix " test_result"
793
797
794
798
if ($createResult.Success ) {
795
- $SumaryResult = 1
799
+ $SumaryResult = $true
796
800
$logFilePath = $createResult.FilePath
797
801
Write-Result - TextToWrite " AppName,PlcHw,PlcSw,DotnetBuild,DotnetRun" - LogFilePath $logFilePath
798
802
Write-Output " Files with 'type: app':"
@@ -811,9 +815,9 @@ if ($appYamls)
811
815
# ##### Overrite security files
812
816
OverwriteSecurityFiles - appYamlFile $ ($appYaml.FilePath ) - plcName $plcName
813
817
# ##### Build and load PLC
814
- $SumaryResult = BuildAndLoadPlc - appYamlFile $ ($appYaml.FilePath ) - appName $ ($appYaml.AppName ) - logFilePath $logFilePath - summaryResult $SumaryResult
818
+ BuildAndLoadPlc - appYamlFile $ ($appYaml.FilePath ) - appName $ ($appYaml.AppName ) - logFilePath $logFilePath - summaryResult ([ ref ] $SumaryResult )
815
819
# ##### Build and start HMI
816
- $SumaryResult = BuildAndStartHmi - appYamlFile $ ($appYaml.FilePath ) - appName $ ($appYaml.AppName ) - logFilePath $logFilePath - summaryResult $SumaryResult
820
+ BuildAndStartHmi - appYamlFile $ ($appYaml.FilePath ) - appName $ ($appYaml.AppName ) - logFilePath $logFilePath - summaryResult ([ ref ] $SumaryResult )
817
821
}
818
822
}
819
823
0 commit comments