Pārlūkot izejas kodu

CI: Update pwsh build framework and pwsh build scripts

PatTheMav 2 gadi atpakaļ
vecāks
revīzija
8d485f643f

+ 0 - 1
.github/scripts/.Wingetfile

@@ -1,3 +1,2 @@
-package '7zip.7zip', path: '7-zip', bin: '7z'
 package 'cmake', path: 'Cmake\bin', bin: 'cmake'
 package 'cmake', path: 'Cmake\bin', bin: 'cmake'
 package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'
 package 'innosetup', path: 'Inno Setup 6', bin: 'iscc'

+ 45 - 41
.github/scripts/Build-Windows.ps1

@@ -1,15 +1,12 @@
 [CmdletBinding()]
 [CmdletBinding()]
 param(
 param(
+    [ValidateSet('x64')]
+    [string] $Target = 'x64',
     [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
     [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
     [string] $Configuration = 'RelWithDebInfo',
     [string] $Configuration = 'RelWithDebInfo',
-    [ValidateSet('x86', 'x64')]
-    [string] $Target,
-    [ValidateSet('Visual Studio 17 2022', 'Visual Studio 16 2019')]
-    [string] $CMakeGenerator,
     [switch] $SkipAll,
     [switch] $SkipAll,
     [switch] $SkipBuild,
     [switch] $SkipBuild,
-    [switch] $SkipDeps,
-    [switch] $SkipUnpack
+    [switch] $SkipDeps
 )
 )
 
 
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
@@ -19,6 +16,10 @@ if ( $DebugPreference -eq 'Continue' ) {
     $InformationPreference = 'Continue'
     $InformationPreference = 'Continue'
 }
 }
 
 
+if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
+    throw "A 64-bit system is required to build the project."
+}
+
 if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
 if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
     Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
     Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
     exit 2
     exit 2
@@ -28,6 +29,7 @@ function Build {
     trap {
     trap {
         Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
         Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
         Write-Error $_
         Write-Error $_
+        Log-Group
         exit 2
         exit 2
     }
     }
 
 
@@ -46,56 +48,58 @@ function Build {
     $ProductName = $BuildSpec.name
     $ProductName = $BuildSpec.name
     $ProductVersion = $BuildSpec.version
     $ProductVersion = $BuildSpec.version
 
 
-    $script:DepsVersion = ''
-    $script:QtVersion = '5'
-    $script:VisualStudioVersion = ''
-    $script:PlatformSDK = '10.0.18363.657'
-
-    Setup-Host
-
-    if ( $CmakeGenerator -eq '' ) {
-        $CmakeGenerator = $script:VisualStudioVersion
+    if ( ! $SkipDeps ) {
+        Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
     }
     }
 
 
-    (Get-Content -Path ${ProjectRoot}/CMakeLists.txt -Raw) `
-        -replace "project\((.*) VERSION (.*)\)", "project(${ProductName} VERSION ${ProductVersion})" `
-        | Out-File -Path ${ProjectRoot}/CMakeLists.txt -NoNewline
-
-    Setup-Obs
-
     Push-Location -Stack BuildTemp
     Push-Location -Stack BuildTemp
     if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
     if ( ! ( ( $SkipAll ) -or ( $SkipBuild ) ) ) {
         Ensure-Location $ProjectRoot
         Ensure-Location $ProjectRoot
 
 
-        $DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
-        $CmakeArgs = @(
-            '-G', $CmakeGenerator
-            "-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
-            "-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
-            "-DCMAKE_BUILD_TYPE=${Configuration}"
-            "-DCMAKE_PREFIX_PATH:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
-            "-DQT_VERSION=${script:QtVersion}"
+        $CmakeArgs = @()
+        $CmakeBuildArgs = @()
+        $CmakeInstallArgs = @()
+
+        if ( $VerbosePreference -eq 'Continue' ) {
+            $CmakeBuildArgs += ('--verbose')
+            $CmakeInstallArgs += ('--verbose')
+        }
+
+        if ( $DebugPreference -eq 'Continue' ) {
+            $CmakeArgs += ('--debug-output')
+        }
+
+        $Preset = "windows-$(if ( $Env:CI -ne $null ) { 'ci-' })${Target}"
+
+        $CmakeArgs += @(
+            '--preset', $Preset
         )
         )
 
 
-        Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
-        Log-Information "Configuring ${ProductName}..."
-        Invoke-External cmake -S . -B build_${script:Target} @CmakeArgs
+        $CmakeBuildArgs += @(
+            '--build'
+            '--preset', $Preset
+            '--config', $Configuration
+            '--parallel'
+            '--', '/consoleLoggerParameters:Summary', '/noLogo'
+        )
 
 
-        $CmakeArgs = @(
-            '--config', "${Configuration}"
+        $CmakeInstallArgs += @(
+            '--install', "build_${Target}"
+            '--prefix', "${ProjectRoot}/release/${Configuration}"
+            '--config', $Configuration
         )
         )
 
 
-        if ( $VerbosePreference -eq 'Continue' ) {
-            $CmakeArgs+=('--verbose')
-        }
+        Log-Group "Configuring ${ProductName}..."
+        Invoke-External cmake @CmakeArgs
 
 
-        Log-Information "Building ${ProductName}..."
-        Invoke-External cmake --build "build_${script:Target}" @CmakeArgs
+        Log-Group "Building ${ProductName}..."
+        Invoke-External cmake @CmakeBuildArgs
     }
     }
-    Log-Information "Install ${ProductName}..."
-    Invoke-External cmake --install "build_${script:Target}" --prefix "${ProjectRoot}/release" @CmakeArgs
+    Log-Group "Install ${ProductName}..."
+    Invoke-External cmake @CmakeInstallArgs
 
 
     Pop-Location -Stack BuildTemp
     Pop-Location -Stack BuildTemp
+    Log-Group
 }
 }
 
 
 Build
 Build

+ 30 - 26
.github/scripts/Package-Windows.ps1

@@ -1,10 +1,11 @@
 [CmdletBinding()]
 [CmdletBinding()]
 param(
 param(
+    [ValidateSet('x64')]
+    [string] $Target = 'x64',
     [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
     [ValidateSet('Debug', 'RelWithDebInfo', 'Release', 'MinSizeRel')]
     [string] $Configuration = 'RelWithDebInfo',
     [string] $Configuration = 'RelWithDebInfo',
-    [ValidateSet('x86', 'x64', 'x86+x64')]
-    [string] $Target,
-    [switch] $BuildInstaller = $false
+    [switch] $BuildInstaller,
+    [switch] $SkipDeps
 )
 )
 
 
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
@@ -14,14 +15,21 @@ if ( $DebugPreference -eq 'Continue' ) {
     $InformationPreference = 'Continue'
     $InformationPreference = 'Continue'
 }
 }
 
 
+if ( ! ( [System.Environment]::Is64BitOperatingSystem ) ) {
+    throw "Packaging script requires a 64-bit system to build and run."
+}
+
+
 if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
 if ( $PSVersionTable.PSVersion -lt '7.0.0' ) {
-    Write-Warning 'The obs-deps PowerShell build script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
+    Write-Warning 'The packaging script requires PowerShell Core 7. Install or upgrade your PowerShell version: https://aka.ms/pscore6'
     exit 2
     exit 2
 }
 }
 
 
 function Package {
 function Package {
     trap {
     trap {
+        Pop-Location -Stack BuildTemp -ErrorAction 'SilentlyContinue'
         Write-Error $_
         Write-Error $_
+        Log-Group
         exit 2
         exit 2
     }
     }
 
 
@@ -42,9 +50,9 @@ function Package {
 
 
     $OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
     $OutputName = "${ProductName}-${ProductVersion}-windows-${Target}"
 
 
-    Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
-
-    Log-Information "Packaging ${ProductName}..."
+    if ( ! $SkipDeps ) {
+        Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
+    }
 
 
     $RemoveArgs = @{
     $RemoveArgs = @{
         ErrorAction = 'SilentlyContinue'
         ErrorAction = 'SilentlyContinue'
@@ -57,17 +65,8 @@ function Package {
     Remove-Item @RemoveArgs
     Remove-Item @RemoveArgs
 
 
     if ( ( $BuildInstaller ) ) {
     if ( ( $BuildInstaller ) ) {
-        if ( $Target -eq 'x86+x64' ) {
-            $IsccCandidates = Get-ChildItem -Recurse -Path '*.iss'
-
-            if ( $IsccCandidates.length -gt 0 ) {
-                $IsccFile = $IsccCandidates[0].FullName
-            } else {
-                $IsccFile = ''
-            }
-        } else {
-            $IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
-        }
+        Log-Group "Packaging ${ProductName}..."
+        $IsccFile = "${ProjectRoot}/build_${Target}/installer-Windows.generated.iss"
 
 
         if ( ! ( Test-Path -Path $IsccFile ) ) {
         if ( ! ( Test-Path -Path $IsccFile ) ) {
             throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
             throw 'InnoSetup install script not found. Run the build script or the CMake build and install procedures first.'
@@ -76,17 +75,22 @@ function Package {
         Log-Information 'Creating InnoSetup installer...'
         Log-Information 'Creating InnoSetup installer...'
         Push-Location -Stack BuildTemp
         Push-Location -Stack BuildTemp
         Ensure-Location -Path "${ProjectRoot}/release"
         Ensure-Location -Path "${ProjectRoot}/release"
-        Invoke-External iscc ${IsccFile} /O. /F"${OutputName}-Installer"
+        Copy-Item -Path ${Configuration} -Destination Package -Recurse
+        Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer"
+        Remove-Item -Path Package -Recurse
         Pop-Location -Stack BuildTemp
         Pop-Location -Stack BuildTemp
-    }
+    } else {
+        Log-Group "Archiving ${ProductName}..."
+        $CompressArgs = @{
+            Path = (Get-ChildItem -Path "${ProjectRoot}/release/${Configuration}" -Exclude "${OutputName}*.*")
+            CompressionLevel = 'Optimal'
+            DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
+            Verbose = ($Env:CI -ne $null)
+        }
 
 
-    $CompressArgs = @{
-        Path = (Get-ChildItem -Path "${ProjectRoot}/release" -Exclude "${OutputName}*.*")
-        CompressionLevel = 'Optimal'
-        DestinationPath = "${ProjectRoot}/release/${OutputName}.zip"
+        Compress-Archive -Force @CompressArgs
     }
     }
-
-    Compress-Archive -Force @CompressArgs
+    Log-Group
 }
 }
 
 
 Package
 Package

+ 0 - 25
.github/scripts/utils.pwsh/Check-Git.ps1

@@ -1,25 +0,0 @@
-function Check-Git {
-    <#
-        .SYNOPSIS
-            Ensures available git executable on host system.
-        .DESCRIPTION
-            Checks whether a git command is available on the host system. If none is found,
-            Git is installed via winget.
-        .EXAMPLE
-            Check-Git
-    #>
-
-    if ( ! ( Test-Path function:Log-Info ) ) {
-        . $PSScriptRoot/Logger.ps1
-    }
-
-    Log-Information 'Checking for Git executable...'
-
-    if ( ! ( Get-Command git ) ) {
-        Log-Warning 'No Git executable found. Will try to install via winget.'
-        winget install git
-    } else {
-        Log-Debug "Git found at $(Get-Command git)."
-        Log-Status "Git found."
-    }
-}

+ 17 - 7
.github/scripts/utils.pwsh/Install-BuildDependencies.ps1

@@ -17,8 +17,12 @@ function Install-BuildDependencies {
     if ( ! ( Test-Path function:Log-Warning ) ) {
     if ( ! ( Test-Path function:Log-Warning ) ) {
         . $PSScriptRoot/Logger.ps1
         . $PSScriptRoot/Logger.ps1
     }
     }
-    
-    $Host64Bit = [System.Environment]::Is64BitOperatingSystem
+
+    $Prefixes = @{
+        'x64' = ${Env:ProgramFiles}
+        'x86' = ${Env:ProgramFiles(x86)}
+        'arm64' = ${Env:ProgramFiles(arm)}
+    }
 
 
     $Paths = $Env:Path -split [System.IO.Path]::PathSeparator
     $Paths = $Env:Path -split [System.IO.Path]::PathSeparator
 
 
@@ -28,14 +32,15 @@ function Install-BuildDependencies {
         $WingetOptions += '--silent'
         $WingetOptions += '--silent'
     }
     }
 
 
+    Log-Group 'Check Windows build requirements'
     Get-Content $WingetFile | ForEach-Object {
     Get-Content $WingetFile | ForEach-Object {
-        $_, $Package, $_, $Path, $_, $Binary = ([regex]::Split($_, " (?=(?:[^']|'[^']*')*$)")) -replace ',', '' -replace "'",''
+        $_, $Package, $_, $Path, $_, $Binary, $_, $Version = $_ -replace ',','' -split " +(?=(?:[^\']*\'[^\']*\')*[^\']*$)" -replace "'",''
 
 
-        (${Env:ProgramFiles(x86)}, $Env:ProgramFiles) | ForEach-Object {
-            $Prefix = $_
+        $Prefixes.GetEnumerator() | ForEach-Object {
+            $Prefix = $_.value
             $FullPath = "${Prefix}\${Path}"
             $FullPath = "${Prefix}\${Path}"
             if ( ( Test-Path $FullPath  ) -and ! ( $Paths -contains $FullPath ) ) {
             if ( ( Test-Path $FullPath  ) -and ! ( $Paths -contains $FullPath ) ) {
-                $Paths += $FullPath
+                $Paths = @($FullPath) + $Paths
                 $Env:Path = $Paths -join [System.IO.Path]::PathSeparator
                 $Env:Path = $Paths -join [System.IO.Path]::PathSeparator
             }
             }
         }
         }
@@ -46,7 +51,11 @@ function Install-BuildDependencies {
         if ( $Found ) {
         if ( $Found ) {
             Log-Status "Found dependency ${Binary} as $($Found.Source)"
             Log-Status "Found dependency ${Binary} as $($Found.Source)"
         } else {
         } else {
-            Log-Status "Installing package ${Package}"
+            Log-Status "Installing package ${Package} $(if ( $Version -ne $null ) { "Version: ${Version}" } )"
+
+            if ( $Version -ne $null ) {
+                $WingetOptions += @('--version', ${Version})
+            }
 
 
             try {
             try {
                 $Params = $WingetOptions + $Package
                 $Params = $WingetOptions + $Package
@@ -57,4 +66,5 @@ function Install-BuildDependencies {
             }
             }
         }
         }
     }
     }
+    Log-Group
 }
 }

+ 0 - 117
.github/scripts/utils.pwsh/Invoke-GitCheckout.ps1

@@ -1,117 +0,0 @@
-function Set-GitConfig {
-    <#
-        .SYNOPSIS
-            Sets a git config value.
-        .DESCRIPTION
-            Allows setting single or multiple config values in a PowerShell-friendly fashion.
-        .EXAMPLE
-            Set-GitConfig advice.detachedHead false
-    #>
-
-    if ( $args.Count -lt 2 ) {
-        throw 'Set-GitConfig called without required arguments <OPTION> <VALUE>.'
-    }
-
-    Invoke-External git config @args
-}
-
-function Invoke-GitCheckout {
-    <#
-        .SYNOPSIS
-            Checks out a specified git repository.
-        .DESCRIPTION
-            Wraps the git executable with PowerShell syntax to check out
-            a specified Git repository with a given commit hash and branch,
-            or a GitHub pull request ID.
-        .EXAMPLE
-            Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash"
-            Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -Branch "main"
-            Invoke-GitCheckout -Uri "My-Repo-Uri" -Commit "My-Commit-Hash" -PullRequest 250
-    #>
-
-    param(
-        [Parameter(Mandatory)]
-        [string] $Uri,
-        [Parameter(Mandatory)]
-        [string] $Commit,
-        [string] $Path,
-        [string] $Branch = "master",
-        [string] $PullRequest
-    )
-
-    if ( ! ( $Uri -like "*github.com*" ) -and ( $PullRequest -ne "" ) ) {
-        throw 'Fetching pull requests is only supported with GitHub-based repositories.'
-    }
-
-    if ( ! ( Test-Path function:Log-Information ) ) {
-        . $PSScriptRoot/Logger.ps1
-    }
-
-    if ( ! ( Test-Path function:Invoke-External ) ) {
-        . $PSScriptRoot/Invoke-External.ps1
-    }
-
-    $RepositoryName = [System.IO.Path]::GetFileNameWithoutExtension($Uri)
-
-    if ( $Path -eq "" ) {
-        $Path = "$(Get-Location | Convert-Path)\${RepositoryName}"
-    }
-
-    Push-Location -Stack GitCheckoutTemp
-
-    if ( Test-Path $Path/.git ) {
-        Write-Information "Repository ${RepositoryName} found in ${Path}"
-
-        Set-Location $Path
-
-        Set-GitConfig advice.detachedHead false
-        Set-GitConfig remote.origin.url $Uri
-        Set-GitConfig remote.origin.tapOpt --no-tags
-
-        $Ref = "+refs/heads/{0}:refs/remotes/origin/{0}" -f $Branch
-
-        Set-GitConfig --replace-all remote.origin.fetch $Ref
-
-        if ( $PullRequest -ne "" ) {
-            try {
-                Invoke-External git show-ref --quiet --verify refs/heads/pr-$PullRequest
-            } catch {
-                Invoke-External git fetch origin $("pull/{0}/head:pull-{0}" -f $PullRequest)
-            } finally {
-                Invoke-External git checkout -f "pull-${PullRequest}"
-            }
-        }
-
-        try {
-            $null = Invoke-External git rev-parse -q --verify "${Commit}^{commit}"
-        } catch {
-            Invoke-External git fetch origin
-        }
-
-        Invoke-External git checkout -f $Commit -- | Log-Information
-    } else {
-        Invoke-External git clone $Uri $Path
-
-        Set-Location $Path
-
-        Set-GitConfig advice.detachedHead false
-
-        if ( $PullRequest -ne "" ) {
-            $Ref = "pull/{0}/head:pull-{0}" -f $PullRequest
-            $Branch = "pull-${PullRequest}"
-            Invoke-External git fetch origin $Ref
-            Invoke-External git checkout $Branch
-        }
-
-        Invoke-External git checkout -f $Commit
-    }
-
-    Log-Information "Checked out commit ${Commit} on branch ${Branch}"
-
-    if ( Test-Path ${Path}/.gitmodules ) {
-        Invoke-External git submodule foreach --recursive git submodule sync
-        Invoke-External git submodule update --init --recursive
-    }
-
-    Pop-Location -Stack GitCheckoutTemp
-}

+ 29 - 3
.github/scripts/utils.pwsh/Logger.ps1

@@ -8,7 +8,7 @@ function Log-Debug {
 
 
     Process {
     Process {
         foreach($m in $Message) {
         foreach($m in $Message) {
-            Write-Debug $m
+            Write-Debug "$(if ( $env:CI -ne $null ) { '::debug::' })$m"
         }
         }
     }
     }
 }
 }
@@ -38,7 +38,7 @@ function Log-Warning {
 
 
     Process {
     Process {
         foreach($m in $Message) {
         foreach($m in $Message) {
-            Write-Warning $m
+            Write-Warning "$(if ( $env:CI -ne $null ) { '::warning::' })$m"
         }
         }
     }
     }
 }
 }
@@ -53,7 +53,7 @@ function Log-Error {
 
 
     Process {
     Process {
         foreach($m in $Message) {
         foreach($m in $Message) {
-            Write-Error $m
+            Write-Error "$(if ( $env:CI -ne $null ) { '::error::' })$m"
         }
         }
     }
     }
 }
 }
@@ -79,6 +79,32 @@ function Log-Information {
     }
     }
 }
 }
 
 
+function Log-Group {
+    [CmdletBinding()]
+    param(
+        [Parameter(ValueFromPipeline)]
+        [string[]] $Message
+    )
+
+    Process {
+        if ( $Env:CI -ne $null )  {
+            if ( $script:LogGroup ) {
+                Write-Output '::endgroup::'
+                $script:LogGroup = $false
+            }
+
+            if ( $Message.count -ge 1 ) {
+                Write-Output "::group::$($Message -join ' ')"
+                $script:LogGroup = $true
+            }
+        } else {
+            if ( $Message.count -ge 1 ) {
+                Log-Information $Message
+            }
+        }
+    }
+}
+
 function Log-Status {
 function Log-Status {
     [CmdletBinding()]
     [CmdletBinding()]
     param(
     param(

+ 0 - 103
.github/scripts/utils.pwsh/Setup-Host.ps1

@@ -1,103 +0,0 @@
-function Setup-Host {
-    if ( ! ( Test-Path function:Log-Output ) ) {
-        . $PSScriptRoot/Logger.ps1
-    }
-
-    if ( ! ( Test-Path function:Ensure-Location ) ) {
-        . $PSScriptRoot/Ensure-Location.ps1
-    }
-
-    if ( ! ( Test-Path function:Install-BuildDependencies ) ) {
-        . $PSScriptRoot/Install-BuildDependencies.ps1
-    }
-
-    if ( ! ( Test-Path function:Expand-ArchiveExt ) ) {
-        . $PSScriptRoot/Expand-ArchiveExt.ps1
-    }
-
-    Install-BuildDependencies -WingetFile "${ScriptHome}/.Wingetfile"
-
-    if ( $script:Target -eq '' ) { $script:Target = $script:HostArchitecture }
-
-    $script:QtVersion = $BuildSpec.platformConfig."windows-${script:Target}".qtVersion
-    $script:VisualStudioVersion = $BuildSpec.platformConfig."windows-${script:Target}".visualStudio
-    $script:PlatformSDK = $BuildSpec.platformConfig."windows-${script:Target}".platformSDK
-
-    if ( ! ( ( $script:SkipAll ) -or ( $script:SkipDeps ) ) ) {
-        ('prebuilt', "qt${script:QtVersion}") | ForEach-Object {
-            $_Dependency = $_
-            $_Version = $BuildSpec.dependencies."${_Dependency}".version
-            $_BaseUrl = $BuildSpec.dependencies."${_Dependency}".baseUrl
-            $_Label = $BuildSpec.dependencies."${_Dependency}".label
-            $_Hash = $BuildSpec.dependencies."${_Dependency}".hashes."windows-${script:Target}"
-
-            if ( $BuildSpec.dependencies."${_Dependency}".PSobject.Properties.Name -contains "pdb-hashes" ) {
-                $_PdbHash = $BuildSpec.dependencies."${_Dependency}".'pdb-hashes'."$windows-${script:Target}"
-            }
-
-            if ( $_Version -eq '' ) {
-                throw "No ${_Dependency} spec found in ${script:BuildSpecFile}."
-            }
-
-            Log-Information "Setting up ${_Label}..."
-
-            Push-Location -Stack BuildTemp
-            Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/..")/obs-build-dependencies"
-
-            switch -wildcard ( $_Dependency ) {
-                prebuilt {
-                    $_Filename = "windows-deps-${_Version}-${script:Target}.zip"
-                    $_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
-                    $_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
-                    $script:DepsVersion = ${_Version}
-                }
-                "qt*" {
-                    $_Filename = "windows-deps-qt${script:QtVersion}-${_Version}-${script:Target}.zip"
-                    $_Uri = "${_BaseUrl}/${_Version}/${_Filename}"
-                    $_Target = "plugin-deps-${_Version}-qt${script:QtVersion}-${script:Target}"
-                }
-            }
-
-            if ( ! ( Test-Path -Path $_Filename ) ) {
-                $Params = @{
-                    UserAgent = 'NativeHost'
-                    Uri = $_Uri
-                    OutFile = $_Filename
-                    UseBasicParsing = $true
-                    ErrorAction = 'Stop'
-                }
-
-                Invoke-WebRequest @Params
-                Log-Status "Downloaded ${_Label} for ${script:Target}."
-            } else {
-                Log-Status "Found downloaded ${_Label}."
-            }
-
-            $_FileHash = Get-FileHash -Path $_Filename -Algorithm SHA256
-
-            if ( $_FileHash.Hash.ToLower() -ne $_Hash ) {
-                throw "Checksum of downloaded ${_Label} does not match specification. Expected '${_Hash}', 'found $(${_FileHash}.Hash.ToLower())'"
-            }
-            Log-Status "Checksum of downloaded ${_Label} matches."
-
-            if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
-                Push-Location -Stack BuildTemp
-                Ensure-Location -Path $_Target
-
-                Expand-ArchiveExt -Path "../${_Filename}" -DestinationPath . -Force
-
-                Pop-Location -Stack BuildTemp
-            }
-            Pop-Location -Stack BuildTemp
-        }
-    }
-}
-
-function Get-HostArchitecture {
-    $Host64Bit = [System.Environment]::Is64BitOperatingSystem
-    $HostArchitecture = ('x86', 'x64')[$Host64Bit]
-
-    return $HostArchitecture
-}
-
-$script:HostArchitecture = Get-HostArchitecture

+ 0 - 84
.github/scripts/utils.pwsh/Setup-Obs.ps1

@@ -1,84 +0,0 @@
-function Setup-Obs {
-    if ( ! ( Test-Path function:Log-Output ) ) {
-        . $PSScriptRoot/Logger.ps1
-    }
-
-    if ( ! ( Test-Path function:Check-Git ) ) {
-        . $PSScriptRoot/Check-Git.ps1
-    }
-
-    Check-Git
-
-    if ( ! ( Test-Path function:Ensure-Location ) ) {
-        . $PSScriptRoot/Ensure-Location.ps1
-    }
-
-    if ( ! ( Test-Path function:Invoke-GitCheckout ) ) {
-        . $PSScriptRoot/Invoke-GitCheckout.ps1
-    }
-
-    if ( ! ( Test-Path function:Invoke-External ) ) {
-        . $PSScriptRoot/Invoke-External.ps1
-    }
-
-    Log-Information 'Setting up OBS Studio...'
-
-    $ObsVersion = $BuildSpec.dependencies.'obs-studio'.version
-    $ObsRepository = $BuildSpec.dependencies.'obs-studio'.repository
-    $ObsBranch = $BuildSpec.dependencies.'obs-studio'.branch
-    $ObsHash = $BuildSpec.dependencies.'obs-studio'.hash
-
-    if ( $ObsVersion -eq '' ) {
-        throw 'No obs-studio version found in buildspec.json.'
-    }
-
-    Push-Location -Stack BuildTemp
-    Ensure-Location -Path "$(Resolve-Path -Path "${ProjectRoot}/../")/obs-studio"
-
-    if ( ! ( ( $script:SkipAll ) -or ( $script:SkipUnpack ) ) ) {
-        Invoke-GitCheckout -Uri $ObsRepository -Commit $ObsHash -Path . -Branch $ObsBranch
-    }
-
-    if ( ! ( ( $script:SkipAll ) -or ( $script:SkipBuild ) ) ) {
-        Log-Information 'Configuring OBS Studio...'
-
-        $NumProcessors = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
-
-        if ( $NumProcessors -gt 1 ) {
-            $env:UseMultiToolTask = $true
-            $env:EnforceProcessCountAcrossBuilds = $true
-        }
-
-        $DepsPath = "plugin-deps-${script:DepsVersion}-qt${script:QtVersion}-${script:Target}"
-
-        $CmakeArgs = @(
-            '-G', $CmakeGenerator
-            "-DCMAKE_SYSTEM_VERSION=${script:PlatformSDK}"
-            "-DCMAKE_GENERATOR_PLATFORM=$(if (${script:Target} -eq "x86") { "Win32" } else { "x64" })"
-            "-DCMAKE_BUILD_TYPE=${script:Configuration}"
-            "-DQT_VERSION=${script:QtVersion}"
-            '-DENABLE_PLUGINS=OFF'
-            '-DENABLE_UI=OFF'
-            '-DENABLE_SCRIPTING=OFF'
-            "-DCMAKE_INSTALL_PREFIX:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
-            "-DCMAKE_PREFIX_PATH:PATH=$(Resolve-Path -Path "${ProjectRoot}/../obs-build-dependencies/${DepsPath}")"
-        )
-
-        Log-Debug "Attempting to configure OBS with CMake arguments: $($CmakeArgs | Out-String)"
-        Log-Information "Configuring OBS..."
-        Invoke-External cmake -S . -B plugin_build_${script:Target} @CmakeArgs
-
-        Log-Information 'Building libobs and obs-frontend-api...'
-        $CmakeArgs = @(
-            '--config', "$( if ( $script:Configuration -eq '' ) { 'RelWithDebInfo' } else { $script:Configuration })"
-        )
-
-        if ( $VerbosePreference -eq 'Continue' ) {
-            $CmakeArgs+=('--verbose')
-        }
-
-        Invoke-External cmake --build plugin_build_${script:Target} @CmakeArgs -t obs-frontend-api
-        Invoke-External cmake --install plugin_build_${script:Target} @CmakeArgs --component obs_libraries
-    }
-    Pop-Location -Stack BuildTemp
-}