1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-13 18:15:48 +02:00

Update PostCefUpdate script to remove invalid build configurations (x64, AnyCPU)

This commit is contained in:
chylex 2018-06-29 17:05:53 +02:00
parent e154189de1
commit 8d1900362e
2 changed files with 60 additions and 16 deletions

View File

@ -64,6 +64,8 @@ After the window closes, three installers will be generated inside the `bld/Outp
#### Notes
> When opening **Batch Build**, you will also see `x64` and `AnyCPU` configurations. These are visible due to what I consider a Visual Studio bug, and will not work without significant changes to the project. Manually running the `Resources/PostCefUpdate.ps1` PowerShell script modifies the downloaded CefSharp packages, and removes the invalid configurations.
> There is a small chance running `RUN BUILD.bat` immediately shows a resource error. If that happens, close the console window (which terminates all Inno Setup processes and leaves corrupted installers in the output folder), and run it again.
> Running `RUN BUILD.bat` uses about 400 MB of RAM due to high compression. You can lower this to about 140 MB by opening `gen_full.iss` and `gen_port.iss`, and changing `LZMADictionarySize=15360` to `LZMADictionarySize=4096`.

View File

@ -1,18 +1,60 @@
$ErrorActionPreference = "Stop"
$MainProj = "..\TweetDuck.csproj"
$BrowserProj = "..\subprocess\TweetDuck.Browser.csproj"
$Match = Select-String -Path $MainProj '<Import Project="packages\\cef\.redist\.x86\.(.*?)\\'
$Version = $Match.Matches[0].Groups[1].Value
Copy-Item "..\packages\cef.redist.x86.${Version}\CEF\devtools_resources.pak" -Destination "..\bld\Resources\" -Force
$Match = Select-String -Path $MainProj '<Import Project="packages\\CefSharp\.Common\.(.*?)\\'
$Version = $Match.Matches[0].Groups[1].Value
$Contents = [IO.File]::ReadAllText($BrowserProj)
$Contents = $Contents -Replace '(?<=<HintPath>\.\.\\packages\\CefSharp\.Common\.)(.*?)(?=\\)', $Version
$Contents = $Contents -Replace '(?<=<Reference Include="CefSharp\.BrowserSubprocess\.Core, Version=)(\d+)', $Version.Split(".")[0]
[IO.File]::WriteAllText($BrowserProj, $Contents)
try{
$mainProj = "..\TweetDuck.csproj"
$browserProj = "..\subprocess\TweetDuck.Browser.csproj"
$cefMatch = Select-String -Path $mainProj '<Import Project="packages\\cef\.redist\.x86\.(.*?)\\'
$cefVersion = $cefMatch.Matches[0].Groups[1].Value
$sharpMatch = Select-String -Path $mainProj '<Import Project="packages\\CefSharp\.Common\.(.*?)\\'
$sharpVersion = $sharpMatch.Matches[0].Groups[1].Value
$propsFiles = "..\packages\CefSharp.Common.${sharpVersion}\build\CefSharp.Common.props",
"..\packages\CefSharp.WinForms.${sharpVersion}\build\CefSharp.WinForms.props"
# Greetings
$title = "CEF ${cefVersion}, CefSharp ${sharpVersion}"
Write-Host ("-" * $title.Length)
Write-Host $title
Write-Host ("-" * $title.Length)
# Perform update
Write-Host "Copying dev tools to repository..."
Copy-Item "..\packages\cef.redist.x86.${cefVersion}\CEF\devtools_resources.pak" -Destination "..\bld\Resources\" -Force
Write-Host "Updating browser subprocess reference..."
$contents = [IO.File]::ReadAllText($browserProj)
$contents = $contents -Replace '(?<=<HintPath>\.\.\\packages\\CefSharp\.Common\.)(.*?)(?=\\)', $sharpVersion
$contents = $contents -Replace '(?<=<Reference Include="CefSharp\.BrowserSubprocess\.Core, Version=)(\d+)', $sharpVersion.Split(".")[0]
[IO.File]::WriteAllText($browserProj, $contents)
Write-Host "Removing x64 and AnyCPU from CefSharp props..."
foreach($file in $propsFiles){
$contents = [IO.File]::ReadAllText($file)
$contents = $contents -Replace '(?<=<When Condition=")(''\$\(Platform\)'' == ''(AnyCPU|x64)'')(?=">)', 'false'
[IO.File]::WriteAllText($file, $contents)
}
# Finished
Write-Host ""
Write-Host "Finished. Exiting in 6 seconds..."
Start-Sleep -Seconds 6
}catch{
Write-Host ""
Write-Host "Encountered an error while running PostBuild.ps1 on line" $_.InvocationInfo.ScriptLineNumber
Write-Host $_
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Exit 1
}