diff options
author | Patrick Lehmann <Patrick.Lehmann@tu-dresden.de> | 2016-11-02 00:09:35 +0100 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@tu-dresden.de> | 2016-11-02 00:09:35 +0100 |
commit | f8a445ef12a8bcdc50a98da5b4909bf61f4628d8 (patch) | |
tree | c8c12d6c2db5dcddbea882e8e3821866bcb7a7e5 /libraries/vendors/shared.psm1 | |
parent | b869a4acb52358fe8ca5decaac826af056bfdfca (diff) | |
download | ghdl-f8a445ef12a8bcdc50a98da5b4909bf61f4628d8.tar.gz ghdl-f8a445ef12a8bcdc50a98da5b4909bf61f4628d8.tar.bz2 ghdl-f8a445ef12a8bcdc50a98da5b4909bf61f4628d8.zip |
Added verbosity control for vendor compile scripts.
Diffstat (limited to 'libraries/vendors/shared.psm1')
-rw-r--r-- | libraries/vendors/shared.psm1 | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/libraries/vendors/shared.psm1 b/libraries/vendors/shared.psm1 index 1c693af73..9cc31b375 100644 --- a/libraries/vendors/shared.psm1 +++ b/libraries/vendors/shared.psm1 @@ -91,9 +91,9 @@ function Get-SourceDirectory ) if ($Source -ne "") - { $SourceDirectory = $Source } # TODO: remove trailing backslashes + { $SourceDirectory = $Source.TrimEnd("\") } elseif ($EnvSource -ne "") - { $SourceDirectory = $EnvSource } + { $SourceDirectory = $EnvSource } else { $SourceDirectory = (Get-VendorToolInstallationDirectory) + "\" + (Get-VendorToolSourceDirectory) } @@ -126,7 +126,7 @@ function Get-DestinationDirectory [string]$Output ) if ($Output -ne "") - { $DestinationDirectory = $Output } # TODO: remove trailing backslashes + { $DestinationDirectory = $Output.TrimEnd("\") } else { $DestinationDirectory = Get-VendorToolDestinationDirectory } @@ -268,17 +268,25 @@ function Start-PackageCompilation [Parameter(Mandatory=$true)][string[]]$SourceFiles, [Parameter(Mandatory=$true)][bool]$HaltOnError ) + # set default values + $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] + $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] + if ($EnableVerbose -eq $null) { $EnableVerbose = $false } + if ($EnableDebug -eq $null) { $EnableDebug = $false } + if ($EnableDebug -eq $true) { $EnableVerbose = $true } + $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" + $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null - echo $LibraryDirectory + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $ErrorCount = 0 foreach ($File in $SourceFiles) { Write-Host "Analyzing package file '$File'" -ForegroundColor DarkCyan $InvokeExpr = "$GHDLBinary " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - # Write-Host " $InvokeExpr" -ForegroundColor DarkGray - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " if ($LastExitCode -ne 0) { $ErrorCount += 1 if ($HaltOnError) @@ -319,17 +327,25 @@ function Start-PrimitiveCompilation [Parameter(Mandatory=$true)][string[]]$SourceFiles, [Parameter(Mandatory=$true)][bool]$HaltOnError ) + # set default values + $EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] + $EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] + if ($EnableVerbose -eq $null) { $EnableVerbose = $false } + if ($EnableDebug -eq $null) { $EnableDebug = $false } + if ($EnableDebug -eq $true) { $EnableVerbose = $true } + $LibraryDirectory="$DestinationDirectory/$Library/$VHDLVersion" + $EnableDebug -and (Write-Host " mkdir $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null mkdir $LibraryDirectory -ErrorAction SilentlyContinue | Out-Null - echo $LibraryDirectory + $EnableDebug -and (Write-Host " cd $LibraryDirectory" -ForegroundColor DarkGray ) | Out-Null cd $LibraryDirectory Write-Host "Compiling library '$Library' ..." -ForegroundColor Yellow $ErrorCount = 0 foreach ($File in $SourceFiles) { Write-Host "Analyzing primitive file '$File'" -ForegroundColor DarkCyan $InvokeExpr = "$GHDLBinary " + ($GHDLOptions -join " ") + " --work=$Library " + $File + " 2>&1" - # Write-Host " $InvokeExpr" -ForegroundColor DarkGray - $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings + $EnableDebug -and (Write-Host " $InvokeExpr" -ForegroundColor DarkGray ) | Out-Null + $ErrorRecordFound = Invoke-Expression $InvokeExpr | Restore-NativeCommandStream | Write-ColoredGHDLLine $SuppressWarnings " " if ($LastExitCode -ne 0) { $ErrorCount += 1 if ($HaltOnError) |