Skip to content

Commit

Permalink
feat: Shader Commands now Prefer a ShaderFile ( Fixes #163 )
Browse files Browse the repository at this point in the history
Fixing build conditions
  • Loading branch information
James Brundage committed Feb 14, 2024
1 parent c48b47f commit 38d43dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
15 changes: 4 additions & 11 deletions Build/obs--shaders.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
) -join [Environment]::Newline | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$myRegex = [Regex]::new($myAttribute.RegexPattern, $myAttribute.Options, '00:00:00.1')
if ($myRegex.IsMatch($checkIfThisIsValid) -or
(-not $myRegex.IsMatch("$checkIfThisIsValid"))
) {
if (-not $myRegex.IsMatch($checkIfThisIsValid)) {
if ($env:GITHUB_STEP_SUMMARY) {
"* skipping $($MyInvocation.MyCommand.Name) because $checkIfThisIsValid did not match ($($myAttribute.RegexPattern))" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Expand All @@ -41,11 +39,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
elseif ($myAttribute -is [ValidateScript])
{
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Against Script:
~~~PowerShell
$($myAttribute.ScriptBlock)
~~~
" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
"* $($MyInvocation.MyCommand.Name) has a Build Validation Script." | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$validationOutput = . $myAttribute.ScriptBlock $checkIfThisIsValid
if (-not $validationOutput) {
Expand All @@ -56,8 +50,7 @@ $($myAttribute.ScriptBlock)
"$($myAttribute.ScriptBlock)"
"~~~"
) -join [Environment]::Newline |
Out-File -Path $env:GITHUB_STEP_SUMMARY -Append

Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Write-Warning "Skipping $($MyInvocation.MyCommand) : The $CheckIfThisIsValid was not valid"
return
Expand Down Expand Up @@ -392,7 +385,7 @@ switch -regex ($myVerb) {
} else {
$ShaderFilterSplat.ShaderText = $shaderText
}

if ($myVerb -eq 'Add') {
Add-OBSShaderFilter @ShaderFilterSplat
} else {
Expand Down
15 changes: 4 additions & 11 deletions Build/obs-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
) -join [Environment]::Newline | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$myRegex = [Regex]::new($myAttribute.RegexPattern, $myAttribute.Options, '00:00:00.1')
if ($myRegex.IsMatch($checkIfThisIsValid) -or
(-not $myRegex.IsMatch("$checkIfThisIsValid"))
) {
if (-not $myRegex.IsMatch($checkIfThisIsValid)) {
if ($env:GITHUB_STEP_SUMMARY) {
"* skipping $($MyInvocation.MyCommand.Name) because $checkIfThisIsValid did not match ($($myAttribute.RegexPattern))" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Expand All @@ -31,11 +29,7 @@ foreach ($myAttribute in $MyInvocation.MyCommand.ScriptBlock.Attributes) {
elseif ($myAttribute -is [ValidateScript])
{
if ($env:GITHUB_STEP_SUMMARY) {
"* Validating Build Against Script:
~~~PowerShell
$($myAttribute.ScriptBlock)
~~~
" | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
"* $($MyInvocation.MyCommand.Name) has a Build Validation Script." | Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
$validationOutput = . $myAttribute.ScriptBlock $checkIfThisIsValid
if (-not $validationOutput) {
Expand All @@ -46,10 +40,9 @@ $($myAttribute.ScriptBlock)
"$($myAttribute.ScriptBlock)"
"~~~"
) -join [Environment]::Newline |
Out-File -Path $env:GITHUB_STEP_SUMMARY -Append

Out-File -Path $env:GITHUB_STEP_SUMMARY -Append
}
Write-Warning "Skipping $($MyInvocation.MyCommand) :The last commit did not match $($myRegex)"
Write-Warning "Skipping $($MyInvocation.MyCommand) : The $CheckIfThisIsValid was not valid"
return
}
}
Expand Down

0 comments on commit 38d43dd

Please sign in to comment.