Skip to content

Commit c67f9fe

Browse files
committed
Updated for support to latest CEF build formats and finally official docker client isolation mode for windows.
1 parent 30365a6 commit c67f9fe

7 files changed

+17
-13
lines changed

Diff for: AzureTemplateFile.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
"imageReference": {
225225
"publisher": "MicrosoftWindowsServer",
226226
"offer": "WindowsServerSemiAnnual",
227-
"sku": "Datacenter-Core-1803-with-Containers-smalldisk",
227+
"sku": "Datacenter-Core-1809-with-Containers-smalldisk",
228228
"version": "latest"
229229
}
230230
},

Diff for: Dockerfile_vs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
ARG BASE_DOCKER_FILE="microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-1803"
1+
ARG BASE_DOCKER_FILE="mcr.microsoft.com/windows/servercore:1809-amd64"
2+
ENV COMPLUS_NGenProtectedProcess_FeatureEnabled 0
23
FROM $BASE_DOCKER_FILE
34
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
45

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
## Summary
2828
Automated chrome cef building and/or cefsharp building dockerfiles and scripts.
2929

30-
While the processes of building CEF and CEFSHARP are not hard they require a very exacting environment and build steps can take a _long_ time so are annoying to repeat. The goal if this repo is a collection of scripts to automate everything to make it easy for anyone to do. We are using Docker to run everything in a container as it makes it much easier to reproduce and won't pollute your dev environment with all the pre-reqs. You can easily tweak the exact versions you want to build, and the build flags. From creating a VM on your cloud provider of choice (or your own machine) it is about 20 minutes of setup, starting a build script, and just waiting a few hours for it to spit out the compiled binaries. It has been tested with 63, 65, 67, 69 and 70 but would likely work for any modern chrome build without changes (in most cases).
30+
While the processes of building CEF and CEFSHARP are not hard they require a very exacting environment and build steps can take a _long_ time so are annoying to repeat. The goal if this repo is a collection of scripts to automate everything to make it easy for anyone to do. We are using Docker to run everything in a container as it makes it much easier to reproduce and won't pollute your dev environment with all the pre-reqs. You can easily tweak the exact versions you want to build, and the build flags. From creating a VM on your cloud provider of choice (or your own machine) it is about 20 minutes of setup, starting a build script, and just waiting a few hours for it to spit out the compiled binaries. It has been tested with chrome 63->75 but would likely work for any modern chrome build without changes (in most cases).
3131

3232

3333
## Thanks
@@ -43,7 +43,7 @@ Beware if using the exact same version string as an official CEF Build as it wil
4343

4444
In part we use the latest version of several installers/build tools if they changed so might the success of these dockerfiles. It does not build the debug versions of CEF or CEFSharp. This could be added as an option pretty easily (but would probably at-least double build times). For some reason I had issues getting the automated build script for CEF to work doing the calls by hand is pretty basic however.
4545

46-
Window 10 Client (Pro) by default with docker uses HyperV isolation, this mode is very non performant vs process isolation mode.
46+
Window 10 Client (Pro) by default with docker uses HyperV isolation, this mode is very non performant vs process isolation mode. Make sure to change it (and see the note below).
4747

4848
## Requirements
4949
The following requirements are for chrome 63->70 and the current vs_2017 installer, they may change over time. Compiling is largely CPU bound but linking is largely IO bound.
@@ -144,7 +144,7 @@ With the Azure F32 v2 host above the total estimated build time is about 2.1 hou
144144
- cefsharp: 4 minutes
145145

146146
### HyperV Isolation (for server or Windows 10 client) Mode
147-
HyperV isolation mode should be avoided if possible. It is slower, and more prone to fail. For Windows 10 client there is not a **legal** alternative. NOTE: If you are not using process isolation mode you WILL need to set ```$VAR_HYPERV_MEMORY_ADD``` and make sure your page file is properly sized (recommend a page file at least a few gigs bigger as it needs that amount of FREE page file space). It will set the memory on every docker build step to up the default memory limit. Technically this is primarily needed in the CEF build step. NOTE if you stop docker during a build with HyperV it does not properly kill off the hyperV container restart docker to fix this.
147+
HyperV isolation mode should be avoided if possible. It is slower, and more prone to fail. For Windows 10 clients below 1809 (October 2018 edition) there is not a **legal** alternative. You must also use Docker Desktop build newer than October of 2018. NOTE: If you are not using process isolation mode you WILL need to set ```$VAR_HYPERV_MEMORY_ADD``` and make sure your page file is properly sized (recommend a page file at least a few gigs bigger as it needs that amount of FREE page file space). It will set the memory on every docker build step to up the default memory limit. Technically this is primarily needed in the CEF build step. NOTE if you stop docker during a build with HyperV it does not properly kill off the hyperV container restart docker to fix this.
148148

149149
## Build Process
150150
Once docker is setup and running copy this repo to a local folder. Copy versions_src.ps1 to versions.ps1 and change the version strings to match what you want. NOTE BASE_DOCKER_FILE must match the same kernel as the host machine IF you are using process isolation mode. This means you cannot use the 1709 image on an older host and you can use and older image on a 1709 host. Either base file is fine however to use just match it to the host.

Diff for: build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if (! $NoMemoryWarn){
4040
$total_memory_gb += $file.MaximumSize/1kb; #is zero if system managed, then we really don't know how big it could be.
4141
}
4242
if ($total_memory_gb -lt $min_gigs){
43-
if (! (confirm("Warning $warning. Your machine may not have enough memory, make sure your page files are working and can grow to allow it. (Disable this warning with -$NoMemoryWarn flag). Do you want to proceed?"))){
43+
if (! (confirm("Warning $warning. Your machine may not have enough memory, make sure your page files are working and can grow to allow it. (Disable this warning with -NoMemoryWarn flag). Do you want to proceed?"))){
4444
exit 1;
4545
}
4646

Diff for: cef_build.ps1

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ if ($env:BINARY_EXT -eq "7z"){
1111
$env:CEF_COMMAND_7ZIP="C:/Program Files/7-Zip/7z.exe";
1212
}
1313
$env:CEF_ARCHIVE_FORMAT = $env:BINARY_EXT;
14-
1514
if ($env:DUAL_BUILD -eq "1" -and $env:CHROME_BRANCH -lt 3396){ #newer builds can take a good bit more time linking just let run with double the proc count
1615
$cores = ([int]$env:NUMBER_OF_PROCESSORS) + 2; #ninja defaults to number of procs + 2
1716
if ($cores % 2 -eq 1){
1817
$cores +=1;
1918
}
2019
$build_args_add = "-j " + ($cores/2);
2120
}
21+
2222
Function RunBuild{
2323
[CmdletBinding()]
2424
Param($build_args_add,$version)
@@ -83,10 +83,12 @@ if ($px86.ExitCode -ne 0){
8383
Set-Location -Path C:/code/chromium/src/cef/tools/;
8484
RunProc -proc "C:/code/chromium/src/cef/tools/make_distrib.bat" -opts "--ninja-build --allow-partial";
8585
RunProc -proc "C:/code/chromium/src/cef/tools/make_distrib.bat" -opts "--ninja-build --allow-partial --x64-build";
86-
if (@(dir -Filter "cef_binary_3.*_windows32.$env:BINARY_EXT" "c:/code/chromium/src/cef/binary_distrib/").Count -ne 1){
86+
87+
88+
if (@(dir -Filter "cef_binary_*_windows32.$env:BINARY_EXT" "c:/code/chromium/src/cef/binary_distrib/").Count -ne 1){
8789
throw "Not able to find win32 file as expected";
8890
}
89-
if (@(dir -Filter "cef_binary_3.*_windows64.$env:BINARY_EXT" "c:/code/chromium/src/cef/binary_distrib/").Count -ne 1){
91+
if (@(dir -Filter "cef_binary_*_windows64.$env:BINARY_EXT" "c:/code/chromium/src/cef/binary_distrib/").Count -ne 1){
9092
throw "Not able to find win64 file as expected";
9193
}
9294
mkdir c:/code/binaries -Force;

Diff for: cefsharp_set_versions_and_restore.ps1

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition;
3131
if ($env:CEF_VERSION_STR -eq "auto"){
3232
$name = (dir -Filter cef.redist.x64.*.nupkg $env:PACKAGE_SOURCE)[0].Name;
3333
$name = ($name -replace "cef.redist.x64.", "") -replace ".nupkg", "";
34-
if ($name -and $name.StartsWith("3." + $env:CHROME_BRANCH) ) {
34+
$base_check = $env:CEFSHARP_VERSION.SubString(0, $env:CEFSHARP_VERSION.IndexOf('.'));
35+
if ($name -and $name.StartsWith($base_check + ".") ) { #with new version string format we will just make sure they are both starting with the same master version
3536
$env:CEF_VERSION_STR = $name;
3637
setx /M CEF_VERSION_STR $env:CEF_VERSION_STR;
3738
}

Diff for: versions_src.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
$VAR_CHROME_BRANCH="3396";
2-
$VAR_CEFSHARP_VERSION="67.0.90";
3-
$VAR_CEFSHARP_BRANCH="cefsharp/67";
1+
$VAR_CHROME_BRANCH="3370";
2+
$VAR_CEFSHARP_VERSION="75.0.90";
3+
$VAR_CEFSHARP_BRANCH="cefsharp/75";
44
$VAR_BASE_DOCKER_FILE="microsoft/dotnet-framework:4.7.2-runtime-windowsservercore-1803"; #microsoft/dotnet-framework:4.7.1-windowsservercore-1709
55
$VAR_DUAL_BUILD="0"; #set to 1 to build x86 and x64 together, mainly to speed up linking which is single threaded, note may need excess ram.
66
$VAR_GN_DEFINES="";

0 commit comments

Comments
 (0)