55 [Parameter (Position = 0 )]
66 [string ] $Target = " nupkg" ,
77
8+ [ValidateSet (" none" , " download" , " local" )]
89 [Parameter (Position = 1 )]
9- [bool ]$DownloadBinary = $true
10+ [string ] $DownloadBinary = " download" ,
11+
12+ [Parameter (Position = 2 )]
13+ # absolute or relative path to directory containing cef binaries archives (used if DownloadBinary = local)
14+ [string ] $CefBinaryDir = " ../cefsource/chromium/src/cef/binary_distrib/" ,
15+
16+ [Parameter (Position = 3 )]
17+ $CefVersion = " 3.2883.1552.g88ff29a"
1018)
1119
1220$WorkingDir = split-path - parent $MyInvocation.MyCommand.Definition
@@ -18,7 +26,6 @@ $Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll_wrapper') 'libcef_dll_wrappe
1826$Cef64 = Join-Path $WorkingDir ' cef_binary_3.y.z_windows64'
1927$Cef64vcx = Join-Path (Join-Path $Cef64 ' libcef_dll_wrapper' ) ' libcef_dll_wrapper.vcxproj'
2028
21- $CefVersion = " 3.2883.1552.g88ff29a"
2229# Take the cef version and strip the commit hash
2330$CefPackageVersion = $CefVersion.SubString (0 , $CefVersion.LastIndexOf (' .' ))
2431
@@ -444,6 +451,80 @@ function DownloadCefBinaryAndUnzip()
444451 }
445452}
446453
454+ function CopyFromLocalCefBuild ()
455+ {
456+ # Example file names from cefsource build:
457+ # 32-bit: cef_binary_3.2924.1538.gbfdeccd_windows32.tar.bz2
458+ # 64-bit: cef_binary_3.2924.1538.gbfdeccd_windows64.tar.bz2
459+
460+ Write-Host $CefVersion
461+
462+ $Cef32FileName = " cef_binary_$ ( $CefVersion ) _windows32.tar.bz2"
463+ $Cef64FileName = " cef_binary_$ ( $CefVersion ) _windows64.tar.bz2"
464+
465+ set-alias sz " $env: ProgramFiles \7-Zip\7z.exe"
466+
467+ if ([System.IO.Path ]::IsPathRooted($CefBinaryDir ))
468+ {
469+ $CefBuildDir = $CefBinaryDir
470+ }
471+ else
472+ {
473+ $CefBuildDir = Join-Path $WorkingDir " $CefBinaryDir /"
474+ }
475+
476+ $LocalFile = Join-Path $WorkingDir $Cef32FileName
477+
478+ if (-not (Test-Path $LocalFile ))
479+ {
480+ Write-Diagnostic " Copy $Cef32FileName (approx 200mb)"
481+ Copy-Item ($CefBuildDir + $Cef32FileName ) $LocalFile
482+ Write-Diagnostic " Copy of $Cef32FileName complete"
483+ }
484+
485+ if (-not (Test-Path (Join-Path $Cef32 ' \include\cef_version.h' )))
486+ {
487+ # Extract bzip file
488+ sz e $LocalFile
489+ # Extract tar file
490+ $TarFile = ($LocalFile ).Substring(0 , $LocalFile.length - 4 )
491+ sz x $TarFile
492+ # Sleep for a short period to allow 7z to release it's file handles
493+ sleep - m 2000
494+ # Remove tar file
495+ Remove-Item $TarFile
496+ $Folder = Join-Path $WorkingDir ($Cef32FileName.Substring (0 , $Cef32FileName.length - 8 ))
497+ Move-Item ($Folder + ' \*' ) $Cef32 - force
498+ Remove-Item $Folder
499+ }
500+
501+ $LocalFile = Join-Path $WorkingDir $Cef64FileName
502+
503+ if (-not (Test-Path $LocalFile ))
504+ {
505+
506+ Write-Diagnostic " Copy $Cef64FileName (approx 200mb)"
507+ Copy-Item ($CefBuildDir + $Cef64FileName ) $LocalFile ;
508+ Write-Diagnostic " Copy of $Cef64FileName complete"
509+ }
510+
511+ if (-not (Test-Path (Join-Path $Cef64 ' \include\cef_version.h' )))
512+ {
513+ # Extract bzip file
514+ sz e $LocalFile
515+ # Extract tar file
516+ $TarFile = ($LocalFile ).Substring(0 , $LocalFile.length - 4 )
517+ sz x $TarFile
518+ # Sleep for a short period to allow 7z to release it's file handles
519+ sleep - m 2000
520+ # Remove tar file
521+ Remove-Item $TarFile
522+ $Folder = Join-Path $WorkingDir ($Cef64FileName.Substring (0 , $Cef64FileName.length - 8 ))
523+ Move-Item ($Folder + ' \*' ) $Cef64 - force
524+ Remove-Item $Folder
525+ }
526+ }
527+
447528function CheckDependencies ()
448529{
449530 # Check for cmake
@@ -461,9 +542,18 @@ function CheckDependencies()
461542
462543CheckDependencies
463544
464- if ($DownloadBinary )
545+ switch - Exact ($DownloadBinary )
465546{
466- DownloadCefBinaryAndUnzip
547+ " none" {
548+ }
549+ " download"
550+ {
551+ DownloadCefBinaryAndUnzip
552+ }
553+ " local"
554+ {
555+ CopyFromLocalCefBuild
556+ }
467557}
468558
469559DownloadNuget
0 commit comments