Skip to content

Commit

Permalink
Build.ps1 - Automated more tasks relating to updating CefSharp versio…
Browse files Browse the repository at this point in the history
…n and copyright year (cefsharp#2640)

* build.ps1 - Write version to CefSharp.shfbproj

* build.ps1 - Specify UTF-8 as encoding when reading

* build.ps1 - Save files as UTF-8 without BOM

* build.ps1 - Update copyright year on compiled files

* build.ps1 - Update version in appveyor.yml

* Removed copyright year from the nuspec files

* Updated editorconfig for ps1 files

* Apply changes from build.ps1

* LICENSE - Removed year
  • Loading branch information
merceyz authored Feb 15, 2019
1 parent 8d23dc7 commit a9b3c36
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 23 deletions.
12 changes: 8 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ charset = utf-8
end_of_line = crlf
trim_trailing_whitespace = true

# Powershell files (build.ps1)
[*.ps1]
charset = utf-8-bom

# Xml config files
[*.{props,targets,config,nuspec,manifest}]
indent_size = 2
indent_size = 2

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman
curly_bracket_next_line = true
indent_brace_style = Allman

[*.cs]
# Capitalization styles
Expand Down Expand Up @@ -56,7 +60,7 @@ dotnet_style_qualification_for_property =
dotnet_style_qualification_for_method = false : suggestion
dotnet_style_qualification_for_event = false : suggestion

# Prefer using var
# Prefer using var
csharp_style_var_for_built_in_types = true : none
csharp_style_var_when_type_is_apparent = true : suggestion
csharp_style_var_elsewhere = true : suggestion
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.BrowserSubprocess.Core/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BEGIN
BEGIN
VALUE "FileDescription", "CefSharp.BrowserSubprocess.Core"
VALUE "FileVersion", "71.0.0"
VALUE "LegalCopyright", "Copyright © 2010-2018 The CefSharp Authors"
VALUE "LegalCopyright", "Copyright © 2019 The CefSharp Authors"
VALUE "ProductName", "CefSharp"
VALUE "ProductVersion", "71.0.0"
END
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Core/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ BEGIN
BEGIN
VALUE "FileDescription", "CefSharp.Core"
VALUE "FileVersion", "71.0.0"
VALUE "LegalCopyright", "Copyright © 2010-2018 The CefSharp Authors"
VALUE "LegalCopyright", "Copyright © 2019 The CefSharp Authors"
VALUE "ProductName", "CefSharp"
VALUE "ProductVersion", "71.0.0"
END
Expand Down
8 changes: 4 additions & 4 deletions CefSharp.shfbproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- The configuration and platform will be used to determine which assemblies to include from solution and
Expand Down Expand Up @@ -31,7 +31,7 @@
<DocumentationSource sourceFile="CefSharp\CefSharp.csproj" />
<DocumentationSource sourceFile="CefSharp.Core\CefSharp.Core.vcxproj" />
</DocumentationSources>
<HelpFileVersion>67.0.0</HelpFileVersion>
<HelpFileVersion>71.0.0</HelpFileVersion>
<MaximumGroupParts>2</MaximumGroupParts>
<NamespaceGrouping>False</NamespaceGrouping>
<SyntaxFilters>C#, Managed C++</SyntaxFilters>
Expand All @@ -57,7 +57,7 @@
<Filter entryType="Namespace" fullName="CefSharp.Internals" isExposed="False" xmlns="" />
</ApiFilter>
<VisibleItems>InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected, EditorBrowsableNever, NonBrowsable</VisibleItems>
<HeaderText>Version 67.0.0</HeaderText>
<HeaderText>Version 71.0.0</HeaderText>
<CopyrightHref>https://raw.githubusercontent.com/cefsharp/CefSharp/master/LICENSE</CopyrightHref>
<NamespaceSummaries>
<NamespaceSummaryItem name="CefSharp" isDocumented="True">Interfaces, enums, structs and classes that make up the core API interface</NamespaceSummaryItem>
Expand Down Expand Up @@ -98,4 +98,4 @@
</PostBuildEvent>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion CefSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static class AssemblyInfo
public const string AssemblyProduct = "CefSharp";
public const string AssemblyVersion = "71.0.0";
public const string AssemblyFileVersion = "71.0.0.0";
public const string AssemblyCopyright = "Copyright © 2010-2018 The CefSharp Authors";
public const string AssemblyCopyright = "Copyright © 2019 The CefSharp Authors";
public const string CefSharpCoreProject = "CefSharp.Core, PublicKey=" + PublicKey;
public const string CefSharpBrowserSubprocessProject = "CefSharp.BrowserSubprocess, PublicKey=" + PublicKey;
public const string CefSharpBrowserSubprocessCoreProject = "CefSharp.BrowserSubprocess.Core, PublicKey=" + PublicKey;
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2010-2018 The CefSharp Authors. All rights reserved.
// Copyright © The CefSharp Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down
2 changes: 1 addition & 1 deletion NuGet/CefSharp.Common.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The CefSharp Chromium-based browser component ('Core' and common 'Element' components, needed by both WPF and WinForms).</description>
<tags>chrome browser</tags>
<copyright>Copyright © 2010-2019 The CefSharp Authors</copyright>
<copyright>Copyright © The CefSharp Authors</copyright>
<dependencies>
<dependency id="cef.redist.x86" version="[$RedistVersion$]" />
<dependency id="cef.redist.x64" version="[$RedistVersion$]" />
Expand Down
2 changes: 1 addition & 1 deletion NuGet/CefSharp.OffScreen.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The CefSharp Chromium-based browser component (OffScreen control).</description>
<tags>osr chrome browser</tags>
<copyright>Copyright © 2010-2019 The CefSharp Authors</copyright>
<copyright>Copyright © The CefSharp Authors</copyright>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="CefSharp.Common" version="[$version$]" />
Expand Down
2 changes: 1 addition & 1 deletion NuGet/CefSharp.WinForms.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The CefSharp Chromium-based browser component (WinForms control).</description>
<tags>winforms chrome browser</tags>
<copyright>Copyright © 2010-2019 The CefSharp Authors</copyright>
<copyright>Copyright © The CefSharp Authors</copyright>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="CefSharp.Common" version="[$version$]" />
Expand Down
2 changes: 1 addition & 1 deletion NuGet/CefSharp.Wpf.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The CefSharp Chromium-based browser component (WPF control).</description>
<tags>wpf chrome browser</tags>
<copyright>Copyright © 2010-2019 The CefSharp Authors</copyright>
<copyright>Copyright © The CefSharp Authors</copyright>
<dependencies>
<group targetFramework=".NETFramework4.5.2">
<dependency id="CefSharp.Common" version="[$version$]" />
Expand Down
53 changes: 46 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
param(
param(
[ValidateSet("vs2015", "vs2017", "nupkg-only", "gitlink")]
[Parameter(Position = 0)]
[string] $Target = "vs2015",
Expand Down Expand Up @@ -345,36 +345,73 @@ function WriteAssemblyVersion
$Filename = Join-Path $WorkingDir CefSharp\Properties\AssemblyInfo.cs
$Regex = 'public const string AssemblyVersion = "(.*)"';
$Regex2 = 'public const string AssemblyFileVersion = "(.*)"'
$Regex3 = 'public const string AssemblyCopyright = "Copyright © .* The CefSharp Authors"'

$AssemblyInfo = Get-Content -Encoding UTF8 $Filename
$CurrentYear = Get-Date -Format yyyy

$AssemblyInfo = Get-Content $Filename
$NewString = $AssemblyInfo -replace $Regex, "public const string AssemblyVersion = ""$AssemblyVersion"""
$NewString = $NewString -replace $Regex2, "public const string AssemblyFileVersion = ""$AssemblyVersion.0"""
$NewString = $NewString -replace $Regex3, "public const string AssemblyCopyright = ""Copyright © $CurrentYear The CefSharp Authors"""

$NewString | Set-Content $Filename -Encoding UTF8
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}

function WriteVersionToManifest($manifest)
{
$Filename = Join-Path $WorkingDir $manifest
$Regex = 'assemblyIdentity version="(.*?)"';

$ManifestData = Get-Content $Filename
$ManifestData = Get-Content -Encoding UTF8 $Filename
$NewString = $ManifestData -replace $Regex, "assemblyIdentity version=""$AssemblyVersion.0"""

$NewString | Set-Content $Filename -Encoding UTF8
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}

function WriteVersionToResourceFile($resourceFile)
{
$Filename = Join-Path $WorkingDir $resourceFile
$Regex1 = 'VERSION .*';
$Regex2 = 'Version", ".*?"';
$Regex3 = 'Copyright © .* The CefSharp Authors'

$ResourceData = Get-Content -Encoding UTF8 $Filename
$CurrentYear = Get-Date -Format yyyy

$ResourceData = Get-Content $Filename
$NewString = $ResourceData -replace $Regex1, "VERSION $AssemblyVersion"
$NewString = $NewString -replace $Regex2, "Version"", ""$AssemblyVersion"""
$NewString = $NewString -replace $Regex3, "Copyright © $CurrentYear The CefSharp Authors"

$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}

function WriteVersionToShfbproj
{
$Filename = Join-Path $WorkingDir CefSharp.shfbproj
$Regex1 = '<HelpFileVersion>.*<\/HelpFileVersion>';
$Regex2 = '<HeaderText>Version .*<\/HeaderText>';

$ShfbprojData = Get-Content -Encoding UTF8 $Filename
$NewString = $ShfbprojData -replace $Regex1, "<HelpFileVersion>$AssemblyVersion</HelpFileVersion>"
$NewString = $NewString -replace $Regex2, "<HeaderText>Version $AssemblyVersion</HeaderText>"

$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}

function WriteVersionToAppveyor
{
$Filename = Join-Path $WorkingDir appveyor.yml
$Regex1 = 'version: .*-CI{build}';

$AppveyorData = Get-Content -Encoding UTF8 $Filename
$NewString = $AppveyorData -replace $Regex1, "version: $AssemblyVersion-CI{build}"

$NewString | Set-Content $Filename -Encoding UTF8
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($Filename, $NewString, $Utf8NoBomEncoding)
}

Write-Diagnostic "CEF Redist Version = $RedistVersion"
Expand All @@ -384,6 +421,8 @@ DownloadNuget
NugetPackageRestore

WriteAssemblyVersion
WriteVersionToShfbproj
WriteVersionToAppveyor

WriteVersionToManifest "CefSharp.BrowserSubprocess\app.manifest"
WriteVersionToManifest "CefSharp.OffScreen.Example\app.manifest"
Expand Down

0 comments on commit a9b3c36

Please sign in to comment.