| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- $CIWorkflow = "${CheckoutDir}/.github/workflows/main.yml"
- $WorkflowContent = Get-Content ${CIWorkflow}
- $CIDepsVersion = ${WorkflowContent} | Select-String "[ ]+DEPS_VERSION_WIN: '([0-9\-]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
- $CIQtVersion = ${WorkflowContent} | Select-String "[ ]+QT_VERSION_WIN: '([0-9\.]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
- $CIVlcVersion = ${WorkflowContent} | Select-String "[ ]+VLC_VERSION_WIN: '(.+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
- $CICefVersion = ${WorkflowContent} | Select-String "[ ]+CEF_BUILD_VERSION_WIN: '([0-9\.]+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
- $CIGenerator = ${WorkflowContent} | Select-String "[ ]+CMAKE_GENERATOR: '(.+)'" | ForEach-Object{$_.Matches.Groups[1].Value}
- function Write-Status {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Output
- )
- if (!($Quiet.isPresent)) {
- if (Test-Path Env:CI) {
- Write-Host "[${ProductName}] ${Output}"
- } else {
- Write-Host -ForegroundColor blue "[${ProductName}] ${Output}"
- }
- }
- }
- function Write-Info {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Output
- )
- if (!($Quiet.isPresent)) {
- if (Test-Path Env:CI) {
- Write-Host " + ${Output}"
- } else {
- Write-Host -ForegroundColor DarkYellow " + ${Output}"
- }
- }
- }
- function Write-Step {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Output
- )
- if (!($Quiet.isPresent)) {
- if (Test-Path Env:CI) {
- Write-Host " + ${Output}"
- } else {
- Write-Host -ForegroundColor green " + ${Output}"
- }
- }
- }
- function Write-Failure {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Output
- )
- if (Test-Path Env:CI) {
- Write-Host " + ${Output}"
- } else {
- Write-Host -ForegroundColor red " + ${Output}"
- }
- }
- function Test-CommandExists {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Command
- )
- $CommandExists = $false
- $OldActionPref = $ErrorActionPreference
- $ErrorActionPreference = "stop"
- try {
- if (Get-Command $Command) {
- $CommandExists = $true
- }
- } Catch {
- $CommandExists = $false
- } Finally {
- $ErrorActionPreference = $OldActionPref
- }
- return $CommandExists
- }
- function Ensure-Directory {
- Param(
- [Parameter(Mandatory=$true)]
- [String] $Directory
- )
- if (!(Test-Path $Directory)) {
- $null = New-Item -ItemType Directory -Force -Path $Directory
- }
- Set-Location -Path $Directory
- }
- $BuildDirectory = "$(if (Test-Path Env:BuildDirectory) { $env:BuildDirectory } else { $BuildDirectory })"
- $BuildConfiguration = "$(if (Test-Path Env:BuildConfiguration) { $env:BuildConfiguration } else { $BuildConfiguration })"
- $BuildArch = "$(if (Test-Path Env:BuildArch) { $env:BuildArch } else { $BuildArch })"
- $WindowsDepsVersion = "$(if (Test-Path Env:WindowsDepsVersion ) { $env:WindowsDepsVersion } else { $CIDepsVersion })"
- $WindowsQtVersion = "$(if (Test-Path Env:WindowsQtVersion ) { $env:WindowsQtVersion } else { $CIQtVersion })"
- $WindowsVlcVersion = "$(if (Test-Path Env:WindowsVlcVersion ) { $env:WindowsVlcVersion } else { $CIVlcVersion })"
- $WindowsCefVersion = "$(if (Test-Path Env:WindowsCefVersion ) { $env:WindowsCefVersion } else { $CICefVersion })"
- $CmakeSystemVersion = "$(if (Test-Path Env:CMAKE_SYSTEM_VERSION) { $Env:CMAKE_SYSTEM_VERSION } else { "10.0.18363.657" })"
- $CmakeGenerator = "$(if (Test-Path Env:CmakeGenerator) { $Env:CmakeGenerator } else { $CIGenerator })"
- function Install-Windows-Dependencies {
- $WingetFile = "$PSScriptRoot/Wingetfile"
- $Host64Bit = [System.Environment]::Is64BitOperatingSystem
- $Prefix = (${Env:ProgramFiles(x86)}, $Env:ProgramFiles)[$Host64Bit]
- $Paths = $Env:Path -split [System.IO.Path]::PathSeparator
- $WingetOptions = @('install', '--accept-package-agreements', '--accept-source-agreements')
- if ( $script:Quiet ) {
- $WingetOptions += '--silent'
- }
- Get-Content $WingetFile | ForEach-Object {
- $_, $Package, $_, $Path, $_, $Binary = $_ -replace ',','' -replace "'", '' -split ' '
- $FullPath = "${Prefix}\${Path}"
- if ( ( Test-Path $FullPath ) -and ! ( $Paths -contains $FullPath ) ) {
- $Paths += $FullPath
- $Env:Path = $Paths -join [System.IO.Path]::PathSeparator
- }
- Write-Step "Checking for command ${Binary}"
- $Found = Get-Command -ErrorAction SilentlyContinue $Binary
- if ( $Found ) {
- Write-Info "Found dependency ${Binary} as $($Found.Source)"
- } else {
- Write-Info "Installing package ${Package}"
- try {
- $Params = $WingetOptions + $Package
- winget @Params
- } catch {
- throw "Error while installing winget package ${Package}: $_"
- }
- }
- }
- }
|