Skip to content

Commit 0af5fb2

Browse files
committed
First attempt at automatically downloading builds from http://opensource.spotify.com/cefbuilds/index.json
(http://opensource.spotify.com/cefbuilds/index.html) Will download a specific version Make sure 7zip and cmake are both in the path Former-commit-id: 1348c82f258ead8c8964f085bf760ca0c68820a6
1 parent 97ffa9c commit 0af5fb2

File tree

2 files changed

+100
-4
lines changed

2 files changed

+100
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ cef_binary_3.y.z_windows64/*
1414
_ReSharper*
1515
out
1616
*Thumbs.db
17+
*.bz2

build.ps1

Lines changed: 99 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
param(
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
2124
function 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+
381476
DownloadNuget
382477

383478
Bootstrap

0 commit comments

Comments
 (0)