Skip to content

Commit

Permalink
DBS-7 : Release version 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
znamenap committed Jan 31, 2021
1 parent 2590280 commit 75ecb4b
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 4 deletions.
9 changes: 8 additions & 1 deletion default.proj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
<TargetConnectionString>Data Source=$(SchemaBuildSQLServer)%3BInitial Catalog=$(SchemaBuildDatabase)%3BIntegrated Security=True%3BPersist Security Info=False%3BPooling=False%3BMultipleActiveResultSets=False%3BConnect Timeout=60%3BEncrypt=False%3BTrustServerCertificate=False</TargetConnectionString>
<MainBuildEnabled>True</MainBuildEnabled>
<SchemaBuildEnabled>True</SchemaBuildEnabled>
<ProductFileVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</ProductFileVersion>
<ProductFileVersion Condition="'$(ProductFileVersion)' == ''">$(MajorVersion).$(MinorVersion).$(PatchVersion)</ProductFileVersion>
<DacVersion Condition="'$(DacVersion)' == ''">$(MajorVersion).$(MinorVersion).$(PatchVersion).0</DacVersion>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -60,8 +61,14 @@
<Value>False</Value>
</ConnectionStringItem>
</ItemGroup>
<ItemGroup>
<DbSchemaAssemblyInfoFile Condition=" '$(DbSchemaAssemblyInfoFile)' == '' "
Include="$(RootDirectory)\sources\**\AssemblyInfo.cs" />
</ItemGroup>

<Import Project="$(RootDirectory)\sources\configuration\build\nuget\DbSchema.Version.NuGetPack.targets" />
<Import Project="$(RootDirectory)\sources\configuration\build\targets\UpdateAssemblyInfoFile.targets" />
<Import Project="$(RootDirectory)\sources\configuration\build\targets\LoadActualGitInfo.targets" />

<Target Name="DBSchemaClean">
<RemoveDir Directories="$(OutputDirectory)" />
Expand Down
3 changes: 3 additions & 0 deletions sources/configuration/build/build.pssproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="nuget" />
<Folder Include="targets" />
<None Include="nuget\DbSchema.Version.NuGetPack.targets" />
<None Include="nuget\DbSchema.Version.nuspec" />
<None Include="targets\UpdateAssemblyInfoFile.targets" />
</ItemGroup>
<ItemGroup>
<Content Include="nuget\Readme-DbSchema.Version.txt" />
<Content Include="targets\LoadActualGitInfo.targets" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!--<Target Name="Build" />
Expand Down
16 changes: 16 additions & 0 deletions sources/configuration/build/targets/LoadActualGitInfo.targets
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 sources/configuration/build/targets/UpdateAssemblyInfoFile.targets
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*&quot;(\d+)\.(\d+)(\.(\d+)\.(\d+)|\.*)&quot;\s*\)"
ReplacementText="AssemblyVersion(&quot;$(DbSchemaAssemblyVersion)&quot;)"
Condition=" '$(DbSchemaAssemblyVersion)' != ''" />
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)"
Regex="AssemblyFileVersion\s*\(\s*&quot;(\d+)\.(\d+)(\.(\d+)\.(\d+)|\.*)&quot;\s*\)"
ReplacementText="AssemblyFileVersion(&quot;$(DbSchemaAssemblyFileVersion)&quot;)"
Condition=" '$(DbSchemaAssemblyFileVersion)' != ''" />
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)"
Regex="AssemblyInformationalVersion\s*\(\s*&quot;[^&quot;]*&quot;\s*\)"
ReplacementText="AssemblyInformationalVersion(&quot;$(DbSchemaAssemblyInformationalVersion)&quot;)"
Condition=" '$(DbSchemaAssemblyInformationalVersion)' != ''" />
<RegexUpdateFile Files="@(DbSchemaAssemblyInfoFile)"
Regex="AssemblyCopyright\s*\(\s*&quot;[^&quot;]*&quot;\s*\)"
ReplacementText="AssemblyCopyright(&quot;$(DbSchemaAssemblyCopyright)&quot;)"
Condition=" '$(DbSchemaAssemblyCopyright)' != ''" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DbSchema.Version.Contributors")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -34,3 +34,4 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ModelStatisticsEnabled>True</ModelStatisticsEnabled>
<UpdateReportEnabled>True</UpdateReportEnabled>
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
Expand Down
37 changes: 37 additions & 0 deletions sources/schema/DbSchema.Version/AssemblyInfo.cs
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")]
4 changes: 4 additions & 0 deletions sources/schema/DbSchema.Version/DbSchema.Version.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<IncludeSchemaNameInFileName>False</IncludeSchemaNameInFileName>
<DefaultSchema>schema_version</DefaultSchema>
<GenerateCreateScript>True</GenerateCreateScript>
<DacVersion Condition=" '$(DacVersion)' == ''" >1.0.0.0</DacVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
Expand Down Expand Up @@ -121,4 +122,7 @@
<DatabaseVariableLiteralValue>master</DatabaseVariableLiteralValue>
</ArtifactReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
</Project>

0 comments on commit 75ecb4b

Please sign in to comment.