-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
138 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
sources/configuration/build/targets/LoadActualGitInfo.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current"> | ||
|
||
<Target Name="LoadActualGitInfo" BeforeTargets="UpdateAssemblyInfo"> | ||
|
||
<Exec Command='git rev-parse --abbrev-ref HEAD' WorkingDirectory='$(RootDirectory)' ConsoleToMsBuild='true' | ||
Condition=" '$(GitBranchName)' == '' "> | ||
<Output PropertyName='GitBranchName' TaskParameter='ConsoleOutput' /> | ||
</Exec> | ||
|
||
<Exec Command='git rev-parse --short HEAD' WorkingDirectory='$(RootDirectory)' ConsoleToMsBuild='true' | ||
Condition=" '$(GitCommitHash)' == '' "> | ||
<Output PropertyName='GitCommitHash' TaskParameter='ConsoleOutput' /> | ||
</Exec> | ||
|
||
</Target> | ||
</Project> |
68 changes: 68 additions & 0 deletions
68
sources/configuration/build/targets/UpdateAssemblyInfoFile.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current"> | ||
|
||
<UsingTask TaskName="RegexUpdateFile" TaskFactory="CodeTaskFactory" | ||
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> | ||
<ParameterGroup> | ||
<Files ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" /> | ||
<Regex ParameterType="System.String" Required="true" /> | ||
<ReplacementText ParameterType="System.String" Required="true" /> | ||
</ParameterGroup> | ||
<Task> | ||
<Reference Include="System.Core" /> | ||
<Using Namespace="System" /> | ||
<Using Namespace="System.IO" /> | ||
<Using Namespace="System.Text.RegularExpressions" /> | ||
<Using Namespace="Microsoft.Build.Framework" /> | ||
<Using Namespace="Microsoft.Build.Utilities" /> | ||
<Code Type="Fragment" Language="cs"> | ||
<![CDATA[ | ||
try { | ||
var rx = new System.Text.RegularExpressions.Regex(this.Regex); | ||
for (int i = 0; i < Files.Length; ++i) | ||
{ | ||
var path = Files[i].GetMetadata("FullPath"); | ||
if (!File.Exists(path)) continue; | ||
var txt = File.ReadAllText(path); | ||
txt = rx.Replace(txt, this.ReplacementText); | ||
Log.LogMessage(" updating '{0}' with '{1}' at '{2}'", Regex, ReplacementText, path); | ||
File.WriteAllText(path, txt, System.Text.Encoding.UTF8); | ||
} | ||
return true; | ||
} | ||
catch (Exception ex) { | ||
Log.LogErrorFromException(ex); | ||
return false; | ||
} | ||
]]> | ||
</Code> | ||
</Task> | ||
</UsingTask> | ||
|
||
<Target Name="UpdateAssemblyInfo" BeforeTargets="DbSchemaBuild"> | ||
|
||
<PropertyGroup> | ||
<DbSchemaAssemblyCopyright Condition="'$(DbSchemaAssemblyCopyright)' == ''">Copyright © $([System.DateTime]::Today.ToString('yyyy'))</DbSchemaAssemblyCopyright> | ||
<DbSchemaAssemblyVersion Condition="'$(DbSchemaAssemblyVersion)' == ''">$(MajorVersion).0.0.0</DbSchemaAssemblyVersion> | ||
<DbSchemaAssemblyFileVersion Condition="'$(DbSchemaAssemblyFileVersion)' == ''">$(MajorVersion).$(MinorVersion).$(PatchVersion).0</DbSchemaAssemblyFileVersion> | ||
<DbSchemaAssemblyInformationalVersion Condition="'$(DbSchemaAssemblyInformationalVersion)' == ''">$(MajorVersion).$(MinorVersion).$(PatchVersion).0-$(GitCommitHash)-$(GitBranchName)</DbSchemaAssemblyInformationalVersion> | ||
</PropertyGroup> | ||
|
||
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)" | ||
Regex="AssemblyVersion\s*\(\s*"(\d+)\.(\d+)(\.(\d+)\.(\d+)|\.*)"\s*\)" | ||
ReplacementText="AssemblyVersion("$(DbSchemaAssemblyVersion)")" | ||
Condition=" '$(DbSchemaAssemblyVersion)' != ''" /> | ||
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)" | ||
Regex="AssemblyFileVersion\s*\(\s*"(\d+)\.(\d+)(\.(\d+)\.(\d+)|\.*)"\s*\)" | ||
ReplacementText="AssemblyFileVersion("$(DbSchemaAssemblyFileVersion)")" | ||
Condition=" '$(DbSchemaAssemblyFileVersion)' != ''" /> | ||
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)" | ||
Regex="AssemblyInformationalVersion\s*\(\s*"[^"]*"\s*\)" | ||
ReplacementText="AssemblyInformationalVersion("$(DbSchemaAssemblyInformationalVersion)")" | ||
Condition=" '$(DbSchemaAssemblyInformationalVersion)' != ''" /> | ||
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)" | ||
Regex="AssemblyCopyright\s*\(\s*"[^"]*"\s*\)" | ||
ReplacementText="AssemblyCopyright("$(DbSchemaAssemblyCopyright)")" | ||
Condition=" '$(DbSchemaAssemblyCopyright)' != ''" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("DbSchema.Version")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("DbSchema.Version")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("bab0fe7f-57ae-4b43-9acf-ecc4a7e155bc")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] | ||
[assembly: AssemblyInformationalVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters