Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command line support for using local CEF builds #44

Merged
merged 1 commit into from
Feb 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 94 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ param(
[Parameter(Position = 0)]
[string] $Target = "nupkg",

[ValidateSet("none", "download", "local")]
[Parameter(Position = 1)]
[bool]$DownloadBinary = $true
[string] $DownloadBinary = "download",

[Parameter(Position = 2)]
# absolute or relative path to directory containing cef binaries archives (used if DownloadBinary = local)
[string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/",

[Parameter(Position = 3)]
$CefVersion = "3.2883.1552.g88ff29a"
)

$WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition
Expand All @@ -18,7 +26,6 @@ $Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll_wrapper') 'libcef_dll_wrappe
$Cef64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows64'
$Cef64vcx = Join-Path (Join-Path $Cef64 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj'

$CefVersion = "3.2883.1552.g88ff29a"
# Take the cef version and strip the commit hash
$CefPackageVersion = $CefVersion.SubString(0, $CefVersion.LastIndexOf('.'))

Expand Down Expand Up @@ -444,6 +451,80 @@ function DownloadCefBinaryAndUnzip()
}
}

function CopyFromLocalCefBuild()
{
# Example file names from cefsource build:
# 32-bit: cef_binary_3.2924.1538.gbfdeccd_windows32.tar.bz2
# 64-bit: cef_binary_3.2924.1538.gbfdeccd_windows64.tar.bz2

Write-Host $CefVersion

$Cef32FileName = "cef_binary_$($CefVersion)_windows32.tar.bz2"
$Cef64FileName = "cef_binary_$($CefVersion)_windows64.tar.bz2"

set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"

if ([System.IO.Path]::IsPathRooted($CefBinaryDir))
{
$CefBuildDir = $CefBinaryDir
}
else
{
$CefBuildDir = Join-Path $WorkingDir "$CefBinaryDir/"
}

$LocalFile = Join-Path $WorkingDir $Cef32FileName

if(-not (Test-Path $LocalFile))
{
Write-Diagnostic "Copy $Cef32FileName (approx 200mb)"
Copy-Item ($CefBuildDir+$Cef32FileName) $LocalFile
Write-Diagnostic "Copy of $Cef32FileName complete"
}

if(-not (Test-Path (Join-Path $Cef32 '\include\cef_version.h')))
{
# Extract bzip file
sz e $LocalFile
# Extract tar file
$TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4)
sz x $TarFile
#Sleep for a short period to allow 7z to release it's file handles
sleep -m 2000
#Remove tar file
Remove-Item $TarFile
$Folder = Join-Path $WorkingDir ($Cef32FileName.Substring(0, $Cef32FileName.length - 8))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

Move-Item ($Folder + '\*') $Cef32 -force
Remove-Item $Folder
}

$LocalFile = Join-Path $WorkingDir $Cef64FileName

if(-not (Test-Path $LocalFile))
{

Write-Diagnostic "Copy $Cef64FileName (approx 200mb)"
Copy-Item ($CefBuildDir+$Cef64FileName) $LocalFile;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation

Write-Diagnostic "Copy of $Cef64FileName complete"
}

if(-not (Test-Path (Join-Path $Cef64 '\include\cef_version.h')))
{
# Extract bzip file
sz e $LocalFile
# Extract tar file
$TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4)
sz x $TarFile
#Sleep for a short period to allow 7z to release it's file handles
sleep -m 2000
#Remove tar file
Remove-Item $TarFile
$Folder = Join-Path $WorkingDir ($Cef64FileName.Substring(0, $Cef64FileName.length - 8))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is out. Assuming you copied this and the original indentation is out and you have time please fix that also.

Move-Item ($Folder + '\*') $Cef64 -force
Remove-Item $Folder
}
}

function CheckDependencies()
{
#Check for cmake
Expand All @@ -461,9 +542,18 @@ function CheckDependencies()

CheckDependencies

if($DownloadBinary)
switch -Exact ($DownloadBinary)
{
DownloadCefBinaryAndUnzip
"none" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brace on new line

}
"download"
{
DownloadCefBinaryAndUnzip
}
"local"
{
CopyFromLocalCefBuild
}
}

DownloadNuget
Expand Down