From 62b46a32b22c9e255da24990bb8e5a168ed80c07 Mon Sep 17 00:00:00 2001 From: "Mitch Capper (they, them)" Date: Tue, 12 Oct 2021 02:30:54 -0700 Subject: [PATCH 01/21] Add -BuildArches to specify what platforms to build for (ie "x86 arm64") (#100) Removed much of the platform specific code redundancy --- ...embeddedframework.runtime.nuspec.template} | 8 +- ...romiumembeddedframework.runtime.win.nuspec | 2 +- build.ps1 | 489 ++++++------------ 3 files changed, 165 insertions(+), 334 deletions(-) rename NuGet/{chromiumembeddedframework.runtime.nuspec => chromiumembeddedframework.runtime.nuspec.template} (69%) diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec b/NuGet/chromiumembeddedframework.runtime.nuspec.template similarity index 69% rename from NuGet/chromiumembeddedframework.runtime.nuspec rename to NuGet/chromiumembeddedframework.runtime.nuspec.template index 8053485..9859d06 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.nuspec.template @@ -25,13 +25,7 @@ - - - - - - - + META_REPLACE_DATA diff --git a/NuGet/chromiumembeddedframework.runtime.win.nuspec b/NuGet/chromiumembeddedframework.runtime.win.nuspec index 6c34f26..95339c2 100644 --- a/NuGet/chromiumembeddedframework.runtime.win.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.win.nuspec @@ -29,7 +29,7 @@ - + diff --git a/build.ps1 b/build.ps1 index eecaf8b..4a832f4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -24,8 +24,23 @@ param( [Switch] $NoDebugBuild, [Parameter(Position = 6)] - [string] $Suffix + [string] $Suffix, + + [Parameter(Position = 7)] + [string] $BuildArches = "x86 x64 amd64" ) +$ARCHES = $BuildArches.Split(" "); +$ARCHES_TO_BITKEY = @{}; +foreach ($arch in $ARCHES) { + $arch_bit = $arch; + if ($arch_bit.StartsWith("x")) { + $arch_bit = $arch.Substring(1); + if ($arch_bit -eq "86"){ + $arch_bit = "32"; + } + $ARCHES_TO_BITKEY[$arch] = $arch_bit; + } +} Set-StrictMode -version latest $ErrorActionPreference = "Stop"; @@ -48,18 +63,20 @@ try if ($CefVersion -eq "auto" -and $DownloadBinary -eq "local") { #Take the version from the local binary only, requires only one version in that folder to work - $name = (dir -Filter cef_binary_*_windows64.$Extension $CefBinaryDir)[0].Name; - $CefVersion = ($name -replace "cef_binary_", "") -replace "_windows64.$Extension"; + + $name = (dir -Filter cef_binary_*_windows$($ARCHES_TO_BITKEY[$ARCHES[0]]).$Extension $CefBinaryDir)[0].Name; + $CefVersion = ($name -replace "cef_binary_", "") -replace "_windows$($ARCHES_TO_BITKEY[$ARCHES[0]]).$Extension"; } + $Cef = @{} + $Cefvcx = @{} - $Cef = Join-Path $WorkingDir 'cef' - $CefInclude = Join-Path $Cef 'include' - $Cef32 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows32' - $Cef32vcx = Join-Path (Join-Path $Cef32 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj' - $Cef64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windows64' - $Cef64vcx = Join-Path (Join-Path $Cef64 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj' - $CefArm64 = Join-Path $WorkingDir 'cef_binary_3.y.z_windowsarm64' - $CefArm64vcx = Join-Path (Join-Path $CefArm64 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj' + $Cef[""] = Join-Path $WorkingDir 'cef' + $CefInclude = Join-Path $Cef[""] 'include' + + foreach ($arch in $ARCHES) { + $Cef[$arch] = Join-Path $WorkingDir "cef_binary_3.y.z_windows$($ARCHES_TO_BITKEY[$arch])"; + $Cefvcx[$arch] = Join-Path (Join-Path $Cef[$arch] 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj' + } function Write-Diagnostic { @@ -185,36 +202,27 @@ try Write-Diagnostic "Bootstrapping" - if (Test-Path($Cef)) + if (Test-Path($Cef[""])) { - Remove-Item $Cef -Recurse | Out-Null + Remove-Item $Cef[""] -Recurse | Out-Null } # Copy include files - Copy-Item $Cef64\include $CefInclude -Recurse | Out-Null + Copy-Item "$($Cef[$ARCHES[0]])\include" $CefInclude -Recurse | Out-Null # Create default directory structure - md 'cef\win32' | Out-Null - md 'cef\win32\debug' | Out-Null - md 'cef\win32\debug\VS2019' | Out-Null - md 'cef\win32\debug\VS2021' | Out-Null - md 'cef\win32\release' | Out-Null - md 'cef\win32\release\VS2019' | Out-Null - md 'cef\win32\release\VS2021' | Out-Null - md 'cef\x64' | Out-Null - md 'cef\x64\debug' | Out-Null - md 'cef\x64\debug\VS2019' | Out-Null - md 'cef\x64\debug\VS2021' | Out-Null - md 'cef\x64\release' | Out-Null - md 'cef\x64\release\VS2019' | Out-Null - md 'cef\x64\release\VS2021' | Out-Null - md 'cef\arm64' | Out-Null - md 'cef\arm64\debug' | Out-Null - md 'cef\arm64\debug\VS2019' | Out-Null - md 'cef\arm64\debug\VS2021' | Out-Null - md 'cef\arm64\release' | Out-Null - md 'cef\arm64\release\VS2019' | Out-Null - md 'cef\arm64\release\VS2021' | Out-Null + foreach ($arch in $ARCHES) { + if ($arch -eq "x86"){ + $arch = "win32"; + } + md "cef\$arch" | Out-Null + md "cef\$arch\debug" | Out-Null + md "cef\$arch\debug\VS2019" | Out-Null + md "cef\$arch\debug\VS2021" | Out-Null + md "cef\$arch\release" | Out-Null + md "cef\$arch\release\VS2019" | Out-Null + md "cef\$arch\release\VS2021" | Out-Null + } } function Msvs @@ -288,20 +296,12 @@ try Die 'Error unable to find any visual studio environment' } - $CefProject = $Cef32vcx - $CefDir = $Cef32 - $Arch = 'win32' - if ($Platform -eq 'x64') + $CefProject = $Cefvcx[$Platform] + $CefDir = $Cef[$Platform] + $Arch = $Platform + if ($Arch -eq 'x86') { - $CefProject = $Cef64vcx - $CefDir = $Cef64 - $Arch = 'x64' - } - elseif ($Platform -eq 'arm64') - { - $CefProject = $CefArm64vcx - $CefDir = $CefArm64 - $Arch = 'arm64' + $Arch = "win32"; } $VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat @@ -311,19 +311,12 @@ try Return } - $VCXProj = $Cef32vcx - $VCVarsAllArch = 'x86' - if ($Platform -eq 'x64') - { - $VCXProj = $Cef64vcx - $VCVarsAllArch = 'x64' - } - elseif ($Platform -eq 'arm64') - { - $VCXProj = $CefArm64vcx + $VCXProj = $Cefvcx[$Platform] + $VCVarsAllArch = $Platform + if ($VCVarsAllArch -eq "arm64"){ $VCVarsAllArch = 'x64_arm64' } - + # Store the current environment variables so that we can reset them after running the build. # This is because vcvarsall.bat appends e.g. to the PATH variable every time it is called, # which can eventually lead to an error like "The input line is too long." when the PATH @@ -348,8 +341,8 @@ try $cmake_path = $env:ChocolateyInstall + "\bin\" + $cmake_path; } &"$cmake_path" --version - Write-Diagnostic "Running cmake: $cmake_path -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ." - &"$cmake_path" -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD . + Write-Diagnostic "Running cmake: $cmake_path -Wno-dev -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ." + &"$cmake_path" -Wno-dev -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD . popd $Arguments = @( @@ -390,6 +383,7 @@ try if ($Process.ExitCode -ne 0) { + Write-Host "Ran msbuild.exe with args: $Arguments" Write-Host "stdout: $stdout" Write-Host "stderr: $stderr" Die "Build failed" @@ -417,22 +411,14 @@ try Write-Diagnostic "Starting to build targeting toolchain $Toolchain" - if (! $NoDebugBuild) - { - Msvs "$Toolchain" 'Debug' 'x86' - } - Msvs "$Toolchain" 'Release' 'x86' - if (! $NoDebugBuild) - { - Msvs "$Toolchain" 'Debug' 'x64' - } - Msvs "$Toolchain" 'Release' 'x64' + foreach ($arch in $ARCHES) { - if (! $NoDebugBuild) - { - Msvs "$Toolchain" 'Debug' 'arm64' + if (! $NoDebugBuild) + { + Msvs "$Toolchain" 'Debug' "$arch" + } + Msvs "$Toolchain" 'Release' "$arch" } - Msvs "$Toolchain" 'Release' 'arm64' Write-Diagnostic "Finished build targeting toolchain $Toolchain" } @@ -462,25 +448,19 @@ try $VisualStudioVersion = "VS2021" } - $Arch = 'win32' - $CefArchDir = $Cef32 - if ($Platform -eq 'x64') + $CefDir = $Cef[$Platform] + $Arch = $Platform + if ($Arch -eq 'x86') { - $Arch = 'x64' - $CefArchDir = $Cef64 - } - elseif ($Platform -eq 'arm64') - { - $Arch = 'arm64' - $CefArchDir = $CefArm64 + $Arch = "win32"; } # cef_binary_3.y.z_windows32\out\debug\lib -> cef\win32\debug\vs2019 - Copy-Item $CefArchDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.lib $Cef\$Arch\$Configuration\$VisualStudioVersion | Out-Null - Copy-Item $CefArchDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.pdb $Cef\$Arch\$Configuration\$VisualStudioVersion | Out-Null + Copy-Item $CefDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.lib "$($Cef[''])\$Arch\$Configuration\$VisualStudioVersion" | Out-Null + Copy-Item $CefDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.pdb "$($Cef[''])\$Arch\$Configuration\$VisualStudioVersion" | Out-Null # cef_binary_3.y.z_windows32\debug -> cef\win32\debug - Copy-Item $CefArchDir\$Configuration\libcef.lib $Cef\$Arch\$Configuration | Out-Null + Copy-Item $CefDir\$Configuration\libcef.lib "$($Cef[''])\$Arch\$Configuration" | Out-Null } function Nupkg @@ -492,18 +472,22 @@ try { Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget" } - - # Build 32bit packages - . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x86;CPlatform=windows32;' -OutputDirectory nuget - . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x86;CPlatform=windows32;' -OutputDirectory nuget - - # Build 64bit packages - . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget - . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=x64;CPlatform=windows64;' -OutputDirectory nuget - - # Build arm64 packages - . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;Platform=arm64;CPlatform=windowsarm64;' -OutputDirectory nuget + $meta_template = ""; + foreach ($arch in $ARCHES) { + # Build packages + if ($arch -ne "arm64"){ + . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=windows$($ARCHES_TO_BITKEY[$arch]);" -OutputDirectory nuget + } + . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=windows$($ARCHES_TO_BITKEY[$arch]);" -OutputDirectory nuget + $meta_template += "`n `n"; + } + $meta_template += ""; + $meta_spec_file = "nuget\chromiumembeddedframework.runtime.nuspec"; + $content = Get-Content "$($meta_spec_file).template"; + $content = $content -replace "META_REPLACE_DATA", $meta_template; + $content | Out-File -FilePath $meta_spec_file; + # Meta Package . $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget @@ -516,11 +500,13 @@ try if ($env:APPVEYOR_REPO_TAG -eq "True") { - appveyor PushArtifact "nuget\cef.redist.x86.$CefPackageVersion.nupkg" - appveyor PushArtifact "nuget\cef.redist.x64.$CefPackageVersion.nupkg" - appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-x86.$CefPackageVersion.nupkg" - appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-x64.$CefPackageVersion.nupkg" - appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-arm64.$CefPackageVersion.nupkg" + foreach ($arch in $ARCHES) { + if ($arch -ne "arm64"){ + appveyor PushArtifact "nuget\cef.redist.$($arch).$CefPackageVersion.nupkg" + } + appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-$($arch).$CefPackageVersion.nupkg" + } + appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.$CefPackageVersion.nupkg" appveyor PushArtifact "nuget\cef.sdk.$CefPackageVersion.nupkg" } @@ -550,148 +536,62 @@ try $CefBuildServerJsonPackageList = $CefBuildServerUrl + "index.json" $CefBuildsJson = Invoke-WebRequest -UseBasicParsing -Uri $CefBuildServerJsonPackageList | ConvertFrom-Json - $CefWin32CefVersion = $CefBuildsJson.windows32.versions | Where-Object {$_.cef_version -eq $CefVersion} - $CefWin64CefVersion = $CefBuildsJson.windows64.versions | Where-Object {$_.cef_version -eq $CefVersion} - $CefWinArm64CefVersion = $CefBuildsJson.windowsarm64.versions | Where-Object {$_.cef_version -eq $CefVersion} - - $Cef32FileName = ($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).name - $Cef32FileHash = ($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 - $Cef32FileSize = (($CefWin32CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) - $Cef64FileName = ($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).name - $Cef64FileHash = ($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 - $Cef64FileSize = (($CefWin64CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) - $CefArm64FileName = ($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).name - $CefArm64FileHash = ($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 - $CefArm64FileSize = (($CefWinArm64CefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) - - # Make sure there is a 32bit and 64bit version for the specified build - if ($CefWin32CefVersion.cef_version -ne $CefWin64CefVersion.cef_version) - { - Die 'Win32 version is $CefWin32CefVersion.cef_version and Win64 version is $CefWin64CefVersion.cef_version - both must be the same' - } - if ($CefWin32CefVersion.cef_version -ne $CefWinArm64CefVersion.cef_version) - { - Die 'Win32 version is $CefWin32CefVersion.cef_version and WinArm64 version is $CefWinArm64CefVersion.cef_version - both must be the same' - } + $cef_version_comp = $false - set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" - $LocalFile = Join-Path $WorkingDir $Cef32FileName - - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Downloading $Cef32FileName; this will take a while as the file is $Cef32FileSize MB." - $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($Cef32FileName), $LocalFile); - - $Cef32LocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash - - Write-Diagnostic "Download $Cef32FileName complete" - Write-Diagnostic "Expected SHA1 for $Cef32FileName $Cef32FileHash" - Write-Diagnostic "Actual SHA1 for $Cef32FileName $Cef32LocalFileHash" - - if($Cef32LocalFileHash -ne $Cef32FileHash) - { - Die "SHA1 hash did not match" + set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" + foreach ($arch in $ARCHES) { + $CefWinCefVersion = $CefBuildsJson["windows$ARCHES_TO_BITKEY[$arch]"].versions | Where-Object {$_.cef_version -eq $CefVersion} + if (! $cef_version_comp){ + $cef_version_comp = $CefWinCefVersion.cef_version; + } + if ($cef_version_comp -ne $CefWinCefVersion.cef_version){ + Die "All versions of CEF must be the same but $arch is: $($CefWinCefVersion.cef_version) vs previous arch's of: $cef_version_comp"; } - } - - 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)) - Move-Item ($Folder + '\*') $Cef32 -force - Remove-Item $Folder - } - $LocalFile = Join-Path $WorkingDir $Cef64FileName + $CefFileName = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).name + $CefFileHash = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 + $CefFileSize = (($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Downloading $Cef64FileName; this will take a while as the file is $Cef64FileSize MB." - $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($Cef64FileName), $LocalFile); - - $Cef64LocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash - - Write-Diagnostic "Download $Cef64FileName complete" - Write-Diagnostic "Expected SHA1 for $Cef64FileName $Cef64FileHash" - Write-Diagnostic "Actual SHA1 for $Cef64FileName $Cef64LocalFileHash" - - if($Cef64LocalFileHash -ne $Cef64FileHash) + $LocalFile = Join-Path $WorkingDir $CefFileName + if (-not (Test-Path $LocalFile)) { - Die "SHA1 hash did not match" + Write-Diagnostic "Downloading $CefFileName; this will take a while as the file is $CefFileSize MB." + $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefFileName), $LocalFile); + + $CefLocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash + + Write-Diagnostic "Download $CefFileName complete" + Write-Diagnostic "Expected SHA1 for $CefFileName $CefFileHash" + Write-Diagnostic "Actual SHA1 for $CefFileName $CefLocalFileHash" + + if($CefLocalFileHash -ne $CefFileHash) + { + Die "SHA1 hash did not match" + } } - } - - 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 + if (-not (Test-Path (Join-Path $Cef[""] '\include\cef_version.h'))) + { + # Extract bzip file + sz e $LocalFile - # Remove tar file - Remove-Item $TarFile + # Extract tar file + $TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4) + sz x $TarFile - $Folder = Join-Path $WorkingDir ($Cef64FileName.Substring(0, $Cef64FileName.length - 8)) - Move-Item ($Folder + '\*') $Cef64 -force - Remove-Item $Folder - } + # Sleep for a short period to allow 7z to release it's file handles + sleep -m 2000 - $LocalFile = Join-Path $WorkingDir $CefArm64FileName + # Remove tar file + Remove-Item $TarFile - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Downloading $CefArm64FileName; this will take a while as the file is $CefArm64FileSize MB." - $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefArm64FileName), $LocalFile); - - $CefArm64LocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash - - Write-Diagnostic "Download $CefArm64FileName complete" - Write-Diagnostic "Expected SHA1 for $CefArm64FileName $CefArm64FileHash" - Write-Diagnostic "Actual SHA1 for $CefArm64FileName $CefArm64LocalFileHash" - - if($CefArm64LocalFileHash -ne $CefArm64FileHash) - { - Die "SHA1 hash did not match" + $Folder = Join-Path $WorkingDir ($CefFileName.Substring(0, $CefFileName.length - 8)) + Move-Item ($Folder + '\*') $Cef[$arch] -force + Remove-Item $Folder } } - if (-not (Test-Path (Join-Path $CefArm64 '\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 ($CefArm64FileName.Substring(0, $CefArm64FileName.length - 8)) - Move-Item ($Folder + '\*') $CefArm64 -force - Remove-Item $Folder - } } function CopyFromLocalCefBuild() @@ -702,114 +602,51 @@ try Write-Host $CefVersion - $Cef32FileName = "cef_binary_$($CefVersion)_windows32." + $Extension; - $Cef64FileName = "cef_binary_$($CefVersion)_windows64." + $Extension; - $CefArm64FileName = "cef_binary_$($CefVersion)_windowsarm64." + $Extension; - - 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 x $LocalFile; - - if ($Extension -eq "tar.bz2") + foreach ($arch in $ARCHES) { + $CefFileName = "cef_binary_$($CefVersion)_windows$($ARCHES_TO_BITKEY[$arch])." + $Extension; + set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" + if ([System.IO.Path]::IsPathRooted($CefBinaryDir)) { - # 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 + $CefBuildDir = $CefBinaryDir } - - $Folder = Join-Path $WorkingDir ($Cef32FileName.Substring(0, $Cef32FileName.length - ($Extension.Length+1))) - 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; - Write-Diagnostic "Copy of $Cef64FileName complete" - } - - if (-not (Test-Path (Join-Path $Cef64 '\include\cef_version.h'))) - { - # Extract bzip file - sz x $LocalFile; - - if ($Extension -eq "tar.bz2") + else { - # Extract tar file - $TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4) - sz x $TarFile + $CefBuildDir = Join-Path $WorkingDir "$CefBinaryDir/" + } - # Sleep for a short period to allow 7z to release it's file handles - sleep -m 2000 + $LocalFile = Join-Path $WorkingDir $CefFileName - # Remove tar file - Remove-Item $TarFile + if (-not (Test-Path $LocalFile)) + { + Write-Diagnostic "Copy $CefFileName (approx 200mb)" + Copy-Item ($CefBuildDir+$CefFileName) $LocalFile + Write-Diagnostic "Copy of $CefFileName complete" } - $Folder = Join-Path $WorkingDir ($Cef64FileName.Substring(0, $Cef64FileName.length - ($Extension.Length+1))) - Move-Item ($Folder + '\*') $Cef64 -force - Remove-Item $Folder - } - $LocalFile = Join-Path $WorkingDir $CefArm64FileName - - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Copy $CefArm64FileName (approx 200mb)" - Copy-Item ($CefBuildDir+$CefArm64FileName) $LocalFile; - Write-Diagnostic "Copy of $CefArm64FileName complete" - } + if (-not (Test-Path (Join-Path $Cef[$arch] '\include\cef_version.h'))) + { + # Extract bzip file + sz x $LocalFile; - if (-not (Test-Path (Join-Path $CefArm64 '\include\cef_version.h'))) - { - # Extract bzip file - sz x $LocalFile; + if ($Extension -eq "tar.bz2") + { + # Extract tar file + $TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4) + sz x $TarFile - if ($Extension -eq "tar.bz2") - { - # 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 - # Sleep for a short period to allow 7z to release it's file handles - sleep -m 2000 + # Remove tar file + Remove-Item $TarFile + } - # Remove tar file - Remove-Item $TarFile + $Folder = Join-Path $WorkingDir ($CefFileName.Substring(0, $CefFileName.length - ($Extension.Length+1))) + Move-Item ($Folder + '\*') $Cef[$arch] -force + Remove-Item $Folder } - $Folder = Join-Path $WorkingDir ($CefArm64FileName.Substring(0, $CefArm64FileName.length - ($Extension.Length+1))) - Move-Item ($Folder + '\*') $CefArm64 -force - Remove-Item $Folder } + } function WriteVersionToRuntimeJson From 26010a5dee2031d5e2b5ac8fd2ebf47fd77c07a1 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Mon, 11 Oct 2021 20:19:31 +1000 Subject: [PATCH 02/21] builds.ps1 - Major rewrite - Use $BuildArches "win-x86;win-x64;win-arm64" param to specify the desired platforms to package. Using win-x64 etc so if we ever add support for packaging linux/macosx then they can easily be added. Spaces, semi colons, colons, and commas should all work as delimiters. x86 x64 and arm64 without the win- prefix would also work. - Additionally reduce some duplication - Remove the nuspec template and go back to having a straight nuspec file as I have plans to refactor that package shortly. - When a download fails terminate with a clearer error message .\build.ps1 -CefVersion 95.7.8+g69b7dc3+chromium-95.0.4638.17 -BuildArches "win-x86,win-x64" .\build.ps1 -CefVersion 95.7.8+g69b7dc3+chromium-95.0.4638.17 -BuildArches "win-x86 win-x64 win-arm64" .\build.ps1 -CefVersion 95.7.8+g69b7dc3+chromium-95.0.4638.17 -BuildArches "win-x86;win-x64;win-arm64" --- NuGet/cef.sdk.props | 2 +- NuGet/chromiumembeddedframework.runtime.json | 6 +- ... chromiumembeddedframework.runtime.nuspec} | 8 +- build.ps1 | 1137 +++++++++-------- 4 files changed, 607 insertions(+), 546 deletions(-) rename NuGet/{chromiumembeddedframework.runtime.nuspec.template => chromiumembeddedframework.runtime.nuspec} (70%) diff --git a/NuGet/cef.sdk.props b/NuGet/cef.sdk.props index 9fdb304..795d807 100644 --- a/NuGet/cef.sdk.props +++ b/NuGet/cef.sdk.props @@ -1,6 +1,6 @@ - cef.sdk.94.0.5 + cef.sdk.95.7.8 diff --git a/NuGet/chromiumembeddedframework.runtime.json b/NuGet/chromiumembeddedframework.runtime.json index ad77618..7a3c4b5 100644 --- a/NuGet/chromiumembeddedframework.runtime.json +++ b/NuGet/chromiumembeddedframework.runtime.json @@ -2,17 +2,17 @@ "runtimes": { "win-x64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x64": "94.0.5" + "chromiumembeddedframework.runtime.win-x64": "95.7.8" } }, "win-x86": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x86": "94.0.5" + "chromiumembeddedframework.runtime.win-x86": "95.7.8" } }, "win-arm64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-arm64": "94.0.5" + "chromiumembeddedframework.runtime.win-arm64": "95.7.8" } }, } diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec.template b/NuGet/chromiumembeddedframework.runtime.nuspec similarity index 70% rename from NuGet/chromiumembeddedframework.runtime.nuspec.template rename to NuGet/chromiumembeddedframework.runtime.nuspec index 9859d06..9930179 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec.template +++ b/NuGet/chromiumembeddedframework.runtime.nuspec @@ -25,7 +25,13 @@ - META_REPLACE_DATA + + + + + + + diff --git a/build.ps1 b/build.ps1 index 4a832f4..345b851 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,7 +14,7 @@ param( [string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/", [Parameter(Position = 3)] - $CefVersion = "94.0.5+g506b164+chromium-94.0.4606.41", + $CefVersion = "95.7.8+g69b7dc3+chromium-95.0.4638.17", [ValidateSet("tar.bz2","zip","7z")] [Parameter(Position = 4)] @@ -27,20 +27,8 @@ param( [string] $Suffix, [Parameter(Position = 7)] - [string] $BuildArches = "x86 x64 amd64" + [string] $BuildArches = "win-x86;win-x64;win-arm64" ) -$ARCHES = $BuildArches.Split(" "); -$ARCHES_TO_BITKEY = @{}; -foreach ($arch in $ARCHES) { - $arch_bit = $arch; - if ($arch_bit.StartsWith("x")) { - $arch_bit = $arch.Substring(1); - if ($arch_bit -eq "86"){ - $arch_bit = "32"; - } - $ARCHES_TO_BITKEY[$arch] = $arch_bit; - } -} Set-StrictMode -version latest $ErrorActionPreference = "Stop"; @@ -57,672 +45,739 @@ Function WriteException($exp) throw $exp; } -try +function Write-Diagnostic { - $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition; - if ($CefVersion -eq "auto" -and $DownloadBinary -eq "local") - { - #Take the version from the local binary only, requires only one version in that folder to work - - $name = (dir -Filter cef_binary_*_windows$($ARCHES_TO_BITKEY[$ARCHES[0]]).$Extension $CefBinaryDir)[0].Name; - $CefVersion = ($name -replace "cef_binary_", "") -replace "_windows$($ARCHES_TO_BITKEY[$ARCHES[0]]).$Extension"; - } - $Cef = @{} - $Cefvcx = @{} - - $Cef[""] = Join-Path $WorkingDir 'cef' - $CefInclude = Join-Path $Cef[""] 'include' + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [string] $Message + ) + + Write-Host + Write-Host $Message -ForegroundColor Green + Write-Host +} - foreach ($arch in $ARCHES) { - $Cef[$arch] = Join-Path $WorkingDir "cef_binary_3.y.z_windows$($ARCHES_TO_BITKEY[$arch])"; - $Cefvcx[$arch] = Join-Path (Join-Path $Cef[$arch] 'libcef_dll_wrapper') 'libcef_dll_wrapper.vcxproj' +# https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1 +function Invoke-BatchFile +{ + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [string]$Path, + [Parameter(Position = 1, Mandatory = $true, ValueFromPipeline = $true)] + [string]$Parameters + ) + + $tempFile = [IO.Path]::GetTempFileName() + + # NOTE: A better solution would be to use PSCX's Push-EnvironmentBlock before calling + # this and popping it before calling this function again as repeated use of this function + # can (unsurprisingly) cause the PATH variable to max out at Windows upper limit. + $batFile = [IO.Path]::GetTempFileName() + '.cmd' + Set-Content -Path $batFile -Value "`"$Path`" $Parameters && set > `"$tempFile`"`r`n" + + & $batFile + + #Brace must be on same line for foreach-object to work + Get-Content $tempFile | Foreach-Object { + if ($_ -match "^(.*?)=(.*)$") + { + Set-Content "env:\$($matches[1])" $matches[2] + } } + Remove-Item $tempFile + Remove-Item $batFile +} - function Write-Diagnostic - { - param( - [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] - [string] $Message - ) - - Write-Host - Write-Host $Message -ForegroundColor Green - Write-Host - } +function Die +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Message + ) - # Set CefVersion based on tag name - must start with leading "v" e.g. v3.3163.1663.g416ffeb - if ($env:APPVEYOR_REPO_TAG -eq "True") - { - $CefVersion = "$env:APPVEYOR_REPO_TAG_NAME".Substring(1) # trim leading "v" - Write-Diagnostic "Setting version based on tag to $CefVersion" - } - - if($CefVersion.StartsWith('3.')) - { - # Take the cef version and strip the commit hash - $CefPackageVersion = $CefVersion.SubString(0, $CefVersion.LastIndexOf('.')) - } - else - { - # Take the cef version and strip the commit hash, chromium version - # we should end up with something like 73.1.12 - $CefPackageVersion = $CefVersion.SubString(0, $CefVersion.IndexOf('+')) - } - - if($Suffix) - { - $CefPackageVersion = $CefPackageVersion + '-' + $Suffix - } + Write-Host + Write-Error $Message + exit 1 - # https://github.com/jbake/Powershell_scripts/blob/master/Invoke-BatchFile.ps1 - function Invoke-BatchFile - { - param( - [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] - [string]$Path, - [Parameter(Position = 1, Mandatory = $true, ValueFromPipeline = $true)] - [string]$Parameters - ) +} - $tempFile = [IO.Path]::GetTempFileName() +function Warn +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Message + ) - # NOTE: A better solution would be to use PSCX's Push-EnvironmentBlock before calling - # this and popping it before calling this function again as repeated use of this function - # can (unsurprisingly) cause the PATH variable to max out at Windows upper limit. - $batFile = [IO.Path]::GetTempFileName() + '.cmd' - Set-Content -Path $batFile -Value "`"$Path`" $Parameters && set > `"$tempFile`"`r`n" + Write-Host + Write-Host $Message -ForegroundColor Yellow + Write-Host - & $batFile +} - #Brace must be on same line for foreach-object to work - Get-Content $tempFile | Foreach-Object { - if ($_ -match "^(.*?)=(.*)$") - { - Set-Content "env:\$($matches[1])" $matches[2] - } - } - Remove-Item $tempFile - Remove-Item $batFile - } +function TernaryReturn +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [bool] $Yes, + [Parameter(Position = 1, ValueFromPipeline = $true)] + $Value, + [Parameter(Position = 2, ValueFromPipeline = $true)] + $Value2 + ) - function Die + if ($Yes) { - param( - [Parameter(Position = 0, ValueFromPipeline = $true)] - [string] $Message - ) - - Write-Host - Write-Error $Message - exit 1 - + return $Value } - function Warn - { - param( - [Parameter(Position = 0, ValueFromPipeline = $true)] - [string] $Message - ) - - Write-Host - Write-Host $Message -ForegroundColor Yellow - Write-Host - - } + $Value2 +} - function TernaryReturn +function DownloadDependencies() +{ + $folder = Join-Path $env:LOCALAPPDATA .\nuget; + $Nuget = Join-Path $folder .\NuGet.exe + if (-not (Test-Path $Nuget)) { - param( - [Parameter(Position = 0, ValueFromPipeline = $true)] - [bool] $Yes, - [Parameter(Position = 1, ValueFromPipeline = $true)] - $Value, - [Parameter(Position = 2, ValueFromPipeline = $true)] - $Value2 - ) - - if ($Yes) + if (-not (Test-Path $folder)) { - return $Value + mkdir $folder } - - $Value2 - + + $Client = New-Object System.Net.WebClient; + $Client.DownloadFile('https://dist.nuget.org/win-x86-commandline/v5.11.0/nuget.exe', $Nuget); } - function Bootstrap - { - param() - - if ($Target -eq "nupkg-only") - { - return - } - - Write-Diagnostic "Bootstrapping" + $programFilesDir = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0] - if (Test-Path($Cef[""])) + $global:VSwherePath = Join-Path $programFilesDir 'Microsoft Visual Studio\Installer\vswhere.exe' + #Check if we already have vswhere which is included in newer versions of VS2019/VS2021 + if(-not (Test-Path $global:VSwherePath)) + { + Write-Diagnostic "Downloading VSWhere as no install found at $global:VSwherePath" + + # Check if we already have a local copy and download if required + $global:VSwherePath = Join-Path $WorkingDir \vswhere.exe + + # TODO: Check hash and download if hash differs + if(-not (Test-Path $global:VSwherePath)) { - Remove-Item $Cef[""] -Recurse | Out-Null + $client = New-Object System.Net.WebClient; + $client.DownloadFile('https://github.com/Microsoft/vswhere/releases/download/2.5.2/vswhere.exe', $global:VSwherePath); } + } +} - # Copy include files - Copy-Item "$($Cef[$ARCHES[0]])\include" $CefInclude -Recurse | Out-Null +function WriteVersionToRuntimeJson +{ + $Filename = Join-Path $WorkingDir NuGet\chromiumembeddedframework.runtime.json + + Write-Diagnostic "Write Version ($CefPackageVersion) to $Filename" + $Regex1 = '": ".*"'; + $Replace = '": "' + $CefPackageVersion + '"'; + + $RunTimeJsonData = Get-Content -Encoding UTF8 $Filename + $NewString = $RunTimeJsonData -replace $Regex1, $Replace + + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding) +} - # Create default directory structure - foreach ($arch in $ARCHES) { - if ($arch -eq "x86"){ - $arch = "win32"; - } - md "cef\$arch" | Out-Null - md "cef\$arch\debug" | Out-Null - md "cef\$arch\debug\VS2019" | Out-Null - md "cef\$arch\debug\VS2021" | Out-Null - md "cef\$arch\release" | Out-Null - md "cef\$arch\release\VS2019" | Out-Null - md "cef\$arch\release\VS2021" | Out-Null - } +function CheckDependencies() +{ + # Check for cmake + if ((Get-Command "cmake.exe" -ErrorAction SilentlyContinue) -eq $null) + { + Die "Unable to find cmake.exe in your PATH" } - function Msvs + # Check for 7zip + if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) { - param( - [ValidateSet('v142', 'v143')] - [Parameter(Position = 0, ValueFromPipeline = $true)] - [string] $Toolchain, - - [Parameter(Position = 1, ValueFromPipeline = $true)] - [ValidateSet('Debug', 'Release')] - [string] $Configuration, - - [Parameter(Position = 2, ValueFromPipeline = $true)] - [ValidateSet('x86', 'x64', 'arm64')] - [string] $Platform - ) - - Write-Diagnostic "Targeting $Toolchain using configuration $Configuration on platform $Platform" - - $VisualStudioVersion = $null - $VXXCommonTools = $null - $CmakeGenerator = $null + Die "$env:ProgramFiles\7-Zip\7z.exe is required" + } +} - $VS_VER = 16; - $VS_OFFICIAL_VER = 2019; - - if ($_ -eq 'v143') - { - $VS_VER=17; - $VS_OFFICIAL_VER=2021; - } - - $programFilesDir = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0] +function Bootstrap +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + $Platform + ) + + Write-Diagnostic ("Creating folders for " + $Platform.ArchLong) + + # Create default directory structure + $path = $Platform.Folder + # Copy include files and license.txt + Copy-Item $path\include $CefIncludeFolder -Recurse -Force | Out-Null + Copy-Item $path\License.txt $CefWorkingFolder -Force | Out-Null + + $arch = $Platform.NativeArch + + md "cef\$arch" | Out-Null + md "cef\$arch\debug" | Out-Null + md "cef\$arch\debug\VS2019" | Out-Null + md "cef\$arch\debug\VS2021" | Out-Null + md "cef\$arch\release" | Out-Null + md "cef\$arch\release\VS2019" | Out-Null + md "cef\$arch\release\VS2021" | Out-Null +} - $vswherePath = Join-Path $programFilesDir 'Microsoft Visual Studio\Installer\vswhere.exe' - #Check if we already have vswhere which is included in newer versions of VS2019/VS2021 - if(-not (Test-Path $vswherePath)) - { - Write-Diagnostic "Downloading VSWhere as no install found at $vswherePath" - - # Check if we already have a local copy and download if required - $vswherePath = Join-Path $WorkingDir \vswhere.exe +function Msvs +{ + param( + [ValidateSet('v142', 'v143')] + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Toolchain, + + [Parameter(Position = 1, ValueFromPipeline = $true)] + [ValidateSet('Debug', 'Release')] + [string] $Configuration, + + [Parameter(Position = 2, ValueFromPipeline = $true)] + [hashtable] $Platform + ) + + Write-Diagnostic "Targeting $Toolchain using configuration $Configuration on platform ($Platform.ArchLong)" + + $VisualStudioVersion = $null + $VXXCommonTools = $null + $CmakeGenerator = $null + $CefProject = [IO.Path]::Combine($Platform.Folder, 'libcef_dll_wrapper','libcef_dll_wrapper.vcxproj'); + $CefDir = $Platform.Folder + $Arch = $Platform.NativeArch + + $VS_VER = 16; + $VS_OFFICIAL_VER = 2019; - # TODO: Check hash and download if hash differs - if(-not (Test-Path $vswherePath)) - { - $client = New-Object System.Net.WebClient; - $client.DownloadFile('https://github.com/Microsoft/vswhere/releases/download/2.5.2/vswhere.exe', $vswherePath); - } - } + if ($_ -eq 'v143') + { + $VS_VER=17; + $VS_OFFICIAL_VER=2021; + } - Write-Diagnostic "VSWhere path $vswherePath" + Write-Diagnostic "VSWhere path $global:VSwherePath" - $versionSearchStr = "[$VS_VER.0," + ($VS_VER+1) + ".0)" - $VSInstallPath = & $vswherePath -version $versionSearchStr -property installationPath + $versionSearchStr = "[$VS_VER.0," + ($VS_VER+1) + ".0)" + $VSInstallPath = & $global:VSwherePath -version $versionSearchStr -property installationPath - Write-Diagnostic "$($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" + Write-Diagnostic "$($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" - if($VSInstallPath -eq $null -or !(Test-Path $VSInstallPath)) - { - Die "Visual Studio $VS_OFFICIAL_VER was not found" - } + if($VSInstallPath -eq $null -or !(Test-Path $VSInstallPath)) + { + Die "Visual Studio $VS_OFFICIAL_VER was not found" + } - $VisualStudioVersion = "$VS_VER.0" - $VXXCommonTools = Join-Path $VSInstallPath VC\Auxiliary\Build - $CmakeGenerator = "Visual Studio $VS_VER" + $VisualStudioVersion = "$VS_VER.0" + $VXXCommonTools = Join-Path $VSInstallPath VC\Auxiliary\Build + $CmakeGenerator = "Visual Studio $VS_VER" - if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools)))) - { - Die 'Error unable to find any visual studio environment' - } - - $CefProject = $Cefvcx[$Platform] - $CefDir = $Cef[$Platform] - $Arch = $Platform - if ($Arch -eq 'x86') - { - $Arch = "win32"; - } + if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools)))) + { + Die 'Error unable to find any visual studio environment' + } - $VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat - if (-not (Test-Path $VCVarsAll)) - { - Warn "Toolchain $Toolchain is not installed on your development machine, skipping $Configuration $Platform build." - Return - } + $VCVarsAll = Join-Path $VXXCommonTools vcvarsall.bat + if (-not (Test-Path $VCVarsAll)) + { + Warn "Toolchain $Toolchain is not installed on your development machine, skipping $Configuration $Arch build." + Return + } - $VCXProj = $Cefvcx[$Platform] - $VCVarsAllArch = $Platform - if ($VCVarsAllArch -eq "arm64"){ - $VCVarsAllArch = 'x64_arm64' - } + $VCVarsAllArch = $Platform.Arch + if ($VCVarsAllArch -eq "arm64") + { + $VCVarsAllArch = 'x64_arm64' + } - # Store the current environment variables so that we can reset them after running the build. - # This is because vcvarsall.bat appends e.g. to the PATH variable every time it is called, - # which can eventually lead to an error like "The input line is too long." when the PATH - # gets too long. - $PreviousEnvPath = $Env:Path - $PreviousEnvLib = $Env:Lib - $PreviousEnvLibPath = $Env:LibPath - $PreviousEnvInclude = $Env:Include - - try + # Store the current environment variables so that we can reset them after running the build. + # This is because vcvarsall.bat appends e.g. to the PATH variable every time it is called, + # which can eventually lead to an error like "The input line is too long." when the PATH + # gets too long. + $PreviousEnvPath = $Env:Path + $PreviousEnvLib = $Env:Lib + $PreviousEnvLibPath = $Env:LibPath + $PreviousEnvInclude = $Env:Include + + try + { + # Configure build environment + Invoke-BatchFile $VCVarsAll $VCVarsAllArch + Write-Diagnostic "pushd $CefDir" + pushd $CefDir + # Remove previously generated CMake data for the different platform/toolchain + rm CMakeCache.txt -ErrorAction:SilentlyContinue + rm -r CMakeFiles -ErrorAction:SilentlyContinue + $cmake_path = "cmake.exe"; + if ($env:ChocolateyInstall -And (Test-Path ($env:ChocolateyInstall + "\bin\" + $cmake_path))) { - # Configure build environment - Invoke-BatchFile $VCVarsAll $VCVarsAllArch - Write-Diagnostic "pushd $CefDir" - pushd $CefDir - # Remove previously generated CMake data for the different platform/toolchain - rm CMakeCache.txt -ErrorAction:SilentlyContinue - rm -r CMakeFiles -ErrorAction:SilentlyContinue - $cmake_path = "cmake.exe"; - if ($env:ChocolateyInstall -And (Test-Path ($env:ChocolateyInstall + "\bin\" + $cmake_path))) - { - $cmake_path = $env:ChocolateyInstall + "\bin\" + $cmake_path; - } - &"$cmake_path" --version - Write-Diagnostic "Running cmake: $cmake_path -Wno-dev -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ." - &"$cmake_path" -Wno-dev -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD . - popd - - $Arguments = @( - "$CefProject", - "/t:rebuild", - "/p:VisualStudioVersion=$VisualStudioVersion", - "/p:Configuration=$Configuration", - "/p:PlatformToolset=$Toolchain", - "/p:Platform=$Arch", - "/p:PreferredToolArchitecture=$Arch", - "/p:ConfigurationType=StaticLibrary" - ) - - $StartInfo = New-Object System.Diagnostics.ProcessStartInfo - $StartInfo.FileName = "msbuild.exe" - $StartInfo.Arguments = $Arguments - - $StartInfo.EnvironmentVariables.Clear() - - #Brace must be on same line for foreach-object to work - Get-ChildItem -Path env:* | ForEach-Object { - $StartInfo.EnvironmentVariables.Add($_.Name, $_.Value) - } + $cmake_path = $env:ChocolateyInstall + "\bin\" + $cmake_path; + } + &"$cmake_path" --version + Write-Diagnostic "Running cmake: $cmake_path -Wno-dev -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ." + &"$cmake_path" -Wno-dev -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD . + popd + + $Arguments = @( + "$CefProject", + "/t:rebuild", + "/p:VisualStudioVersion=$VisualStudioVersion", + "/p:Configuration=$Configuration", + "/p:PlatformToolset=$Toolchain", + "/p:Platform=$Arch", + "/p:PreferredToolArchitecture=$Arch", + "/p:ConfigurationType=StaticLibrary" + ) - $StartInfo.UseShellExecute = $false - $StartInfo.CreateNoWindow = $false - $StartInfo.RedirectStandardError = $true - $StartInfo.RedirectStandardOutput = $true + $StartInfo = New-Object System.Diagnostics.ProcessStartInfo + $StartInfo.FileName = "msbuild.exe" + $StartInfo.Arguments = $Arguments - $Process = New-Object System.Diagnostics.Process - $Process.StartInfo = $startInfo - $Process.Start() + $StartInfo.EnvironmentVariables.Clear() - $stdout = $Process.StandardOutput.ReadToEnd() - $stderr = $Process.StandardError.ReadToEnd() + #Brace must be on same line for foreach-object to work + Get-ChildItem -Path env:* | ForEach-Object { + $StartInfo.EnvironmentVariables.Add($_.Name, $_.Value) + } - $Process.WaitForExit() + $StartInfo.UseShellExecute = $false + $StartInfo.CreateNoWindow = $false + $StartInfo.RedirectStandardError = $true + $StartInfo.RedirectStandardOutput = $true - if ($Process.ExitCode -ne 0) - { - Write-Host "Ran msbuild.exe with args: $Arguments" - Write-Host "stdout: $stdout" - Write-Host "stderr: $stderr" - Die "Build failed" - } + $Process = New-Object System.Diagnostics.Process + $Process.StartInfo = $startInfo + $Process.Start() - CreateCefSdk $Toolchain $Configuration $Platform - } - finally + $stdout = $Process.StandardOutput.ReadToEnd() + $stderr = $Process.StandardError.ReadToEnd() + + $Process.WaitForExit() + + if ($Process.ExitCode -ne 0) { - # Reset the environment variables to their previous values. - $Env:Path = $PreviousEnvPath - $Env:Lib = $PreviousEnvLib - $Env:LibPath = $PreviousEnvLibPath - $Env:Include = $PreviousEnvInclude + Write-Host "Ran msbuild.exe with args: $Arguments" + Write-Host "stdout: $stdout" + Write-Host "stderr: $stderr" + Die "Build failed" } - } - function VSX + CreateCefSdk $Toolchain $Configuration $Platform + } + finally { - param( - [ValidateSet('v142', 'v143')] - [Parameter(Position = 0, ValueFromPipeline = $true)] - [string] $Toolchain - ) + # Reset the environment variables to their previous values. + $Env:Path = $PreviousEnvPath + $Env:Lib = $PreviousEnvLib + $Env:LibPath = $PreviousEnvLibPath + $Env:Include = $PreviousEnvInclude + } +} - Write-Diagnostic "Starting to build targeting toolchain $Toolchain" +function VSX +{ + param( + [ValidateSet('v142', 'v143')] + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $toolchain, - foreach ($arch in $ARCHES) { + [Parameter(Position = 1, ValueFromPipeline = $true)] + [hashtable] $Platform + ) - if (! $NoDebugBuild) - { - Msvs "$Toolchain" 'Debug' "$arch" - } - Msvs "$Toolchain" 'Release' "$arch" - } + Write-Diagnostic "Starting to build targeting toolchain $Toolchain" - Write-Diagnostic "Finished build targeting toolchain $Toolchain" + if (! $NoDebugBuild) + { + Msvs "$toolchain" 'Debug' $Platform } + Msvs "$toolchain" 'Release' $Platform - function CreateCefSdk - { - param( - [ValidateSet('v142', 'v143')] - [Parameter(Position = 0, ValueFromPipeline = $true)] - [string] $Toolchain, + Write-Diagnostic "Finished build targeting toolchain $toolchain" +} - [Parameter(Position = 1, ValueFromPipeline = $true)] - [ValidateSet('Debug', 'Release')] - [string] $Configuration, +function CreateCefSdk +{ + param( + [ValidateSet('v142', 'v143')] + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $Toolchain, - [Parameter(Position = 2, ValueFromPipeline = $true)] - [ValidateSet('x86', 'x64', 'arm64')] - [string] $Platform - ) + [Parameter(Position = 1, ValueFromPipeline = $true)] + [ValidateSet('Debug', 'Release')] + [string] $Configuration, - Write-Diagnostic "Creating sdk for $Toolchain" + [Parameter(Position = 2, ValueFromPipeline = $true)] + [hashtable] $Platform + ) - $VisualStudioVersion = "VS2019" + Write-Diagnostic "Creating sdk for $Toolchain" + + $VisualStudioVersion = "VS2019" - if($Toolchain -eq "v143") - { - $VisualStudioVersion = "VS2021" - } + if($Toolchain -eq "v143") + { + $VisualStudioVersion = "VS2021" + } - $CefDir = $Cef[$Platform] - $Arch = $Platform - if ($Arch -eq 'x86') - { - $Arch = "win32"; - } + $CefArchDir = $Platform.Folder + $Arch = $Platform.NativeArch; - # cef_binary_3.y.z_windows32\out\debug\lib -> cef\win32\debug\vs2019 - Copy-Item $CefDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.lib "$($Cef[''])\$Arch\$Configuration\$VisualStudioVersion" | Out-Null - Copy-Item $CefDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.pdb "$($Cef[''])\$Arch\$Configuration\$VisualStudioVersion" | Out-Null + # cef_binary_3.y.z_windows32\out\debug\lib -> cef\win32\debug\vs2019 + Copy-Item $CefArchDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.lib $CefWorkingFolder\$Arch\$Configuration\$VisualStudioVersion | Out-Null + Copy-Item $CefArchDir\libcef_dll_wrapper\$Configuration\libcef_dll_wrapper.pdb $CefWorkingFolder\$Arch\$Configuration\$VisualStudioVersion | Out-Null - # cef_binary_3.y.z_windows32\debug -> cef\win32\debug - Copy-Item $CefDir\$Configuration\libcef.lib "$($Cef[''])\$Arch\$Configuration" | Out-Null - } + # cef_binary_3.y.z_windows32\debug -> cef\win32\debug + Copy-Item $CefArchDir\$Configuration\libcef.lib $CefWorkingFolder\$Arch\$Configuration | Out-Null +} - function Nupkg +function Nupkg +{ + Write-Diagnostic "Building nuget package" + + $Nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe + if (-not (Test-Path $Nuget)) { - Write-Diagnostic "Building nuget package" + Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget" + } - $Nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe - if (-not (Test-Path $Nuget)) + foreach ($platform in $Platforms.Values) + { + if(!$platform.Enabled) { - Die "Please install nuget. More information available at: http://docs.nuget.org/docs/start-here/installing-nuget" + continue } - $meta_template = ""; - foreach ($arch in $ARCHES) { - # Build packages - if ($arch -ne "arm64"){ - . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=windows$($ARCHES_TO_BITKEY[$arch]);" -OutputDirectory nuget - } - . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=windows$($ARCHES_TO_BITKEY[$arch]);" -OutputDirectory nuget - $meta_template += "`n `n"; - } - - $meta_template += ""; - $meta_spec_file = "nuget\chromiumembeddedframework.runtime.nuspec"; - $content = Get-Content "$($meta_spec_file).template"; - $content = $content -replace "META_REPLACE_DATA", $meta_template; - $content | Out-File -FilePath $meta_spec_file; - # Meta Package - . $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget + $arch = $platform.Arch + $archLong = $platform.ArchLong - # Build sdk - $Filename = Resolve-Path ".\nuget\cef.sdk.props" - $Text = (Get-Content $Filename) -replace '.*<\/CefSdkVer>', "cef.sdk.$CefPackageVersion" - [System.IO.File]::WriteAllLines($Filename, $Text) - - . $Nuget pack nuget\cef.sdk.nuspec -NoPackageAnalysis -Version $CefPackageVersion -OutputDirectory nuget - - if ($env:APPVEYOR_REPO_TAG -eq "True") + # Build packages + if ($arch -ne "arm64") { - foreach ($arch in $ARCHES) { - if ($arch -ne "arm64"){ - appveyor PushArtifact "nuget\cef.redist.$($arch).$CefPackageVersion.nupkg" - } - appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.win-$($arch).$CefPackageVersion.nupkg" - } - - appveyor PushArtifact "nuget\chromiumembeddedframework.runtime.$CefPackageVersion.nupkg" - appveyor PushArtifact "nuget\cef.sdk.$CefPackageVersion.nupkg" + . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=$archLong;" -OutputDirectory nuget } + + . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=$archLong;" -OutputDirectory nuget } + + # Meta Package + . $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget + + # Build sdk + $Filename = Resolve-Path ".\nuget\cef.sdk.props" + $Text = (Get-Content $Filename) -replace '.*<\/CefSdkVer>', "cef.sdk.$CefPackageVersion" + [System.IO.File]::WriteAllLines($Filename, $Text) - function DownloadNuget() + . $Nuget pack nuget\cef.sdk.nuspec -NoPackageAnalysis -Version $CefPackageVersion -OutputDirectory nuget + + if ($env:APPVEYOR_REPO_TAG -eq "True") { - $folder = Join-Path $env:LOCALAPPDATA .\nuget; - $Nuget = Join-Path $folder .\NuGet.exe - if (-not (Test-Path $Nuget)) - { - if (-not (Test-Path $folder)) - { - mkdir $folder - } - - $Client = New-Object System.Net.WebClient; - $Client.DownloadFile('https://dist.nuget.org/win-x86-commandline/v5.11.0/nuget.exe', $Nuget); + Get-ChildItem -Path .\Nuget -Filter *.nupkg -File -Name| ForEach-Object { + appveyor PushArtifact $_ } } +} - function DownloadCefBinaryAndUnzip() - { - $Client = New-Object System.Net.WebClient; +function ExtractArchive() +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [string] $ArchivePath, + [Parameter(Position = 1, ValueFromPipeline = $true)] + [string] $CefFileName, + [Parameter(Position = 2, ValueFromPipeline = $true)] + [string] $OutputFolder + ) - $CefBuildServerUrl = "https://cef-builds.spotifycdn.com/" - $CefBuildServerJsonPackageList = $CefBuildServerUrl + "index.json" + set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" - $CefBuildsJson = Invoke-WebRequest -UseBasicParsing -Uri $CefBuildServerJsonPackageList | ConvertFrom-Json - $cef_version_comp = $false + # Extract bzip file + sz x $ArchivePath; + if ($Extension -eq "tar.bz2") + { + # Extract tar file + $TarFile = ($ArchivePath).Substring(0, $ArchivePath.length - 4) + sz x $TarFile - set-alias sz "$env:ProgramFiles\7-Zip\7z.exe" - foreach ($arch in $ARCHES) { - $CefWinCefVersion = $CefBuildsJson["windows$ARCHES_TO_BITKEY[$arch]"].versions | Where-Object {$_.cef_version -eq $CefVersion} - if (! $cef_version_comp){ - $cef_version_comp = $CefWinCefVersion.cef_version; - } - if ($cef_version_comp -ne $CefWinCefVersion.cef_version){ - Die "All versions of CEF must be the same but $arch is: $($CefWinCefVersion.cef_version) vs previous arch's of: $cef_version_comp"; - } + # Sleep for a short period to allow 7z to release it's file handles + Start-Sleep -m 2000 - $CefFileName = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).name - $CefFileHash = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 - $CefFileSize = (($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) + # Remove tar file + Remove-Item $TarFile + } - $LocalFile = Join-Path $WorkingDir $CefFileName - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Downloading $CefFileName; this will take a while as the file is $CefFileSize MB." - $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefFileName), $LocalFile); - - $CefLocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash - - Write-Diagnostic "Download $CefFileName complete" - Write-Diagnostic "Expected SHA1 for $CefFileName $CefFileHash" - Write-Diagnostic "Actual SHA1 for $CefFileName $CefLocalFileHash" - - if($CefLocalFileHash -ne $CefFileHash) - { - Die "SHA1 hash did not match" - } - } + $Folder = Join-Path $WorkingDir ($CefFileName.Substring(0, $CefFileName.length - ($Extension.Length+1))) + Move-Item ($Folder + '\*') $OutputFolder -force + Remove-Item $Folder +} - if (-not (Test-Path (Join-Path $Cef[""] '\include\cef_version.h'))) - { - # Extract bzip file - sz e $LocalFile +function DownloadCefBinaryAndUnzip() +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [hashtable] $Platform + ) - # Extract tar file - $TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4) - sz x $TarFile + $CefBuildServerUrl = "https://cef-builds.spotifycdn.com/" - # Sleep for a short period to allow 7z to release it's file handles - sleep -m 2000 + if($global:CefBuildsJson -eq $null) + { + $CefBuildServerJsonPackageList = $CefBuildServerUrl + "index.json" - # Remove tar file - Remove-Item $TarFile + $global:CefBuildsJson = Invoke-WebRequest -UseBasicParsing -Uri $CefBuildServerJsonPackageList | ConvertFrom-Json + } + + $arch = $Platform.ArchLong - $Folder = Join-Path $WorkingDir ($CefFileName.Substring(0, $CefFileName.length - 8)) - Move-Item ($Folder + '\*') $Cef[$arch] -force - Remove-Item $Folder - } - } + $CefWinCefVersion = $global:CefBuildsJson.($arch).versions | Where-Object {$_.cef_version -eq $CefVersion} + if($CefWinCefVersion -eq $null) + { + Die "Build Unavailable - $arch has no files for version $CefVersion" } - function CopyFromLocalCefBuild() + #TODO Duplication + $CefFileName = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).name + $CefFileHash = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 + $CefFileSize = (($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) + + $LocalFile = Join-Path $WorkingDir $CefFileName + if (-not (Test-Path $LocalFile)) { - # 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 + $Client = New-Object System.Net.WebClient; - Write-Host $CefVersion + Write-Diagnostic "Downloading $CefFileName; this will take a while as the file is $CefFileSize MB." + $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefFileName), $LocalFile); - foreach ($arch in $ARCHES) { - $CefFileName = "cef_binary_$($CefVersion)_windows$($ARCHES_TO_BITKEY[$arch])." + $Extension; - 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 $CefFileName + if (-not (Test-Path $LocalFile)) + { + Die "Downloading $CefFileName failed" + } + + $CefLocalFileHash = (Get-FileHash -Path $LocalFile -Algorithm SHA1).Hash + + Write-Diagnostic "Download $CefFileName complete" + Write-Diagnostic "Expected SHA1 for $CefFileName $CefFileHash" + Write-Diagnostic "Actual SHA1 for $CefFileName $CefLocalFileHash" + + if($CefLocalFileHash -ne $CefFileHash) + { + Die "SHA1 hash did not match" + } + } - if (-not (Test-Path $LocalFile)) - { - Write-Diagnostic "Copy $CefFileName (approx 200mb)" - Copy-Item ($CefBuildDir+$CefFileName) $LocalFile - Write-Diagnostic "Copy of $CefFileName complete" - } + if (-not (Test-Path (Join-Path $Platform.Folder '\include\cef_version.h'))) + { + ExtractArchive $LocalFile $CefFileName $Platform.Folder + } +} - if (-not (Test-Path (Join-Path $Cef[$arch] '\include\cef_version.h'))) - { - # Extract bzip file - sz x $LocalFile; +function CopyFromLocalCefBuild() +{ + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [hashtable] $Platform + ) - if ($Extension -eq "tar.bz2") - { - # Extract tar file - $TarFile = ($LocalFile).Substring(0, $LocalFile.length - 4) - sz x $TarFile + # 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 - # Sleep for a short period to allow 7z to release it's file handles - sleep -m 2000 + $archLong = $Platform.ArchLong - # Remove tar file - Remove-Item $TarFile - } + $CefFileName = "cef_binary_$($CefVersion)_$archLong." + $Extension; - $Folder = Join-Path $WorkingDir ($CefFileName.Substring(0, $CefFileName.length - ($Extension.Length+1))) - Move-Item ($Folder + '\*') $Cef[$arch] -force - Remove-Item $Folder - } - } + $LocalFile = Join-Path $WorkingDir $CefFileName + if (-not (Test-Path $LocalFile)) + { + Write-Diagnostic "Copy $CefFileName (approx 200mb)" + Copy-Item ($CefBinaryDir+$CefFileName) $LocalFile + Write-Diagnostic "Copy of $CefFileName complete" } - - function WriteVersionToRuntimeJson + + if (-not (Test-Path (Join-Path $Platform.Folder '\include\cef_version.h'))) { - $Filename = Join-Path $WorkingDir NuGet\chromiumembeddedframework.runtime.json - - Write-Diagnostic "Write Version ($CefPackageVersion) to $Filename" - $Regex1 = '": ".*"'; - $Replace = '": "' + $CefPackageVersion + '"'; + ExtractArchive $LocalFile $CefFileName $Platform.Folder + } +} + +try +{ + $global:CefBuildsJson = $null + $VSwherePath = $null + $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition; + + Write-Diagnostic "pushd $WorkingDir" + Push-Location $WorkingDir + + $CefWorkingFolder = Join-Path $WorkingDir 'cef' + $CefIncludeFolder = Join-Path $CefWorkingFolder 'include' + + $Platforms = @{ + 'win-x86'=@{ + Enabled=($BuildArches.Contains('win-x86') -or $BuildArches.Contains('x86')); + NativeArch='win32'; + Arch='x86'; + ArchLong='windows32'; + Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windows32'; + }; - $RunTimeJsonData = Get-Content -Encoding UTF8 $Filename - $NewString = $RunTimeJsonData -replace $Regex1, $Replace + 'win-x64'=@{ + Enabled=$BuildArches.Contains('win-x64') -or $BuildArches.Contains('x64'); + NativeArch='x64'; + Arch='x64'; + ArchLong='windows64'; + Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windows64'; + }; - $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False - [System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding) + 'win-arm64'=@{ + Enabled=($BuildArches.Contains('win-arm64') -or $BuildArches.Contains('arm64')); + NativeArch='arm64'; + Arch='arm64'; + ArchLong='windowsarm64'; + Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windowsarm64'; + }; } - function CheckDependencies() + if($DownloadBinary -eq "local") { - # Check for cmake - if ((Get-Command "cmake.exe" -ErrorAction SilentlyContinue) -eq $null) + if ([System.IO.Path]::IsPathRooted($CefBinaryDir)) { - Die "Unable to find cmake.exe in your PATH" + $CefBinaryDir = $CefBinaryDir } - - # Check for 7zip - if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) + else { - Die "$env:ProgramFiles\7-Zip\7z.exe is required" + $CefBinaryDir = [System.IO.Path]::GetFullPath((Join-Path $WorkingDir "$CefBinaryDir/")) } + + if ($CefVersion -eq "auto") + { + $enabledPlatform = $Platforms.GetEnumerator() | Where-Object { + $_.Value.Enabled -eq $true + } + + $enabledPlatformFileExtension = $enabledPlatform[0].Value.ArchLong + '.' + $Extension + + #Take the version from the local binary only + $name = (Get-ChildItem -Filter cef_binary_*_$enabledPlatformFileExtension $CefBinaryDir)[0].Name; + $CefVersion = ($name -replace "cef_binary_", "") -replace "_$enabledPlatformFileExtension"; + } + } + + # Set CefVersion based on tag name - must start with leading "v" e.g. v3.3163.1663.g416ffeb + if ($env:APPVEYOR_REPO_TAG -eq "True") + { + $CefVersion = "$env:APPVEYOR_REPO_TAG_NAME".Substring(1) # trim leading "v" + Write-Diagnostic "Setting version based on tag to $CefVersion" + } + + # Take the cef version and strip the commit hash, chromium version + # we should end up with something like 73.1.12 + $CefPackageVersion = $CefVersion.SubString(0, $CefVersion.IndexOf('+')) + + if($Suffix) + { + $CefPackageVersion = $CefPackageVersion + '-' + $Suffix } CheckDependencies + DownloadDependencies WriteVersionToRuntimeJson - switch -Exact ($DownloadBinary) + Write-Diagnostic("CEF Version: $CefVersion") + Write-Diagnostic("Enabled Architectures") + + foreach($platform in $Platforms.Values) { - "none" + if($platform.Enabled) { + Write-Diagnostic("Arch: " + $platform.ArchLong) } - "download" - { - DownloadCefBinaryAndUnzip - } - "local" - { - CopyFromLocalCefBuild - } } - DownloadNuget + if($Target -eq "nupkg-only") + { + Nupkg + return; + } + + Write-Diagnostic ("Deleting working folder $CefWorkingFolder") - Bootstrap + if (Test-Path($CefWorkingFolder)) + { + Remove-Item $CefWorkingFolder -Recurse | Out-Null + } - switch -Exact ($Target) + foreach ($platform in $Platforms.Values) { - "nupkg" + if(!$platform.Enabled) { - VSX v142 - Nupkg + continue } - "nupkg-only" + + switch -Exact ($DownloadBinary) { - Nupkg + "none" + { + } + "download" + { + DownloadCefBinaryAndUnzip $platform + } + "local" + { + CopyFromLocalCefBuild $platform + } } - "vs2021" + + Bootstrap $platform + } + + # Loop through twice so the files have been downloaded + # extracted and validated before we attempt to build + # makes sure we have all platforms + foreach ($platform in $Platforms.Values) + { + # Create the folders for any that don't exist so the nuget packages are created with empty folders + # This can be removed once the new chromiumembeddedframework.runtime.resource package is created + [System.IO.Directory]::CreateDirectory([IO.Path]::Combine($platform.Folder, 'Resources','locales')) + [System.IO.Directory]::CreateDirectory([IO.Path]::Combine($platform.Folder, 'Release','swiftshader')) + + if(!$platform.Enabled) { - VSX v143 + continue } - "vs2019" + + switch -Exact ($Target) { - VSX v142 + "nupkg" + { + VSX v142 $platform + } + "vs2021" + { + VSX v143 $platform + } + "vs2019" + { + VSX v142 $platform + } } } + + if($Target -eq "nupkg") + { + Nupkg + } } catch { WriteException $_; } +finally +{ + Pop-Location +} From fb51eeb87be6632b5a2a87e397653447aee56ae9 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Tue, 12 Oct 2021 19:45:20 +1000 Subject: [PATCH 03/21] build.ps1 - Fix formatting --- build.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index 345b851..be64de3 100644 --- a/build.ps1 +++ b/build.ps1 @@ -608,7 +608,7 @@ try { $global:CefBuildsJson = $null $VSwherePath = $null - $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition; + $WorkingDir = split-path -parent $MyInvocation.MyCommand.Definition; Write-Diagnostic "pushd $WorkingDir" Push-Location $WorkingDir @@ -621,7 +621,7 @@ try Enabled=($BuildArches.Contains('win-x86') -or $BuildArches.Contains('x86')); NativeArch='win32'; Arch='x86'; - ArchLong='windows32'; + ArchLong='windows32'; Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windows32'; }; @@ -629,7 +629,7 @@ try Enabled=$BuildArches.Contains('win-x64') -or $BuildArches.Contains('x64'); NativeArch='x64'; Arch='x64'; - ArchLong='windows64'; + ArchLong='windows64'; Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windows64'; }; @@ -637,7 +637,7 @@ try Enabled=($BuildArches.Contains('win-arm64') -or $BuildArches.Contains('arm64')); NativeArch='arm64'; Arch='arm64'; - ArchLong='windowsarm64'; + ArchLong='windowsarm64'; Folder=Join-Path $WorkingDir 'cef_binary_3.y.z_windowsarm64'; }; } @@ -698,7 +698,7 @@ try } } - if($Target -eq "nupkg-only") + if($Target -eq "nupkg-only") { Nupkg return; @@ -733,7 +733,7 @@ try } } - Bootstrap $platform + Bootstrap $platform } # Loop through twice so the files have been downloaded From bc45e5d0d5eb7655e481870bf92cd95117bcb701 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Thu, 14 Oct 2021 13:20:56 +1000 Subject: [PATCH 04/21] build.ps1 - Hopefully fix appveyor pushartifact --- build.ps1 | 63 +++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/build.ps1 b/build.ps1 index be64de3..5e66a14 100644 --- a/build.ps1 +++ b/build.ps1 @@ -114,25 +114,6 @@ function Warn } -function TernaryReturn -{ - param( - [Parameter(Position = 0, ValueFromPipeline = $true)] - [bool] $Yes, - [Parameter(Position = 1, ValueFromPipeline = $true)] - $Value, - [Parameter(Position = 2, ValueFromPipeline = $true)] - $Value2 - ) - - if ($Yes) - { - return $Value - } - - $Value2 -} - function DownloadDependencies() { $folder = Join-Path $env:LOCALAPPDATA .\nuget; @@ -148,9 +129,13 @@ function DownloadDependencies() $Client.DownloadFile('https://dist.nuget.org/win-x86-commandline/v5.11.0/nuget.exe', $Nuget); } - $programFilesDir = (${env:ProgramFiles(x86)}, ${env:ProgramFiles} -ne $null)[0] + $global:VSWherePath = Join-Path ${env:ProgramFiles} 'Microsoft Visual Studio\Installer\vswhere.exe' + + if(-not (Test-Path $global:VSWherePath)) + { + $global:VSWherePath = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' + } - $global:VSwherePath = Join-Path $programFilesDir 'Microsoft Visual Studio\Installer\vswhere.exe' #Check if we already have vswhere which is included in newer versions of VS2019/VS2021 if(-not (Test-Path $global:VSwherePath)) { @@ -186,7 +171,7 @@ function WriteVersionToRuntimeJson function CheckDependencies() { # Check for cmake - if ((Get-Command "cmake.exe" -ErrorAction SilentlyContinue) -eq $null) + if ($null -eq (Get-Command "cmake.exe" -ErrorAction SilentlyContinue)) { Die "Unable to find cmake.exe in your PATH" } @@ -215,13 +200,13 @@ function Bootstrap $arch = $Platform.NativeArch - md "cef\$arch" | Out-Null - md "cef\$arch\debug" | Out-Null - md "cef\$arch\debug\VS2019" | Out-Null - md "cef\$arch\debug\VS2021" | Out-Null - md "cef\$arch\release" | Out-Null - md "cef\$arch\release\VS2019" | Out-Null - md "cef\$arch\release\VS2021" | Out-Null + mkdir "cef\$arch" | Out-Null + mkdir "cef\$arch\debug" | Out-Null + mkdir "cef\$arch\debug\VS2019" | Out-Null + mkdir "cef\$arch\debug\VS2021" | Out-Null + mkdir "cef\$arch\release" | Out-Null + mkdir "cef\$arch\release\VS2019" | Out-Null + mkdir "cef\$arch\release\VS2021" | Out-Null } function Msvs @@ -264,7 +249,7 @@ function Msvs Write-Diagnostic "$($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" - if($VSInstallPath -eq $null -or !(Test-Path $VSInstallPath)) + if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) { Die "Visual Studio $VS_OFFICIAL_VER was not found" } @@ -273,7 +258,7 @@ function Msvs $VXXCommonTools = Join-Path $VSInstallPath VC\Auxiliary\Build $CmakeGenerator = "Visual Studio $VS_VER" - if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools)))) + if ($null -eq $VXXCommonTools -or (-not (Test-Path($VXXCommonTools)))) { Die 'Error unable to find any visual studio environment' } @@ -305,10 +290,10 @@ function Msvs # Configure build environment Invoke-BatchFile $VCVarsAll $VCVarsAllArch Write-Diagnostic "pushd $CefDir" - pushd $CefDir + Push-Location $CefDir # Remove previously generated CMake data for the different platform/toolchain - rm CMakeCache.txt -ErrorAction:SilentlyContinue - rm -r CMakeFiles -ErrorAction:SilentlyContinue + Remove-Item CMakeCache.txt -ErrorAction:SilentlyContinue + Remove-Item -r CMakeFiles -ErrorAction:SilentlyContinue $cmake_path = "cmake.exe"; if ($env:ChocolateyInstall -And (Test-Path ($env:ChocolateyInstall + "\bin\" + $cmake_path))) { @@ -317,7 +302,7 @@ function Msvs &"$cmake_path" --version Write-Diagnostic "Running cmake: $cmake_path -Wno-dev -LAH -G '$CmakeGenerator' -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD ." &"$cmake_path" -Wno-dev -LAH -G "$CmakeGenerator" -A $Arch -DUSE_SANDBOX=Off -DCEF_RUNTIME_LIBRARY_FLAG=/MD . - popd + Pop-Location $Arguments = @( "$CefProject", @@ -474,8 +459,8 @@ function Nupkg if ($env:APPVEYOR_REPO_TAG -eq "True") { Get-ChildItem -Path .\Nuget -Filter *.nupkg -File -Name| ForEach-Object { - appveyor PushArtifact $_ - } + appveyor PushArtifact $_.FullName + } | Out-Null } } @@ -522,7 +507,7 @@ function DownloadCefBinaryAndUnzip() $CefBuildServerUrl = "https://cef-builds.spotifycdn.com/" - if($global:CefBuildsJson -eq $null) + if($null -eq $global:CefBuildsJson) { $CefBuildServerJsonPackageList = $CefBuildServerUrl + "index.json" @@ -533,7 +518,7 @@ function DownloadCefBinaryAndUnzip() $CefWinCefVersion = $global:CefBuildsJson.($arch).versions | Where-Object {$_.cef_version -eq $CefVersion} - if($CefWinCefVersion -eq $null) + if($null -eq $CefWinCefVersion) { Die "Build Unavailable - $arch has no files for version $CefVersion" } From dfe3745e76adf07e14baabdd4c379258fdf488b0 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Thu, 14 Oct 2021 13:20:56 +1000 Subject: [PATCH 05/21] build.ps1 - appveyor push get full path --- build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 5e66a14..1252036 100644 --- a/build.ps1 +++ b/build.ps1 @@ -458,7 +458,7 @@ function Nupkg if ($env:APPVEYOR_REPO_TAG -eq "True") { - Get-ChildItem -Path .\Nuget -Filter *.nupkg -File -Name| ForEach-Object { + Get-ChildItem -Path .\Nuget -Filter *.nupkg -File | ForEach-Object { appveyor PushArtifact $_.FullName } | Out-Null } From 51c031c9b639fd51d2ec901386d1099267d1908d Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Fri, 22 Oct 2021 15:25:24 +1000 Subject: [PATCH 06/21] build.ps1 - Change to VS2022 (was previously VS2021) --- build.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.ps1 b/build.ps1 index 1252036..b429cb4 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,7 @@ #requires -Version 5 param( - [ValidateSet("vs2019", "vs2021", "nupkg", "nupkg-only")] + [ValidateSet("vs2019", "vs2022", "nupkg", "nupkg-only")] [Parameter(Position = 0)] [string] $Target = "nupkg", @@ -136,7 +136,7 @@ function DownloadDependencies() $global:VSWherePath = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe' } - #Check if we already have vswhere which is included in newer versions of VS2019/VS2021 + #Check if we already have vswhere which is included in newer versions of VS2019/VS2022 if(-not (Test-Path $global:VSwherePath)) { Write-Diagnostic "Downloading VSWhere as no install found at $global:VSwherePath" @@ -203,10 +203,10 @@ function Bootstrap mkdir "cef\$arch" | Out-Null mkdir "cef\$arch\debug" | Out-Null mkdir "cef\$arch\debug\VS2019" | Out-Null - mkdir "cef\$arch\debug\VS2021" | Out-Null + mkdir "cef\$arch\debug\VS2022" | Out-Null mkdir "cef\$arch\release" | Out-Null mkdir "cef\$arch\release\VS2019" | Out-Null - mkdir "cef\$arch\release\VS2021" | Out-Null + mkdir "cef\$arch\release\VS2022" | Out-Null } function Msvs @@ -403,7 +403,7 @@ function CreateCefSdk if($Toolchain -eq "v143") { - $VisualStudioVersion = "VS2021" + $VisualStudioVersion = "VS2022" } $CefArchDir = $Platform.Folder @@ -742,7 +742,7 @@ try { VSX v142 $platform } - "vs2021" + "vs2022" { VSX v143 $platform } From e332392d0c47f671ec07e92c0948d07a8abc8b70 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Fri, 22 Oct 2021 15:25:47 +1000 Subject: [PATCH 07/21] README.md - Update and simplify --- README.md | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 4108aa2..5dd300c 100644 --- a/README.md +++ b/README.md @@ -2,43 +2,19 @@ # README -This is a repackaging fork of the Chromium Embedded Framework (CEF) binary distribution files for Windows, found at https://cef-builds.spotifycdn.com/index.html, into [these NuGet packages](https://www.nuget.org/packages?q=Id%3A%22cef.redist%22%2C%22cef.sdk%22) +This repository contains a build script that compiles and packages the Chromium Embedded Framework (CEF) binary distribution files for Windows, found at https://cef-builds.spotifycdn.com/index.html -To make it work properly for developers on VS2013 or VS2015 wanting to develop [CefSharp](http://github.com/cefsharp/CefSharp), we need to do some local modifications ([use dynamic linking](https://bitbucket.org/chromiumembedded/cef/wiki/LinkingDifferentRunTimeLibraries)) to make CefSharp.Core compile properly. This purpose of this repository is to track and maintain these modifications as well as tooling for maintaining the NuGet packages. +To make it work properly for developers on VS2019 or VS2022 wanting to develop [CefSharp](http://github.com/cefsharp/CefSharp), we need to compile `libcef_dll_wrapper` for ([dynamic linking](https://bitbucket.org/chromiumembedded/cef/wiki/LinkingDifferentRunTimeLibraries)). The modifications allow us to: -- Re-package and distribute CEF `.dll` and `.pak` files in a piecemeal fashion using http://nuget.org (this is useful for both [Xilium.CefGlue](https://bitbucket.org/xilium/xilium.cefglue) and CefSharp developers and users alike) +- Re-package and distribute CEF `.dll` and `.pak` files in a piecemeal fashion using http://nuget.org (this is useful for both [Xilium.CefGlue](https://gitlab.com/xiliumhq/chromiumembedded/cefglue) and CefSharp developers and users alike) - Build `libcef_dll_wrapper.lib`s as mentioned above for [CefSharp](http://github.com/cefsharp/CefSharp) -- Have a place to pick CEF `include` files for easy inclusion downstream (by `git submodule` vendor folders etc.) - -The original README for CEF can be found here: [README.txt](README.txt). It has some useful details about which CEF pieces are needed for what (e.g. browser developer tools, language support, different HTML5 features, WebGL support etc.) - -# Architecture - -Note to self: Add a diagram here based on: http://codepen.io/jornh/full/Iyebk explaining that this is the red layer with the native code from the upstream CEF (and Chromium projects) - -TODO: Explain each of the red pieces along the lines of this rough plan (subject to change): -Foundation z: NuGets - -- C.F.Base.x64|Win32 ... (~ Bcl. Xxx ) .... -- C.Foundation.Res.Lang -- C.Foundation.Res.Dev - -- C.Foundation.WebGL (incl d*dxxxx43|46) -- C.F.MDwrapper - - ## Easy - -- C.F.Bundle.x64(NoLang) -- C.F.Bundle.Win32 - -- CS.Core -- CS.Wpf +The CEF Readme.txt file is now included as part of the Nuget packages. # License -The code is licensed under the same license as the Chromium Embeddded Framework, i.e. the "new BSD" license. The full CEF license text can be found here: [LICENSE.txt](LICENSE.txt). +The code is licensed under the same license as the Chromium Embeddded Framework, i.e. the "new BSD" license. The full CEF license text can be found here: [LICENSE.txt](https://bitbucket.org/chromiumembedded/cef/src/master/LICENSE.txt). Additionally, don't forget to view `chrome://credits/` for additional licences used by Chromium. From 0dd29533e4b65ef38b5707afd610ace53cab4feb Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Tue, 24 May 2022 14:23:56 +1000 Subject: [PATCH 08/21] Remove legacy swiftshader Issue https://github.com/cefsharp/CefSharp/issues/4085 --- NuGet/cef.redist.nuspec | 1 - NuGet/chromiumembeddedframework.runtime.nuspec | 3 --- NuGet/chromiumembeddedframework.runtime.props | 3 --- build.ps1 | 1 - 4 files changed, 8 deletions(-) diff --git a/NuGet/cef.redist.nuspec b/NuGet/cef.redist.nuspec index 7473268..680fdba 100644 --- a/NuGet/cef.redist.nuspec +++ b/NuGet/cef.redist.nuspec @@ -16,7 +16,6 @@ - diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec b/NuGet/chromiumembeddedframework.runtime.nuspec index 9930179..bc586c2 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.nuspec @@ -26,11 +26,8 @@ - - - diff --git a/NuGet/chromiumembeddedframework.runtime.props b/NuGet/chromiumembeddedframework.runtime.props index bee07f1..e8a0eac 100644 --- a/NuGet/chromiumembeddedframework.runtime.props +++ b/NuGet/chromiumembeddedframework.runtime.props @@ -5,10 +5,7 @@ --> - - - \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index b429cb4..368a47c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -729,7 +729,6 @@ try # Create the folders for any that don't exist so the nuget packages are created with empty folders # This can be removed once the new chromiumembeddedframework.runtime.resource package is created [System.IO.Directory]::CreateDirectory([IO.Path]::Combine($platform.Folder, 'Resources','locales')) - [System.IO.Directory]::CreateDirectory([IO.Path]::Combine($platform.Folder, 'Release','swiftshader')) if(!$platform.Enabled) { From 98c56ae1bdf308e7930f50a8f9863e1a8c3c0de6 Mon Sep 17 00:00:00 2001 From: Michael Stoll Date: Wed, 14 Dec 2022 06:35:05 +0100 Subject: [PATCH 09/21] Fix vs2022 detection --- build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 368a47c..fbcf79b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -236,10 +236,10 @@ function Msvs $VS_VER = 16; $VS_OFFICIAL_VER = 2019; - if ($_ -eq 'v143') + if ($Toolchain -eq 'v143') { $VS_VER=17; - $VS_OFFICIAL_VER=2021; + $VS_OFFICIAL_VER=2022; } Write-Diagnostic "VSWhere path $global:VSwherePath" From db981d616e3a3d009f45ed9af91c0f8d4897c0ef Mon Sep 17 00:00:00 2001 From: Michael Stoll Date: Wed, 14 Dec 2022 19:56:54 +0100 Subject: [PATCH 10/21] Add support for Visual Studio Build Tools --- build.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 368a47c..0793f9d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -251,7 +251,13 @@ function Msvs if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) { - Die "Visual Studio $VS_OFFICIAL_VER was not found" + $VSInstallPath = & $global:VSwherePath -version $versionSearchStr -property installationPath -products 'Microsoft.VisualStudio.Product.BuildTools' + Write-Diagnostic "BuildTools $($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" + + if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) + { + Die "Visual Studio $VS_OFFICIAL_VER was not found" + } } $VisualStudioVersion = "$VS_VER.0" From a4a5dd1932e6b4aaeb7324b13c54ef1184c05dde Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 4 Feb 2024 11:15:25 +1000 Subject: [PATCH 11/21] Remove cef.redist packages (#110) * Remove cef.redist packages * Change props names to match convention set in runtime package * Add Copy targets for Locales and fix naming Issue #93 --- NuGet/cef.redist.nuspec | 31 ----------- NuGet/cef.sdk.props | 2 +- NuGet/chromiumembeddedframework.runtime.json | 6 +-- .../chromiumembeddedframework.runtime.nuspec | 1 + NuGet/chromiumembeddedframework.runtime.props | 54 +++++++++++++++++++ ...membeddedframework.runtime.win-arm64.props | 28 ++++++++++ ...umembeddedframework.runtime.win-x64.props} | 13 ++--- ...umembeddedframework.runtime.win-x86.props} | 13 ++--- ...romiumembeddedframework.runtime.win.nuspec | 4 +- build.ps1 | 7 +-- 10 files changed, 101 insertions(+), 58 deletions(-) delete mode 100644 NuGet/cef.redist.nuspec create mode 100644 NuGet/chromiumembeddedframework.runtime.win-arm64.props rename NuGet/{cef.redist.x64.props => chromiumembeddedframework.runtime.win-x64.props} (54%) rename NuGet/{cef.redist.x86.props => chromiumembeddedframework.runtime.win-x86.props} (54%) diff --git a/NuGet/cef.redist.nuspec b/NuGet/cef.redist.nuspec deleted file mode 100644 index 680fdba..0000000 --- a/NuGet/cef.redist.nuspec +++ /dev/null @@ -1,31 +0,0 @@ - - - - cef.redist.$Platform$ - $version$ - The Chromium Embedded Framework Authors - The CefSharp Authors - https://github.com/cefsharp/cef-binary - https://raw.github.com/cefsharp/cef-binary/master/NuGet/cef128x128.gif - LICENSE.txt - false - CEF - the Chromium Embedded Framework. - NOTE: This package is maintained on behalf of the CEF authors by the CefSharp project at http://github.com/cefsharp/cef-binary - chrome chromium native embedded browser CEF nativepackage - Copyright © 2008-2021 - - - - - - - - - - - - - - - - diff --git a/NuGet/cef.sdk.props b/NuGet/cef.sdk.props index 795d807..ebe59a6 100644 --- a/NuGet/cef.sdk.props +++ b/NuGet/cef.sdk.props @@ -1,6 +1,6 @@ - cef.sdk.95.7.8 + cef.sdk.121.2.14 diff --git a/NuGet/chromiumembeddedframework.runtime.json b/NuGet/chromiumembeddedframework.runtime.json index 7a3c4b5..518fe36 100644 --- a/NuGet/chromiumembeddedframework.runtime.json +++ b/NuGet/chromiumembeddedframework.runtime.json @@ -2,17 +2,17 @@ "runtimes": { "win-x64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x64": "95.7.8" + "chromiumembeddedframework.runtime.win-x64": "121.2.14" } }, "win-x86": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x86": "95.7.8" + "chromiumembeddedframework.runtime.win-x86": "121.2.14" } }, "win-arm64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-arm64": "95.7.8" + "chromiumembeddedframework.runtime.win-arm64": "121.2.14" } }, } diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec b/NuGet/chromiumembeddedframework.runtime.nuspec index bc586c2..ef1fd41 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.nuspec @@ -30,6 +30,7 @@ + diff --git a/NuGet/chromiumembeddedframework.runtime.props b/NuGet/chromiumembeddedframework.runtime.props index e8a0eac..f303a74 100644 --- a/NuGet/chromiumembeddedframework.runtime.props +++ b/NuGet/chromiumembeddedframework.runtime.props @@ -8,4 +8,58 @@ + + + + <_CefRedist32TargetDir>$(CefRedist32TargetDir) + <_CefRedist32TargetDir Condition="'$(_CefRedist32TargetDir)' == ''">$(TargetDir) + <_CefRedist32TargetDir>$(_CefRedist32TargetDir)\locales + + + + <_CefRedist32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> + + + + + + + + <_CefRedist64TargetDir>$(CefRedist64TargetDir) + <_CefRedist64TargetDir Condition="'$(_CefRedist64TargetDir)' == ''">$(TargetDir) + <_CefRedist64TargetDir>$(_CefRedist64TargetDir)\locales + + + + <_CefRedist64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> + + + + + + + + <_CefRedistArm64TargetDir>$(CefRedistArm64TargetDir) + <_CefRedistArm64TargetDir Condition="'$(_CefRedistArm64TargetDir)' == ''">$(TargetDir) + <_CefRedistArm64TargetDir>$(_CefRedistArm64TargetDir)\locales + + + + <_CefRedistArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> + + + + \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-arm64.props b/NuGet/chromiumembeddedframework.runtime.win-arm64.props new file mode 100644 index 0000000..1cfb33e --- /dev/null +++ b/NuGet/chromiumembeddedframework.runtime.win-arm64.props @@ -0,0 +1,28 @@ + + + + + + + + + + + $(TargetDir) + + + + <_CefRuntimeWinArm64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\*.*" /> + + + + + \ No newline at end of file diff --git a/NuGet/cef.redist.x64.props b/NuGet/chromiumembeddedframework.runtime.win-x64.props similarity index 54% rename from NuGet/cef.redist.x64.props rename to NuGet/chromiumembeddedframework.runtime.win-x64.props index 78bc32d..fc4fb38 100644 --- a/NuGet/cef.redist.x64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x64.props @@ -6,11 +6,8 @@ Checkout the CefSharp.Common.targets file for an example --> - - + @@ -18,14 +15,14 @@ $(TargetDir) - <_CefRedist64 Include="$(MSBuildThisFileDirectory)..\CEF\**\*.*" /> + <_CefRuntimeWin64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\*.*" /> - - + + \ No newline at end of file diff --git a/NuGet/cef.redist.x86.props b/NuGet/chromiumembeddedframework.runtime.win-x86.props similarity index 54% rename from NuGet/cef.redist.x86.props rename to NuGet/chromiumembeddedframework.runtime.win-x86.props index 30766c5..04c5d44 100644 --- a/NuGet/cef.redist.x86.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x86.props @@ -6,11 +6,8 @@ Checkout the CefSharp.Common.targets file for an example --> - - + @@ -18,14 +15,14 @@ $(TargetDir) - <_CefRedist32 Include="$(MSBuildThisFileDirectory)..\CEF\**\*.*" /> + <_CefRuntimeWin32 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x86\native\*.*" /> - - + + \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win.nuspec b/NuGet/chromiumembeddedframework.runtime.win.nuspec index 95339c2..36bd1b5 100644 --- a/NuGet/chromiumembeddedframework.runtime.win.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.win.nuspec @@ -22,12 +22,14 @@ Copyright © 2008-2021 - + + + diff --git a/build.ps1 b/build.ps1 index 11458b0..0cfe82f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,7 +14,7 @@ param( [string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/", [Parameter(Position = 3)] - $CefVersion = "95.7.8+g69b7dc3+chromium-95.0.4638.17", + $CefVersion = "121.2.14+ga44b59f+chromium-121.0.6167.75", [ValidateSet("tar.bz2","zip","7z")] [Parameter(Position = 4)] @@ -444,11 +444,6 @@ function Nupkg $archLong = $platform.ArchLong # Build packages - if ($arch -ne "arm64") - { - . $Nuget pack nuget\cef.redist.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=$archLong;" -OutputDirectory nuget - } - . $Nuget pack nuget\chromiumembeddedframework.runtime.win.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties "Configuration=Release;Platform=$arch;CPlatform=$archLong;" -OutputDirectory nuget } From 0b0487634c86b05a6a069ceb279a6851a460116c Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 4 Feb 2024 11:37:50 +1000 Subject: [PATCH 12/21] Create new chromiumembeddedframework.runtime.resources package - Contains locales Issue #93 --- .../chromiumembeddedframework.runtime.nuspec | 10 +----- ...embeddedframework.runtime.resources.nuspec | 36 +++++++++++++++++++ ...embeddedframework.runtime.resources.props} | 0 build.ps1 | 9 ++--- 4 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 NuGet/chromiumembeddedframework.runtime.resources.nuspec rename NuGet/{chromiumembeddedframework.runtime.props => chromiumembeddedframework.runtime.resources.props} (100%) diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec b/NuGet/chromiumembeddedframework.runtime.nuspec index ef1fd41..8ba6455 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.nuspec @@ -19,19 +19,11 @@ Chromium Embedded Framework (CEF) Release Distribution NOTE: This package is maintained on behalf of the CEF authors by the CefSharp project at http://github.com/cefsharp/cef-binary chrome chromium native embedded browser CEF nativepackage - Copyright © 2008-2021 + Copyright © 2008-2024 - - - - - - - - diff --git a/NuGet/chromiumembeddedframework.runtime.resources.nuspec b/NuGet/chromiumembeddedframework.runtime.resources.nuspec new file mode 100644 index 0000000..f4a3d3b --- /dev/null +++ b/NuGet/chromiumembeddedframework.runtime.resources.nuspec @@ -0,0 +1,36 @@ + + + + chromiumembeddedframework.runtime.resources + $version$ + The Chromium Embedded Framework Authors + The CefSharp Authors + https://github.com/cefsharp/cef-binary + images\cef128x128.png + LICENSE.txt + false + + + Chromium Embedded Framework (CEF) Release Distribution + NOTE: This package is maintained on behalf of the CEF authors by the CefSharp project at http://github.com/cefsharp/cef-binary + chrome chromium native embedded browser CEF nativepackage + Copyright © 2008-2024 + + + + + + + + + + + + + + diff --git a/NuGet/chromiumembeddedframework.runtime.props b/NuGet/chromiumembeddedframework.runtime.resources.props similarity index 100% rename from NuGet/chromiumembeddedframework.runtime.props rename to NuGet/chromiumembeddedframework.runtime.resources.props diff --git a/build.ps1 b/build.ps1 index 0cfe82f..be985b6 100644 --- a/build.ps1 +++ b/build.ps1 @@ -251,13 +251,7 @@ function Msvs if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) { - $VSInstallPath = & $global:VSwherePath -version $versionSearchStr -property installationPath -products 'Microsoft.VisualStudio.Product.BuildTools' - Write-Diagnostic "BuildTools $($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" - - if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) - { - Die "Visual Studio $VS_OFFICIAL_VER was not found" - } + Die "Visual Studio $VS_OFFICIAL_VER was not found" } $VisualStudioVersion = "$VS_VER.0" @@ -449,6 +443,7 @@ function Nupkg # Meta Package . $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget + . $Nuget pack nuget\chromiumembeddedframework.runtime.resources.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget # Build sdk $Filename = Resolve-Path ".\nuget\cef.sdk.props" From 7ef312f9e01fa07bb4cd3fda2ba9b6bdbcdc77ec Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 4 Feb 2024 11:47:28 +1000 Subject: [PATCH 13/21] Revert "Create new chromiumembeddedframework.runtime.resources package" This reverts commit 0b0487634c86b05a6a069ceb279a6851a460116c. --- .../chromiumembeddedframework.runtime.nuspec | 10 +++++- ...> chromiumembeddedframework.runtime.props} | 0 ...embeddedframework.runtime.resources.nuspec | 36 ------------------- build.ps1 | 9 +++-- 4 files changed, 16 insertions(+), 39 deletions(-) rename NuGet/{chromiumembeddedframework.runtime.resources.props => chromiumembeddedframework.runtime.props} (100%) delete mode 100644 NuGet/chromiumembeddedframework.runtime.resources.nuspec diff --git a/NuGet/chromiumembeddedframework.runtime.nuspec b/NuGet/chromiumembeddedframework.runtime.nuspec index 8ba6455..ef1fd41 100644 --- a/NuGet/chromiumembeddedframework.runtime.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.nuspec @@ -19,11 +19,19 @@ Chromium Embedded Framework (CEF) Release Distribution NOTE: This package is maintained on behalf of the CEF authors by the CefSharp project at http://github.com/cefsharp/cef-binary chrome chromium native embedded browser CEF nativepackage - Copyright © 2008-2024 + Copyright © 2008-2021 + + + + + + + + diff --git a/NuGet/chromiumembeddedframework.runtime.resources.props b/NuGet/chromiumembeddedframework.runtime.props similarity index 100% rename from NuGet/chromiumembeddedframework.runtime.resources.props rename to NuGet/chromiumembeddedframework.runtime.props diff --git a/NuGet/chromiumembeddedframework.runtime.resources.nuspec b/NuGet/chromiumembeddedframework.runtime.resources.nuspec deleted file mode 100644 index f4a3d3b..0000000 --- a/NuGet/chromiumembeddedframework.runtime.resources.nuspec +++ /dev/null @@ -1,36 +0,0 @@ - - - - chromiumembeddedframework.runtime.resources - $version$ - The Chromium Embedded Framework Authors - The CefSharp Authors - https://github.com/cefsharp/cef-binary - images\cef128x128.png - LICENSE.txt - false - - - Chromium Embedded Framework (CEF) Release Distribution - NOTE: This package is maintained on behalf of the CEF authors by the CefSharp project at http://github.com/cefsharp/cef-binary - chrome chromium native embedded browser CEF nativepackage - Copyright © 2008-2024 - - - - - - - - - - - - - - diff --git a/build.ps1 b/build.ps1 index be985b6..0cfe82f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -251,7 +251,13 @@ function Msvs if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) { - Die "Visual Studio $VS_OFFICIAL_VER was not found" + $VSInstallPath = & $global:VSwherePath -version $versionSearchStr -property installationPath -products 'Microsoft.VisualStudio.Product.BuildTools' + Write-Diagnostic "BuildTools $($VS_OFFICIAL_VER)InstallPath: $VSInstallPath" + + if($null -eq $VSInstallPath -or !(Test-Path $VSInstallPath)) + { + Die "Visual Studio $VS_OFFICIAL_VER was not found" + } } $VisualStudioVersion = "$VS_VER.0" @@ -443,7 +449,6 @@ function Nupkg # Meta Package . $Nuget pack nuget\chromiumembeddedframework.runtime.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget - . $Nuget pack nuget\chromiumembeddedframework.runtime.resources.nuspec -NoPackageAnalysis -Version $CefPackageVersion -Properties 'Configuration=Release;' -OutputDirectory nuget # Build sdk $Filename = Resolve-Path ".\nuget\cef.sdk.props" From 8bee0fde296873ea75b4f7073ce8c54899bfa276 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 4 Feb 2024 12:04:00 +1000 Subject: [PATCH 14/21] Include locales in chromiumembeddedframework.runtime.win packages Issue #93 --- NuGet/chromiumembeddedframework.runtime.props | 54 ------------------- ...membeddedframework.runtime.win-arm64.props | 6 +++ ...iumembeddedframework.runtime.win-x64.props | 6 +++ ...iumembeddedframework.runtime.win-x86.props | 6 +++ ...romiumembeddedframework.runtime.win.nuspec | 1 + 5 files changed, 19 insertions(+), 54 deletions(-) diff --git a/NuGet/chromiumembeddedframework.runtime.props b/NuGet/chromiumembeddedframework.runtime.props index f303a74..e8a0eac 100644 --- a/NuGet/chromiumembeddedframework.runtime.props +++ b/NuGet/chromiumembeddedframework.runtime.props @@ -8,58 +8,4 @@ - - - - <_CefRedist32TargetDir>$(CefRedist32TargetDir) - <_CefRedist32TargetDir Condition="'$(_CefRedist32TargetDir)' == ''">$(TargetDir) - <_CefRedist32TargetDir>$(_CefRedist32TargetDir)\locales - - - - <_CefRedist32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> - - - - - - - - <_CefRedist64TargetDir>$(CefRedist64TargetDir) - <_CefRedist64TargetDir Condition="'$(_CefRedist64TargetDir)' == ''">$(TargetDir) - <_CefRedist64TargetDir>$(_CefRedist64TargetDir)\locales - - - - <_CefRedist64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> - - - - - - - - <_CefRedistArm64TargetDir>$(CefRedistArm64TargetDir) - <_CefRedistArm64TargetDir Condition="'$(_CefRedistArm64TargetDir)' == ''">$(TargetDir) - <_CefRedistArm64TargetDir>$(_CefRedistArm64TargetDir)\locales - - - - <_CefRedistArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> - - - - \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-arm64.props b/NuGet/chromiumembeddedframework.runtime.win-arm64.props index 1cfb33e..0887344 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-arm64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-arm64.props @@ -8,11 +8,13 @@ + $(TargetDir) + <_CefRedistArm64LocalesTargetDir>$(CefRedistArm64TargetDir)\locales <_CefRuntimeWinArm64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\*.*" /> + <_CefRuntimeWinArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> + + + \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-x64.props b/NuGet/chromiumembeddedframework.runtime.win-x64.props index fc4fb38..18ac9fe 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x64.props @@ -8,11 +8,13 @@ + $(TargetDir) + <_CefRedist64LocalesTargetDir>$(CefRedist64TargetDir)\locales <_CefRuntimeWin64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\*.*" /> + <_CefRuntimeWin64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> + + + \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-x86.props b/NuGet/chromiumembeddedframework.runtime.win-x86.props index 04c5d44..de8aed0 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x86.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x86.props @@ -8,11 +8,13 @@ + $(TargetDir) + <_CefRedist32LocalesTargetDir>$(CefRedist32TargetDir)\locales <_CefRuntimeWin32 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x86\native\*.*" /> + <_CefRuntimeWin32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> + + + \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win.nuspec b/NuGet/chromiumembeddedframework.runtime.win.nuspec index 36bd1b5..24080e2 100644 --- a/NuGet/chromiumembeddedframework.runtime.win.nuspec +++ b/NuGet/chromiumembeddedframework.runtime.win.nuspec @@ -27,6 +27,7 @@ + From 764ecd04465b445c5c8457247ac79b5af11ce2c8 Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Sun, 4 Feb 2024 12:04:00 +1000 Subject: [PATCH 15/21] Re-add CefRedist32/CefRedist64 props Issue #93 --- NuGet/chromiumembeddedframework.runtime.win-arm64.props | 5 ++++- NuGet/chromiumembeddedframework.runtime.win-x64.props | 5 ++++- NuGet/chromiumembeddedframework.runtime.win-x86.props | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NuGet/chromiumembeddedframework.runtime.win-arm64.props b/NuGet/chromiumembeddedframework.runtime.win-arm64.props index 0887344..3a1af39 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-arm64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-arm64.props @@ -8,7 +8,10 @@ - + <_CefRuntimeWinArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> + + + diff --git a/NuGet/chromiumembeddedframework.runtime.win-x64.props b/NuGet/chromiumembeddedframework.runtime.win-x64.props index 18ac9fe..99f0c4b 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x64.props @@ -8,7 +8,10 @@ - + <_CefRuntimeWin64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> + + + diff --git a/NuGet/chromiumembeddedframework.runtime.win-x86.props b/NuGet/chromiumembeddedframework.runtime.win-x86.props index de8aed0..46adcf0 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x86.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x86.props @@ -8,7 +8,10 @@ - + <_CefRuntimeWin32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> + + + From 8c8c1b73db5a60cd08c25820b69b1f5a5ca410ea Mon Sep 17 00:00:00 2001 From: Alex Maitland Date: Mon, 5 Feb 2024 19:11:14 +1000 Subject: [PATCH 16/21] Simplify .props properties and targets --- .../chromiumembeddedframework.runtime.win-arm64.props | 10 +++------- NuGet/chromiumembeddedframework.runtime.win-x64.props | 10 +++------- NuGet/chromiumembeddedframework.runtime.win-x86.props | 10 +++------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/NuGet/chromiumembeddedframework.runtime.win-arm64.props b/NuGet/chromiumembeddedframework.runtime.win-arm64.props index 3a1af39..a143464 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-arm64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-arm64.props @@ -8,16 +8,15 @@ - <_CefRuntimeWinArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> + <_CefRuntimeWinArm64Additional Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\**\*.*" /> - + $(TargetDir) - <_CefRedistArm64LocalesTargetDir>$(CefRedistArm64TargetDir)\locales <_CefRuntimeWinArm64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-arm64\native\*.*" /> - <_CefRuntimeWinArm64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\locales\*.*" /> + <_CefRuntimeWinArm64 Include="$(MSBuildThisFileDirectory)..\CEF\win-arm64\**\*.*" /> - - - \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-x64.props b/NuGet/chromiumembeddedframework.runtime.win-x64.props index 99f0c4b..f6c0006 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x64.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x64.props @@ -8,16 +8,15 @@ - <_CefRuntimeWin64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> + <_CefRuntimeWin64Additional Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\**\*.*" /> - + $(TargetDir) - <_CefRedist64LocalesTargetDir>$(CefRedist64TargetDir)\locales <_CefRuntimeWin64 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x64\native\*.*" /> - <_CefRuntimeWin64Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\locales\*.*" /> + <_CefRuntimeWin64 Include="$(MSBuildThisFileDirectory)..\CEF\win-x64\**\*.*" /> - - - \ No newline at end of file diff --git a/NuGet/chromiumembeddedframework.runtime.win-x86.props b/NuGet/chromiumembeddedframework.runtime.win-x86.props index 46adcf0..bc910c4 100644 --- a/NuGet/chromiumembeddedframework.runtime.win-x86.props +++ b/NuGet/chromiumembeddedframework.runtime.win-x86.props @@ -8,16 +8,15 @@ - <_CefRuntimeWin32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> + <_CefRuntimeWin32Additional Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\**\*.*" /> - + $(TargetDir) - <_CefRedist32LocalesTargetDir>$(CefRedist32TargetDir)\locales <_CefRuntimeWin32 Include="$(MSBuildThisFileDirectory)..\runtimes\win-x86\native\*.*" /> - <_CefRuntimeWin32Locales Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\locales\*.*" /> + <_CefRuntimeWin32 Include="$(MSBuildThisFileDirectory)..\CEF\win-x86\**\*.*" /> - - - \ No newline at end of file From 4ddf2182ca1e248dc4ed98902ed551d8b78d00d6 Mon Sep 17 00:00:00 2001 From: amaitland <307872+amaitland@users.noreply.github.com> Date: Sat, 18 Jan 2025 09:39:35 +1000 Subject: [PATCH 17/21] build.ps1 - Fix build issue where there are multiple CEF builds with the same version number - One is Stable and the other Beta, they're both the same build so just order and get the latest --- NuGet/chromiumembeddedframework.runtime.json | 6 +++--- build.ps1 | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/NuGet/chromiumembeddedframework.runtime.json b/NuGet/chromiumembeddedframework.runtime.json index 518fe36..f16b7e4 100644 --- a/NuGet/chromiumembeddedframework.runtime.json +++ b/NuGet/chromiumembeddedframework.runtime.json @@ -2,17 +2,17 @@ "runtimes": { "win-x64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x64": "121.2.14" + "chromiumembeddedframework.runtime.win-x64": "132.3.1" } }, "win-x86": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x86": "121.2.14" + "chromiumembeddedframework.runtime.win-x86": "132.3.1" } }, "win-arm64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-arm64": "121.2.14" + "chromiumembeddedframework.runtime.win-arm64": "132.3.1" } }, } diff --git a/build.ps1 b/build.ps1 index 0cfe82f..d40c59f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,7 +14,7 @@ param( [string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/", [Parameter(Position = 3)] - $CefVersion = "121.2.14+ga44b59f+chromium-121.0.6167.75", + $CefVersion = "132.3.1+g144febe+chromium-132.0.6834.83", [ValidateSet("tar.bz2","zip","7z")] [Parameter(Position = 4)] @@ -524,10 +524,13 @@ function DownloadCefBinaryAndUnzip() Die "Build Unavailable - $arch has no files for version $CefVersion" } - #TODO Duplication - $CefFileName = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).name - $CefFileHash = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).sha1 - $CefFileSize = (($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"}).size /1MB) + # CEF sometimes has multiple builds of the same version with one being Stable and one being Beta + # We'll take the newest build in that case + $CefStandardFiles = ($CefWinCefVersion.files | Where-Object {$_.type -eq "standard"} | Sort-Object -Descending -Property last_modified)[0]; + + $CefFileName = $CefStandardFiles.name + $CefFileHash = $CefStandardFiles.sha1 + $CefFileSize = $CefStandardFiles.size /1MB $LocalFile = Join-Path $WorkingDir $CefFileName if (-not (Test-Path $LocalFile)) From f5efbad0efed30ed933a5cf964690e61fe337c7e Mon Sep 17 00:00:00 2001 From: amaitland <307872+amaitland@users.noreply.github.com> Date: Wed, 12 Feb 2025 19:59:30 +1000 Subject: [PATCH 18/21] Fix CEF url downloading --- build.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.ps1 b/build.ps1 index d40c59f..5ddd667 100644 --- a/build.ps1 +++ b/build.ps1 @@ -535,10 +535,12 @@ function DownloadCefBinaryAndUnzip() $LocalFile = Join-Path $WorkingDir $CefFileName if (-not (Test-Path $LocalFile)) { + $UriEncodedFileName = [System.Web.HttpUtility]::UrlEncode($CefFileName).Replace("%2b", "%2B") + $FullUri = $CefBuildServerUrl + $UriEncodedFileName + Write-Diagnostic "Downloading $FullUri this will take a while as the file is $CefFileSize MB." + $Client = New-Object System.Net.WebClient; - - Write-Diagnostic "Downloading $CefFileName; this will take a while as the file is $CefFileSize MB." - $Client.DownloadFile($CefBuildServerUrl + [System.Web.HttpUtility]::UrlEncode($CefFileName), $LocalFile); + $Client.DownloadFile($FullUri, $LocalFile); if (-not (Test-Path $LocalFile)) { From e5c944bcb2bc14fb56c1156145b23808fee190f8 Mon Sep 17 00:00:00 2001 From: amaitland <307872+amaitland@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:05:07 +1000 Subject: [PATCH 19/21] build.ps1 - Change from using UrlEncode to EscapeDataString - Spotify download server is now case sensitive, the + in the file name needs to be encoded to B instead of lowercase b --- build.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 5ddd667..37e8c40 100644 --- a/build.ps1 +++ b/build.ps1 @@ -535,7 +535,8 @@ function DownloadCefBinaryAndUnzip() $LocalFile = Join-Path $WorkingDir $CefFileName if (-not (Test-Path $LocalFile)) { - $UriEncodedFileName = [System.Web.HttpUtility]::UrlEncode($CefFileName).Replace("%2b", "%2B") + # The spotify build server uses case sensitive urls now, need to use EscapeDataString instead of UrlEncode + $UriEncodedFileName = [System.Uri]::EscapeDataString($CefFileName) $FullUri = $CefBuildServerUrl + $UriEncodedFileName Write-Diagnostic "Downloading $FullUri this will take a while as the file is $CefFileSize MB." From e3ccca9a582aac904eb2fa75956185859d439876 Mon Sep 17 00:00:00 2001 From: amaitland <307872+amaitland@users.noreply.github.com> Date: Tue, 1 Jul 2025 19:10:11 +1000 Subject: [PATCH 20/21] Change to build with VS2022 by default --- NuGet/chromiumembeddedframework.runtime.json | 6 +++--- build.ps1 | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NuGet/chromiumembeddedframework.runtime.json b/NuGet/chromiumembeddedframework.runtime.json index f16b7e4..9dc32d3 100644 --- a/NuGet/chromiumembeddedframework.runtime.json +++ b/NuGet/chromiumembeddedframework.runtime.json @@ -2,17 +2,17 @@ "runtimes": { "win-x64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x64": "132.3.1" + "chromiumembeddedframework.runtime.win-x64": "138.0.15" } }, "win-x86": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-x86": "132.3.1" + "chromiumembeddedframework.runtime.win-x86": "138.0.15" } }, "win-arm64": { "chromiumembeddedframework.runtime": { - "chromiumembeddedframework.runtime.win-arm64": "132.3.1" + "chromiumembeddedframework.runtime.win-arm64": "138.0.15" } }, } diff --git a/build.ps1 b/build.ps1 index 37e8c40..9f940ea 100644 --- a/build.ps1 +++ b/build.ps1 @@ -14,7 +14,7 @@ param( [string] $CefBinaryDir = "../cefsource/chromium/src/cef/binary_distrib/", [Parameter(Position = 3)] - $CefVersion = "132.3.1+g144febe+chromium-132.0.6834.83", + $CefVersion = "138.0.15+gd0f1f64+chromium-138.0.7204.50", [ValidateSet("tar.bz2","zip","7z")] [Parameter(Position = 4)] @@ -746,7 +746,7 @@ try { "nupkg" { - VSX v142 $platform + VSX v143 $platform } "vs2022" { From cc8e49f6c5f275fd5c0f7aec29500fe3b27622af Mon Sep 17 00:00:00 2001 From: amaitland <307872+amaitland@users.noreply.github.com> Date: Tue, 1 Jul 2025 19:36:43 +1000 Subject: [PATCH 21/21] appveyor.yml - change to use VS2022 Build image --- NuGet/cef.sdk.props | 2 +- appveyor.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NuGet/cef.sdk.props b/NuGet/cef.sdk.props index ebe59a6..7f412a8 100644 --- a/NuGet/cef.sdk.props +++ b/NuGet/cef.sdk.props @@ -1,6 +1,6 @@ - cef.sdk.121.2.14 + cef.sdk.138.0.15 diff --git a/appveyor.yml b/appveyor.yml index dd3d487..319342b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ -image: Visual Studio 2019 +image: Visual Studio 2022 -version: 93.0.1-CI{build} +version: 138.0.15-CI{build} shallow_clone: true