File: install_opencppcoverage.ps1

package info (click to toggle)
gammu 1.42.0-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,340 kB
  • sloc: ansic: 107,388; pascal: 7,209; cpp: 3,976; php: 1,622; python: 1,559; sh: 1,208; sql: 601; perl: 240; makefile: 162; asm: 31; cs: 4
file content (32 lines) | stat: -rw-r--r-- 1,245 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#todo: convert this into a chocolatey package...

$downloadUrl = "https://dl.cihar.com/ci/OpenCppCoverageSetup-x64-0.9.5.3.exe"

$installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, "Downloads", "OpenCppCoverageSetup.exe")
$installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, "OpenCppCoverage")
$openCppCoverageExe = [System.IO.Path]::Combine($installPath, "OpenCppCoverage.exe")

if(-Not (Test-Path $installerPath))
{
    Write-Host -ForegroundColor White ("Downloading OpenCppCoverage from: " + $downloadUrl)
    Start-FileDownload $downloadUrl -FileName $installerPath
}

Write-Host -ForegroundColor White "Installing OpenCppCoverage..."

$installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait)
if($installProcess.ExitCode -ne 0)
{
    throw [System.String]::Format("Failed to install OpenCppCoverage, ExitCode: {0}.", $installProcess.ExitCode)
}

$env:Path="$env:Path;$installPath"

# Redirect from stderr
(& $openCppCoverageExe -h) 2>&1 | Select -First 1 | Write-Host -ForegroundColor White

# OpenCppCoverage returns 1 with no passed options...
if($LASTEXITCODE -ne 1)
{
    throw [System.String]::Format("Failed to check the OpenCppCoverage version, ExitCode: {0}.", $LASTEXITCODE)
}