From 12d669cb9c048d09a0e103a6123cfe0a4aad0800 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Thu, 21 Jan 2021 00:52:13 +0100 Subject: Fixed corner cases and error reporting for UVVM pre-compile scripts. (#1619) --- libraries/vendors/compile-uvvm.ps1 | 15 ++++++++++----- libraries/vendors/compile-uvvm.sh | 15 +++++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/libraries/vendors/compile-uvvm.ps1 b/libraries/vendors/compile-uvvm.ps1 index 8076e0342..fefd755a6 100644 --- a/libraries/vendors/compile-uvvm.ps1 +++ b/libraries/vendors/compile-uvvm.ps1 @@ -227,7 +227,10 @@ foreach ($VIPName in (Get-Content "$SourceDirectory\script\component_list.txt")) $VIPFiles = @() $CompileOrder = Get-Content "$SourceDirectory\$VIPName\script\compile_order.txt" foreach ($Line in $CompileOrder) - { if ($Line.StartsWith("# ")) + { $Line = $Line.Trim() + if ($Line -eq "") + { continue } + elseif ($Line.StartsWith("#")) { if ($Line.StartsWith("# library ")) { $VIPName = $Line.Substring(10) } else @@ -268,8 +271,10 @@ foreach ($vip in $VIP_Files.Keys) Write-Host "--------------------------------------------------------------------------------" Write-Host "Compiling UVVM packages " -NoNewline if ($ErrorCount -gt 0) -{ Write-Host "[FAILED]" -ForegroundColor Red } +{ Write-Host "[FAILED]" -ForegroundColor Red + Exit-CompileScript 1 +} else -{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green } - -Exit-CompileScript +{ Write-Host "[SUCCESSFUL]" -ForegroundColor Green + Exit-CompileScript +} diff --git a/libraries/vendors/compile-uvvm.sh b/libraries/vendors/compile-uvvm.sh index fafbd0118..d33743a87 100755 --- a/libraries/vendors/compile-uvvm.sh +++ b/libraries/vendors/compile-uvvm.sh @@ -373,7 +373,7 @@ test $VERBOSE -eq 1 && echo -e " ${ANSI_GRAY}Reading compile order files...${AN Components=() while IFS= read -r Component; do - Component=${Component%?} + Component=${Component%\r} if [[ ${Component:0:2} != "# " ]]; then Components+=("$Component") fi @@ -402,8 +402,14 @@ for ComponentName in "${Components[@]}"; do StructName=$VIPName Files=() + CompileOrderFile="$SourceDirectory/$LibraryPath/script/compile_order.txt" + if [[ -f "$CompileOrderFile" ]]; then + echo -e "${COLORED_ERROR} Compile order file '$CompileOrderFile' does not exist..${ANSI_NOCOLOR}" + continue + fi + while IFS= read -r File; do - File=${File%?} + File=${File%\r} if [[ ${File:0:2} == "# " ]]; then if [[ ${File:2:7} == "library" ]]; then LibraryName=${File:10} @@ -411,7 +417,7 @@ for ComponentName in "${Components[@]}"; do else Files+=("${File:3}") fi - done < <(cat "$SourceDirectory/$LibraryPath/script/compile_order.txt") + done < <(cat "$CompileOrderFile") CreateLibraryStruct $StructName $LibraryName $LibraryPath $VHDLVersion "${Files[@]}" @@ -426,5 +432,6 @@ if [[ ${#Libraries[@]} -ne 0 ]]; then echo "--------------------------------------------------------------------------------" echo -e "Compiling UVVM packages and VIPs $(test $ERRORCOUNT -eq 0 && echo $COLORED_SUCCESSFUL || echo $COLORED_FAILED)" else - echo -e "${ANSI_RED}Neither UVVM packages nor VIPs selected.${ANSI_NOCOLOR}" + echo -e "${COLORED_ERROR} Neither UVVM packages nor VIPs selected.${ANSI_NOCOLOR}" + exit 2 fi -- cgit v1.2.3