Skip to content

Commit bc45e5d

Browse files
committed
build.ps1 - Hopefully fix appveyor pushartifact
1 parent fb51eeb commit bc45e5d

File tree

1 file changed

+24
-39
lines changed

1 file changed

+24
-39
lines changed

build.ps1

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,6 @@ function Warn
114114

115115
}
116116

117-
function TernaryReturn
118-
{
119-
param(
120-
[Parameter(Position = 0, ValueFromPipeline = $true)]
121-
[bool] $Yes,
122-
[Parameter(Position = 1, ValueFromPipeline = $true)]
123-
$Value,
124-
[Parameter(Position = 2, ValueFromPipeline = $true)]
125-
$Value2
126-
)
127-
128-
if ($Yes)
129-
{
130-
return $Value
131-
}
132-
133-
$Value2
134-
}
135-
136117
function DownloadDependencies()
137118
{
138119
$folder = Join-Path $env:LOCALAPPDATA .\nuget;
@@ -148,9 +129,13 @@ function DownloadDependencies()
148129
$Client.DownloadFile('https://dist.nuget.org/win-x86-commandline/v5.11.0/nuget.exe', $Nuget);
149130
}
150131

151-
$programFilesDir = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0]
132+
$global:VSWherePath = Join-Path ${env:ProgramFiles} 'Microsoft Visual Studio\Installer\vswhere.exe'
133+
134+
if(-not (Test-Path $global:VSWherePath))
135+
{
136+
$global:VSWherePath = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
137+
}
152138

153-
$global:VSwherePath = Join-Path $programFilesDir 'Microsoft Visual Studio\Installer\vswhere.exe'
154139
#Check if we already have vswhere which is included in newer versions of VS2019/VS2021
155140
if(-not (Test-Path $global:VSwherePath))
156141
{
@@ -186,7 +171,7 @@ function WriteVersionToRuntimeJson
186171
function CheckDependencies()
187172
{
188173
# Check for cmake
189-
if ((Get-Command "cmake.exe" -ErrorAction SilentlyContinue) -eq $null)
174+
if ($null -eq (Get-Command "cmake.exe" -ErrorAction SilentlyContinue))
190175
{
191176
Die "Unable to find cmake.exe in your PATH"
192177
}
@@ -215,13 +200,13 @@ function Bootstrap
215200

216201
$arch = $Platform.NativeArch
217202

218-
md "cef\$arch" | Out-Null
219-
md "cef\$arch\debug" | Out-Null
220-
md "cef\$arch\debug\VS2019" | Out-Null
221-
md "cef\$arch\debug\VS2021" | Out-Null
222-
md "cef\$arch\release" | Out-Null
223-
md "cef\$arch\release\VS2019" | Out-Null
224-
md "cef\$arch\release\VS2021" | Out-Null
203+
mkdir "cef\$arch" | Out-Null
204+
mkdir "cef\$arch\debug" | Out-Null
205+
mkdir "cef\$arch\debug\VS2019" | Out-Null
206+
mkdir "cef\$arch\debug\VS2021" | Out-Null
207+
mkdir "cef\$arch\release" | Out-Null
208+
mkdir "cef\$arch\release\VS2019" | Out-Null
209+
mkdir "cef\$arch\release\VS2021" | Out-Null
225210
}
226211

227212
function Msvs
@@ -264,7 +249,7 @@ function Msvs
264249

265250
Write-Diagnostic "$($VS_OFFICIAL_VER)InstallPath: $VSInstallPath"
266251

267-
if($VSInstallPath -eq $null -or !(Test-Path $VSInstallPath))
252+
if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath))
268253
{
269254
Die "Visual Studio $VS_OFFICIAL_VER was not found"
270255
}
@@ -273,7 +258,7 @@ function Msvs
273258
$VXXCommonTools = Join-Path $VSInstallPath VC\Auxiliary\Build
274259
$CmakeGenerator = "Visual Studio $VS_VER"
275260

276-
if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools))))
261+
if ($null -eq $VXXCommonTools -or (-not (Test-Path($VXXCommonTools))))
277262
{
278263
Die 'Error unable to find any visual studio environment'
279264
}
@@ -305,10 +290,10 @@ function Msvs
305290
# Configure build environment
306291
Invoke-BatchFile $VCVarsAll $VCVarsAllArch
307292
Write-Diagnostic "pushd $CefDir"
308-
pushd $CefDir
293+
Push-Location $CefDir
309294
# Remove previously generated CMake data for the different platform/toolchain
310-
rm CMakeCache.txt -ErrorAction:SilentlyContinue
311-
rm -r CMakeFiles -ErrorAction:SilentlyContinue
295+
Remove-Item CMakeCache.txt -ErrorAction:SilentlyContinue
296+
Remove-Item -r CMakeFiles -ErrorAction:SilentlyContinue
312297
$cmake_path = "cmake.exe";
313298
if ($env:ChocolateyInstall -And (Test-Path ($env:ChocolateyInstall + "\bin\" + $cmake_path)))
314299
{
@@ -317,7 +302,7 @@ function Msvs
317302
&"$cmake_path" --version
318303
Write-Diagnostic "Running cmake: $cmake_path -Wno-dev -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ."
319304
&"$cmake_path" -Wno-dev -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD .
320-
popd
305+
Pop-Location
321306

322307
$Arguments = @(
323308
"$CefProject",
@@ -474,8 +459,8 @@ function Nupkg
474459
if ($env:APPVEYOR_REPO_TAG -eq "True")
475460
{
476461
Get-ChildItem -Path .\Nuget -Filter *.nupkg -File -Name| ForEach-Object {
477-
appveyor PushArtifact $_
478-
}
462+
appveyor PushArtifact $_.FullName
463+
} | Out-Null
479464
}
480465
}
481466

@@ -522,7 +507,7 @@ function DownloadCefBinaryAndUnzip()
522507

523508
$CefBuildServerUrl = "https://cef-builds.spotifycdn.com/"
524509

525-
if($global:CefBuildsJson -eq $null)
510+
if($null -eq $global:CefBuildsJson)
526511
{
527512
$CefBuildServerJsonPackageList = $CefBuildServerUrl + "index.json"
528513

@@ -533,7 +518,7 @@ function DownloadCefBinaryAndUnzip()
533518

534519
$CefWinCefVersion = $global:CefBuildsJson.($arch).versions | Where-Object {$_.cef_version -eq $CefVersion}
535520

536-
if($CefWinCefVersion -eq $null)
521+
if($null -eq $CefWinCefVersion)
537522
{
538523
Die "Build Unavailable - $arch has no files for version $CefVersion"
539524
}

0 commit comments

Comments
 (0)