Moved pre-build auto gen file to Resources folder.

Improved builddate generation
This commit is contained in:
Martijn Scheepers
2020-09-21 15:07:14 +02:00
parent 2426d49f22
commit 438c294a11
7 changed files with 29 additions and 45 deletions

10
.gitignore vendored
View File

@@ -6,9 +6,9 @@ Arrestanten_planbord/DataStore
/Arrestanten_planbord/logs
/Arrestanten_planbord.UnitTest/obj
/Arrestanten_planbord.UnitTest/bin
/Arrestanten_planbord/changelog.txt
/Arrestanten_planbord/Commit.txt
/Arrestanten_planbord/CommitDate.txt
/Arrestanten_planbord/Tag.txt
DataStoreTest
/Arrestanten_planbord/Buildtime.txt
/Arrestanten_planbord/Resources/BuildDate.txt
/Arrestanten_planbord/Resources/ChangeLog.txt
/Arrestanten_planbord/Resources/Commit.txt
/Arrestanten_planbord/Resources/CommitDate.txt
/Arrestanten_planbord/Resources/Tag.txt

View File

@@ -93,7 +93,7 @@
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo PREBUILDSTEP for $(ProjectName)&#xD;&#xA;git rev-parse --short HEAD &gt; &quot;$(ProjectDir)\Commit.txt&quot;&#xD;&#xA;git log -1 --pretty=format:&quot;%25%25cd&quot; --date=format:&quot;%25%25d-%25%25m-%25%25Y %25%25H:%25%25M:%25%25S&quot; &gt; &quot;$(ProjectDir)\CommitDate.txt&quot;&#xD;&#xA;git describe --tags --dirty &gt; &quot;$(ProjectDir)\Tag.txt&quot;&#xD;&#xA;git log --pretty=format:&quot;%25%25ad - %25%25d %25%25s&quot; --date=format:&quot;%25%25d-%25%25m-%25%25Y %25%25H:%25%25M:%25%25S&quot; &gt; &quot;$(ProjectDir)\changelog.txt&quot;&#xD;&#xA;date /t &gt; &quot;$(ProjectDir)\Buildtime.txt&quot;&#xD;&#xA;time /t &gt;&gt; &quot;$(ProjectDir)\Buildtime.txt&quot;&#xD;&#xA;" />
<Exec Command="echo PREBUILDSTEP for $(ProjectName)&#xD;&#xA;git rev-parse --short HEAD &gt; &quot;$(ProjectDir)\Resources\Commit.txt&quot;&#xD;&#xA;git log -1 --pretty=format:&quot;%25%25cd&quot; --date=format:&quot;%25%25d-%25%25m-%25%25Y %25%25H:%25%25M:%25%25S&quot; &gt; &quot;$(ProjectDir)\Resources\CommitDate.txt&quot;&#xD;&#xA;git describe --tags --dirty &gt; &quot;$(ProjectDir)\Resources\Tag.txt&quot;&#xD;&#xA;git log --pretty=format:&quot;%25%25ad - %25%25d %25%25s&quot; --date=format:&quot;%25%25d-%25%25m-%25%25Y %25%25H:%25%25M:%25%25S&quot; &gt; &quot;$(ProjectDir)\Resources\ChangeLog.txt&quot;&#xD;&#xA;echo %25date%25 %25time%25 &gt; &quot;$(ProjectDir)\Resources\BuildDate.txt&quot;&#xD;&#xA;" />
</Target>
<Target Name="PostBuild" BeforeTargets="PostBuildEvent">

View File

@@ -1,6 +1,4 @@
using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace Arrestanten_planbord.Helpers
{
@@ -12,14 +10,8 @@ namespace Arrestanten_planbord.Helpers
public static string GetCommitDate() => Properties.Resources.CommitDate;
public static string GetChangelog() => Properties.Resources.changelog;
public static string GetChangelog() => Properties.Resources.ChangeLog;
public static string GetBuildTime()
{
string str = Properties.Resources.Buildtime;
Regex newline = new Regex("\r\n");
str = newline.Replace(str, "- ", 1);
return newline.Replace(str, string.Empty, 1);
}
public static string GetBuildDate() => Properties.Resources.BuildDate.Replace("\r\n", string.Empty);
}
}

View File

@@ -23,7 +23,7 @@
<MatDivider></MatDivider>
<p>Arrestanten bord version = <a href="@Arrestanten_planbord.Helpers.GitHelper.GetGitVersionLink()">@Arrestanten_planbord.Helpers.GitHelper.GetGitVersion()</a></p>
<p>Arrestanten bord Commit date = @Arrestanten_planbord.Helpers.GitHelper.GetCommitDate()</p>
<p>Arrestanten bord Build date = @Arrestanten_planbord.Helpers.GitHelper.GetBuildTime()</p>
<p>Arrestanten bord Build date = @Arrestanten_planbord.Helpers.GitHelper.GetBuildDate()</p>
</MatBody1>
</MatCardContent>
</MatCard>

View File

@@ -20,14 +20,8 @@ namespace Arrestanten_planbord
public static void Main(string[] args)
{
//var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
//Console.WriteLine("configpath = " + configPath);
//IConfiguration configuration = new ConfigurationBuilder().AddJsonFile(configPath).Build();
//Console.WriteLine("Config File Path = " + Configuration.);
Log.Logger = new LoggerConfiguration().ReadFrom.Configuration(Configuration).Enrich.FromLogContext().CreateLogger();
Log.Information($"Starting {Assembly.GetEntryAssembly().GetName().Name} {Helpers.GitHelper.GetGitVersion()} build {Helpers.GitHelper.GetBuildTime()}");
Log.Information($"Starting {Assembly.GetEntryAssembly().GetName().Name} {Helpers.GitHelper.GetGitVersion()} build {Helpers.GitHelper.GetBuildDate()}");
try
{

View File

@@ -61,36 +61,34 @@ namespace Arrestanten_planbord.Properties {
}
/// <summary>
/// Looks up a localized string similar to ma 21-09-2020
///14:13
/// Looks up a localized string similar to ma 21-09-2020 14:59:18,87
///.
/// </summary>
internal static string Buildtime {
internal static string BuildDate {
get {
return ResourceManager.GetString("Buildtime", resourceCulture);
return ResourceManager.GetString("BuildDate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 21-09-2020 08:40:09 - (HEAD -&gt; master) Show culture in system information
/// Looks up a localized string similar to 21-09-2020 14:38:04 - (HEAD -&gt; master, origin/master) Added install/remove service scripts. Project uses service. Buildtime added
///21-09-2020 08:40:09 - Show culture in system information
///21-09-2020 08:39:40 - Add useWindowsService
///21-09-2020 08:09:26 - (origin/master) Keep file in publish folder
///21-09-2020 08:09:26 - Keep file in publish folder
///18-09-2020 08:06:41 - Removed unused mDNS files
///16-09-2020 15:08:13 - HealthStatusIcon.razor code
///16-09-2020 09:23:33 - Removed folders from project
///16-09-2020 09:23:09 - Publish profiles to .net 5
///16-09-2020 09:22:41 - reworked health checks
///15-09-2020 10:29:26 - Remove TimerService.cs
///15-09-2020 10 [rest of string was truncated]&quot;;.
///16-09-202 [rest of string was truncated]&quot;;.
/// </summary>
internal static string changelog {
internal static string ChangeLog {
get {
return ResourceManager.GetString("changelog", resourceCulture);
return ResourceManager.GetString("ChangeLog", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 80a08de
/// Looks up a localized string similar to 2426d49
///.
/// </summary>
internal static string Commit {
@@ -100,7 +98,7 @@ namespace Arrestanten_planbord.Properties {
}
/// <summary>
/// Looks up a localized string similar to 21-09-2020 08:40:09.
/// Looks up a localized string similar to 21-09-2020 14:38:04.
/// </summary>
internal static string CommitDate {
get {
@@ -109,7 +107,7 @@ namespace Arrestanten_planbord.Properties {
}
/// <summary>
/// Looks up a localized string similar to 0.1-88-g80a08de-dirty
/// Looks up a localized string similar to 0.1-89-g2426d49-dirty
///.
/// </summary>
internal static string Tag {

View File

@@ -118,19 +118,19 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Buildtime" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Buildtime.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
<data name="BuildDate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BuildDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="changelog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\changelog.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
<data name="ChangeLog" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ChangeLog.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="Commit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Commit.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
<value>..\Resources\Commit.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="CommitDate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\CommitDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
<value>..\Resources\CommitDate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="Tag" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Tag.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
<value>..\Resources\Tag.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>