11param (
22 [ValidateSet (" vs2012" , " vs2013" , " vs2015" , " nupkg" , " nupkg-only" )]
33 [Parameter (Position = 0 )]
4- [string ] $Target = " nupkg"
5- )
4+ [string ] $Target = " nupkg" ,
65
7- Import-Module BitsTransfer
6+ [Parameter (Position = 1 )]
7+ [bool ]$DownloadBinary = $true
8+ )
89
910$WorkingDir = split-path - parent $MyInvocation.MyCommand.Definition
1011
@@ -15,7 +16,9 @@ $Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll_wrapper') 'libcef_dll_wrappe
1516$Cef64 = Join-Path $WorkingDir ' cef_binary_3.y.z_windows64'
1617$Cef64vcx = Join-Path (Join-Path $Cef64 ' libcef_dll_wrapper' ) ' libcef_dll_wrapper.vcxproj'
1718
18- $CefPackageVersion = " 3.2704.1418"
19+ $CefVersion = " 3.2704.1424.gc3f0a5b"
20+ # Take the cef version and strip the commit hash
21+ $CefPackageVersion = $CefVersion.SubString (0 , $CefVersion.LastIndexOf (' .' ))
1922
2023# https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1
2124function Invoke-BatchFile
@@ -378,6 +381,98 @@ function DownloadNuget()
378381 }
379382}
380383
384+ function DownloadCefBinaryAndUnzip ()
385+ {
386+ $Client = New-Object System.Net.WebClient;
387+
388+ $CefBuildServerUrl = " http://opensource.spotify.com/cefbuilds/"
389+ $CefBuildServerJsonPackageList = $CefBuildServerUrl + " index.json"
390+
391+ $CefBuildsJson = Invoke-WebRequest - Uri $CefBuildServerJsonPackageList | ConvertFrom-Json
392+ $CefWin32CefVersion = $CefBuildsJson.windows32.versions | Where-Object {$_.cef_version -eq $CefVersion }
393+ $CefWin64CefVersion = $CefBuildsJson.windows64.versions | Where-Object {$_.cef_version -eq $CefVersion }
394+
395+ $Cef32FileName = ($CefWin32CefVersion.files | Where-Object {$_.type -eq " standard" }).name
396+ $Cef64FileName = ($CefWin64CefVersion.files | Where-Object {$_.type -eq " standard" }).name
397+
398+ # Make sure there is a 32bit and 64bit version for the specified build
399+ if ($CefWin32CefVersion.cef_version -ne $CefWin64CefVersion.cef_version )
400+ {
401+ Die ' Win32 version is $CefWin32CefVersion.cef_version and Win64 version is $CefWin64CefVersion.cef_version - both must be the same'
402+ }
403+
404+ set-alias sz " $env: ProgramFiles \7-Zip\7z.exe"
405+
406+ $LocalFile = Join-Path $WorkingDir $Cef32FileName
407+
408+ if (-not (Test-Path $Cef32FileName ))
409+ {
410+ Write-Diagnostic " Download $Cef32FileName this will take a while as files are approx 200mb each"
411+ $Client.DownloadFile ($CefBuildServerUrl + $Cef32FileName , $LocalFile );
412+ Write-Diagnostic " Download $Cef32FileName complete"
413+ }
414+
415+ if (-not (Test-Path (Join-Path $Cef32 ' \include\cef_version.h' )))
416+ {
417+ # Extract bzip file
418+ sz e $LocalFile
419+ # Extract tar file
420+ $TarFile = ($LocalFile ).Substring(0 , $LocalFile.length - 4 )
421+ sz x $TarFile
422+ # Remove tar file
423+ Remove-Item $TarFile
424+ $Folder = Join-Path $WorkingDir ($Cef32FileName.Substring (0 , $Cef32FileName.length - 8 ))
425+ Move-Item ($Folder + ' \*' ) $Cef32 - force
426+ Remove-Item $Folder
427+ }
428+
429+ $LocalFile = Join-Path $WorkingDir $Cef64FileName
430+
431+ if (-not (Test-Path $Cef64FileName ))
432+ {
433+
434+ Write-Diagnostic " Download $Cef64FileName this will take a while as files are approx 200mb each"
435+ $Client.DownloadFile ($CefBuildServerUrl + $Cef64FileName , $LocalFile );
436+ Write-Diagnostic " Download $Cef64FileName complete"
437+ }
438+
439+ if (-not (Test-Path (Join-Path $Cef64 ' \include\cef_version.h' )))
440+ {
441+ # Extract bzip file
442+ sz e $LocalFile
443+ # Extract tar file
444+ $TarFile = ($LocalFile ).Substring(0 , $LocalFile.length - 4 )
445+ sz x $TarFile
446+ # Remove tar file
447+ Remove-Item $TarFile
448+ $Folder = Join-Path $WorkingDir ($Cef64FileName.Substring (0 , $Cef64FileName.length - 8 ))
449+ Move-Item ($Folder + ' \*' ) $Cef64 - force
450+ Remove-Item $Folder
451+ }
452+ }
453+
454+ function CheckDependencies ()
455+ {
456+ # Check for cmake
457+ if ((Get-Command " cmake.exe" - ErrorAction SilentlyContinue) -eq $null )
458+ {
459+ Die " Unable to find cmake.exe in your PATH"
460+ }
461+
462+ # Check for 7zip
463+ if (-not (test-path " $env: ProgramFiles \7-Zip\7z.exe" ))
464+ {
465+ Die " $env: ProgramFiles \7-Zip\7z.exe is required"
466+ }
467+ }
468+
469+ CheckDependencies
470+
471+ if ($DownloadBinary )
472+ {
473+ DownloadCefBinaryAndUnzip
474+ }
475+
381476DownloadNuget
382477
383478Bootstrap
0 commit comments