Skip to content

Commit

Permalink
Fix bug when $ChocolateyBuildOutput is null or empty string (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Dec 24, 2023
1 parent b2fc9fb commit 15aecea
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Now the tasks work when using `Set-SamplerTaskVariable` with tasks that
do not have the parameter `ChocolateyBuildOutput`.

## [0.117.0] - 2023-09-29

### Added
Expand Down
13 changes: 9 additions & 4 deletions Sampler/scripts/Set-SamplerTaskVariable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ $ReleaseNotesPath = Get-SamplerAbsolutePath -Path $ReleaseNotesPath -RelativeTo
2 . If it set in build.yaml we use it
3 . If it set nowhere, we used an empty value
#>
if (-not [string]::IsNullOrEmpty($BuiltModuleSubDirectory))
if (-not [System.String]::IsNullOrEmpty($BuiltModuleSubDirectory))
{
$BuiltModuleSubdirectory = Get-SamplerAbsolutePath -Path $BuiltModuleSubDirectory -RelativeTo $OutputDirectory
}
Expand All @@ -106,10 +106,15 @@ else {

"`tBuilt Module Subdirectory = '$BuiltModuleSubdirectory'"

$ChocolateyBuildOutput = Get-SamplerAbsolutePath -Path $ChocolateyBuildOutput -RelativeTo $OutputDirectory
$isChocolateyPackage = $false

# If this returns $true then the task Build_Chocolatey_Package created the folder
$isChocolateyPackage = Test-Path -Path $ChocolateyBuildOutput
if (-not [System.String]::IsNullOrEmpty($ChocolateyBuildOutput))
{
$ChocolateyBuildOutput = Get-SamplerAbsolutePath -Path $ChocolateyBuildOutput -RelativeTo $OutputDirectory

# If this returns $true then the task Build_Chocolatey_Package created the folder
$isChocolateyPackage = Test-Path -Path $ChocolateyBuildOutput
}

if ($isChocolateyPackage)
{
Expand Down

0 comments on commit 15aecea

Please sign in to comment.