From 715b5e7336c4585e5ff2522b671370b03b7506ea Mon Sep 17 00:00:00 2001 From: David Ellingsworth Date: Thu, 2 Jul 2020 15:28:11 -0400 Subject: [PATCH] Move platform dependent files to respective directories. Use XML transforms to update the app.config during build. --- CefSharp3.sln | 11 +++ .../CefSharp.Common.app.config.x64.transform | 30 ++++++++ .../CefSharp.Common.app.config.x86.transform | 30 ++++++++ NuGet/CefSharp.Common.nuspec | 2 + NuGet/CefSharp.Common.targets | 56 ++++----------- ...efSharp.OffScreen.app.config.x64.transform | 0 ...efSharp.OffScreen.app.config.x86.transform | 0 NuGet/CefSharp.OffScreen.nuspec | 2 + NuGet/CefSharp.OffScreen.targets | 68 +++++++------------ ...CefSharp.WinForms.app.config.x64.transform | 18 +++++ ...CefSharp.WinForms.app.config.x86.transform | 18 +++++ NuGet/CefSharp.WinForms.nuspec | 2 + NuGet/CefSharp.WinForms.targets | 68 +++++++------------ NuGet/CefSharp.Wpf.app.config.x64.transform | 18 +++++ NuGet/CefSharp.Wpf.app.config.x86.transform | 18 +++++ NuGet/CefSharp.Wpf.nuspec | 2 + NuGet/CefSharp.Wpf.targets | 68 +++++++------------ build.ps1 | 21 ++++++ 18 files changed, 261 insertions(+), 171 deletions(-) create mode 100644 NuGet/CefSharp.Common.app.config.x64.transform create mode 100644 NuGet/CefSharp.Common.app.config.x86.transform create mode 100644 NuGet/CefSharp.OffScreen.app.config.x64.transform create mode 100644 NuGet/CefSharp.OffScreen.app.config.x86.transform create mode 100644 NuGet/CefSharp.WinForms.app.config.x64.transform create mode 100644 NuGet/CefSharp.WinForms.app.config.x86.transform create mode 100644 NuGet/CefSharp.Wpf.app.config.x64.transform create mode 100644 NuGet/CefSharp.Wpf.app.config.x86.transform diff --git a/CefSharp3.sln b/CefSharp3.sln index 3469e0ec43..4a0cc42ca3 100644 --- a/CefSharp3.sln +++ b/CefSharp3.sln @@ -42,15 +42,26 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CefSharp.WinForms.Example", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{A23AA466-1903-44F2-946D-25AD0500D56B}" ProjectSection(SolutionItems) = preProject + NuGet\CefSharp.Common.app.config.x64.transform = NuGet\CefSharp.Common.app.config.x64.transform + NuGet\CefSharp.Common.app.config.x86.transform = NuGet\CefSharp.Common.app.config.x86.transform NuGet\CefSharp.Common.nuspec = NuGet\CefSharp.Common.nuspec NuGet\CefSharp.Common.props = NuGet\CefSharp.Common.props NuGet\CefSharp.Common.targets = NuGet\CefSharp.Common.targets + NuGet\CefSharp.OffScreen.app.config.x64.transform = NuGet\CefSharp.OffScreen.app.config.x64.transform + NuGet\CefSharp.OffScreen.app.config.x86.transform = NuGet\CefSharp.OffScreen.app.config.x86.transform NuGet\CefSharp.OffScreen.nuspec = NuGet\CefSharp.OffScreen.nuspec NuGet\CefSharp.OffScreen.props = NuGet\CefSharp.OffScreen.props + NuGet\CefSharp.OffScreen.targets = NuGet\CefSharp.OffScreen.targets + NuGet\CefSharp.WinForms.app.config.x64.transform = NuGet\CefSharp.WinForms.app.config.x64.transform + NuGet\CefSharp.WinForms.app.config.x86.transform = NuGet\CefSharp.WinForms.app.config.x86.transform NuGet\CefSharp.WinForms.nuspec = NuGet\CefSharp.WinForms.nuspec NuGet\CefSharp.WinForms.props = NuGet\CefSharp.WinForms.props + NuGet\CefSharp.WinForms.targets = NuGet\CefSharp.WinForms.targets + NuGet\CefSharp.Wpf.app.config.x64.transform = NuGet\CefSharp.Wpf.app.config.x64.transform + NuGet\CefSharp.Wpf.app.config.x86.transform = NuGet\CefSharp.Wpf.app.config.x86.transform NuGet\CefSharp.Wpf.nuspec = NuGet\CefSharp.Wpf.nuspec NuGet\CefSharp.Wpf.props = NuGet\CefSharp.Wpf.props + NuGet\CefSharp.Wpf.targets = NuGet\CefSharp.Wpf.targets NuGet\Readme.txt = NuGet\Readme.txt EndProjectSection EndProject diff --git a/NuGet/CefSharp.Common.app.config.x64.transform b/NuGet/CefSharp.Common.app.config.x64.transform new file mode 100644 index 0000000000..14638ff3e5 --- /dev/null +++ b/NuGet/CefSharp.Common.app.config.x64.transform @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.Common.app.config.x86.transform b/NuGet/CefSharp.Common.app.config.x86.transform new file mode 100644 index 0000000000..b95bbe2598 --- /dev/null +++ b/NuGet/CefSharp.Common.app.config.x86.transform @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.Common.nuspec b/NuGet/CefSharp.Common.nuspec index df8826e48c..f83624180f 100644 --- a/NuGet/CefSharp.Common.nuspec +++ b/NuGet/CefSharp.Common.nuspec @@ -49,6 +49,8 @@ + + diff --git a/NuGet/CefSharp.Common.targets b/NuGet/CefSharp.Common.targets index 95c9d915cc..cd032b28bc 100644 --- a/NuGet/CefSharp.Common.targets +++ b/NuGet/CefSharp.Common.targets @@ -1,77 +1,49 @@ - - - - - - . - - - - + - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) + x86\%(RecursiveDir)%(FileName)%(Extension) PreserveNewest Include false - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) + x86\%(RecursiveDir)%(FileName)%(Extension) PreserveNewest Include false - - + + - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) + x64\%(RecursiveDir)%(FileName)%(Extension) PreserveNewest Include false - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) + x64\%(RecursiveDir)%(FileName)%(Extension) PreserveNewest Include false - - - $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - + + + + + + + diff --git a/NuGet/CefSharp.OffScreen.app.config.x64.transform b/NuGet/CefSharp.OffScreen.app.config.x64.transform new file mode 100644 index 0000000000..e69de29bb2 diff --git a/NuGet/CefSharp.OffScreen.app.config.x86.transform b/NuGet/CefSharp.OffScreen.app.config.x86.transform new file mode 100644 index 0000000000..e69de29bb2 diff --git a/NuGet/CefSharp.OffScreen.nuspec b/NuGet/CefSharp.OffScreen.nuspec index 5719d7f412..215086c59c 100644 --- a/NuGet/CefSharp.OffScreen.nuspec +++ b/NuGet/CefSharp.OffScreen.nuspec @@ -39,6 +39,8 @@ + + diff --git a/NuGet/CefSharp.OffScreen.targets b/NuGet/CefSharp.OffScreen.targets index 58a72c0b88..7f87bf8606 100644 --- a/NuGet/CefSharp.OffScreen.targets +++ b/NuGet/CefSharp.OffScreen.targets @@ -1,9 +1,5 @@ - - . - - - - - - - $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - + + + x86\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + x64\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + + + + + diff --git a/NuGet/CefSharp.WinForms.app.config.x64.transform b/NuGet/CefSharp.WinForms.app.config.x64.transform new file mode 100644 index 0000000000..aaffc08c27 --- /dev/null +++ b/NuGet/CefSharp.WinForms.app.config.x64.transform @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.WinForms.app.config.x86.transform b/NuGet/CefSharp.WinForms.app.config.x86.transform new file mode 100644 index 0000000000..80457c2c71 --- /dev/null +++ b/NuGet/CefSharp.WinForms.app.config.x86.transform @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.WinForms.nuspec b/NuGet/CefSharp.WinForms.nuspec index 454b4796c6..79f3485768 100644 --- a/NuGet/CefSharp.WinForms.nuspec +++ b/NuGet/CefSharp.WinForms.nuspec @@ -39,6 +39,8 @@ + + diff --git a/NuGet/CefSharp.WinForms.targets b/NuGet/CefSharp.WinForms.targets index 9cfd4c624a..bfc3706f65 100644 --- a/NuGet/CefSharp.WinForms.targets +++ b/NuGet/CefSharp.WinForms.targets @@ -1,9 +1,5 @@ - - . - - - - - - - $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - + + + x86\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + x64\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + + + + + diff --git a/NuGet/CefSharp.Wpf.app.config.x64.transform b/NuGet/CefSharp.Wpf.app.config.x64.transform new file mode 100644 index 0000000000..5e1dc244df --- /dev/null +++ b/NuGet/CefSharp.Wpf.app.config.x64.transform @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.Wpf.app.config.x86.transform b/NuGet/CefSharp.Wpf.app.config.x86.transform new file mode 100644 index 0000000000..627aef5b94 --- /dev/null +++ b/NuGet/CefSharp.Wpf.app.config.x86.transform @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/NuGet/CefSharp.Wpf.nuspec b/NuGet/CefSharp.Wpf.nuspec index 5f230b32ed..3b1630a4c6 100644 --- a/NuGet/CefSharp.Wpf.nuspec +++ b/NuGet/CefSharp.Wpf.nuspec @@ -39,6 +39,8 @@ + + diff --git a/NuGet/CefSharp.Wpf.targets b/NuGet/CefSharp.Wpf.targets index 701fa70c04..5a4820b414 100644 --- a/NuGet/CefSharp.Wpf.targets +++ b/NuGet/CefSharp.Wpf.targets @@ -1,9 +1,5 @@ - - . - - - - - - - $(CefSharpTargetDir)\x86\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - $(CefSharpTargetDir)\x64\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - - - - - $(CefSharpTargetDir)\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - Include - false - - - - + + + x86\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + x64\%(RecursiveDir)%(FileName)%(Extension) + PreserveNewest + Include + false + + + + + + + + + + diff --git a/build.ps1 b/build.ps1 index 6cffe298d1..10828f6d1f 100644 --- a/build.ps1 +++ b/build.ps1 @@ -381,6 +381,18 @@ function WriteVersionToManifest($manifest) [System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding) } +function WriteVersionToTransform($transform) +{ + $Filename = Join-Path $WorkingDir $transform + $Regex = 'codeBase version="(.*?)"'; + + $TransformData = Get-Content -Encoding UTF8 $Filename + $NewString = $TransformData -replace $Regex, "codeBase version=""$AssemblyVersion.0""" + + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding) +} + function WriteVersionToResourceFile($resourceFile) { $Filename = Join-Path $WorkingDir $resourceFile @@ -445,6 +457,15 @@ WriteVersionToManifest "CefSharp.Wpf.Example\app.manifest" WriteVersionToResourceFile "CefSharp.BrowserSubprocess.Core\Resource.rc" WriteVersionToResourceFile "CefSharp.Core\Resource.rc" +WriteVersionToTransform "NuGet\CefSharp.Common.app.config.x64.transform" +WriteVersionToTransform "NuGet\CefSharp.Common.app.config.x86.transform" +WriteVersionToTransform "NuGet\CefSharp.OffScreen.app.config.x64.transform" +WriteVersionToTransform "nuget\CefSharp.OffScreen.app.config.x86.transform" +WriteVersionToTransform "NuGet\CefSharp.WinForms.app.config.x64.transform" +WriteVersionToTransform "NuGet\CefSharp.WinForms.app.config.x86.transform" +WriteVersionToTransform "NuGet\CefSharp.Wpf.app.config.x64.transform" +WriteVersionToTransform "NuGet\CefSharp.Wpf.app.config.x86.transform" + switch -Exact ($Target) { "nupkg-only"