Skip to content

Commit

Permalink
Merge pull request #315 from tgauth/update-build-script
Browse files Browse the repository at this point in the history
remove print statements when clippy is specified
  • Loading branch information
SteveL-MSFT authored Feb 10, 2024
2 parents 7a070e7 + b126e2a commit dc4e044
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -196,33 +196,35 @@ if ($failed) {
Copy-Item $PSScriptRoot/tools/add-path.ps1 $target -Force -ErrorAction Ignore

$relative = Resolve-Path $target -Relative
Write-Host -ForegroundColor Green "`nEXE's are copied to $target ($relative)"
if (!$Clippy) {
Write-Host -ForegroundColor Green "`nEXE's are copied to $target ($relative)"

# remove the other target in case switching between them
$dirSeparator = [System.IO.Path]::DirectorySeparatorChar
if ($Release) {
$oldTarget = $target.Replace($dirSeparator + 'release', $dirSeparator + 'debug')
}
else {
$oldTarget = $target.Replace($dirSeparator + 'debug', $dirSeparator + 'release')
}
$env:PATH = $env:PATH.Replace($oldTarget, '')

$paths = $env:PATH.Split([System.IO.Path]::PathSeparator)
$found = $false
foreach ($path in $paths) {
if ($path -eq $target) {
$found = $true
break
# remove the other target in case switching between them
$dirSeparator = [System.IO.Path]::DirectorySeparatorChar
if ($Release) {
$oldTarget = $target.Replace($dirSeparator + 'release', $dirSeparator + 'debug')
}
else {
$oldTarget = $target.Replace($dirSeparator + 'debug', $dirSeparator + 'release')
}
$env:PATH = $env:PATH.Replace($oldTarget, '')

$paths = $env:PATH.Split([System.IO.Path]::PathSeparator)
$found = $false
foreach ($path in $paths) {
if ($path -eq $target) {
$found = $true
break
}
}
}

# remove empty entries from path
$env:PATH = [string]::Join([System.IO.Path]::PathSeparator, $env:PATH.Split([System.IO.Path]::PathSeparator, [StringSplitOptions]::RemoveEmptyEntries))
# remove empty entries from path
$env:PATH = [string]::Join([System.IO.Path]::PathSeparator, $env:PATH.Split([System.IO.Path]::PathSeparator, [StringSplitOptions]::RemoveEmptyEntries))

if (!$found) {
Write-Host -ForegroundCOlor Yellow "Adding $target to `$env:PATH"
$env:PATH += [System.IO.Path]::PathSeparator + $target
if (!$found) {
Write-Host -ForegroundCOlor Yellow "Adding $target to `$env:PATH"
$env:PATH += [System.IO.Path]::PathSeparator + $target
}
}

if ($Test) {
Expand Down

0 comments on commit dc4e044

Please sign in to comment.