Skip to content

Commit

Permalink
Merge pull request #239 from zarunbal/Development
Browse files Browse the repository at this point in the history
Release 1.9.0
  • Loading branch information
Hirogen authored Jul 20, 2022
2 parents 06b75d5 + 1adf498 commit 0516a61
Show file tree
Hide file tree
Showing 189 changed files with 4,204 additions and 4,091 deletions.
6 changes: 6 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
assembly-versioning-scheme: MajorMinorPatchTag
mode: ContinuousDelivery
branches: {}
ignore:
sha: []
merge-message-formats: {}
9 changes: 9 additions & 0 deletions appveyor.gitversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
install:
- choco install gitversion.portable -pre -y

before_build:
- nuget restore
- ps: gitversion /l console /output buildserver /updateAssemblyInfo

build:
project: scr\LogExpert.sln
18 changes: 8 additions & 10 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.Build.Execution;
using Nuke.Common;
using Nuke.Common.BuildServers;
using Nuke.Common.CI.AppVeyor;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
Expand All @@ -17,13 +15,10 @@
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.NUnit;
using Nuke.Common.Utilities;
using Nuke.Common.Utilities.Collections;
using Nuke.GitHub;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.IO.TextTasks;
Expand All @@ -42,11 +37,13 @@ class Build : NukeBuild
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Test);

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] private readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[Solution] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion] readonly GitVersion GitVersion;
[GitVersion(UpdateBuildNumber = true)]
readonly Nuke.Common.Tools.GitVersion.GitVersion GitVersion;

AbsolutePath SourceDirectory => RootDirectory / "src";

Expand Down Expand Up @@ -80,15 +77,16 @@ Version Version
patch = AppVeyor.Instance.BuildNumber;
}

return new Version(1, 8, patch);
return new Version(1, 9, 0, patch);
}
}

[Parameter("Version string")]
string VersionString => $"{Version.Major}.{Version.Minor}.{Version.Build}";

[Parameter("Version Information string")]
string VersionInformationString => $"{VersionString}.Branch.{GitVersion.BranchName}.{GitVersion.Sha} {Configuration}";
//.Branch.{GitVersion.BranchName}.{GitVersion.Sha} removed for testing purpose
string VersionInformationString => $"{VersionString} {Configuration}";

[Parameter("Version file string")]
string VersionFileString => $"{Version.Major}.{Version.Minor}.0";
Expand Down
15 changes: 15 additions & 0 deletions build/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.ComponentModel;

using Nuke.Common.Tooling;

[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
public static Configuration Release = new Configuration { Value = nameof(Release) };

public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
}
95 changes: 49 additions & 46 deletions build/_build.csproj
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="chocolatey" Version="0.10.14" />
<PackageReference Include="GitVersion.CommandLine.DotNetCore" Version="5.0.1">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="chocolatey" Version="1.1.0" />
<PackageReference Include="GitVersion.CommandLine" Version="5.9.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="GitVersion.Core" Version="5.9.0" />
<PackageReference Include="NuGet.CommandLine" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NuGet.CommandLine" Version="5.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Nuke.Common" Version="0.21.2" />
<PackageReference Include="Nuke.GitHub" Version="1.5.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.10.0" />
</ItemGroup>

<ItemGroup>
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" />
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
<None Include="..\appveyor-release.yml" Link="appveyor-release.yml" />
<None Include="..\Build-DebugPack.ps1" Link="Build-DebugPack.ps1" />
<None Include="..\Build-ReleasePack.ps1" Link="Build-ReleasePack.ps1" />

<!-- Common build related files -->
<None Include="..\build.ps1" />
<None Include="..\build.sh" />
<None Include="..\.nuke" />
<None Include="..\global.json" Condition="Exists('..\global.json')" />
<None Include="..\nuget.config" Condition="Exists('..\nuget.config')" />
<None Include="..\azure-pipelines.yml" Condition="Exists('..\azure-pipelines.yml')" />
<None Include="..\Jenkinsfile" Condition="Exists('..\Jenkinsfile')" />
<None Include="..\appveyor.yml" Condition="Exists('..\appveyor.yml')" />
<None Include="..\.travis.yml" Condition="Exists('..\.travis.yml')" />
<None Include="..\GitVersion.yml" Condition="Exists('..\GitVersion.yml')" />
</ItemGroup>

</Project>
</PackageReference>
<PackageReference Include="Nuke.Common" Version="5.0.0" />
<PackageReference Include="Nuke.GitHub" Version="1.5.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
</ItemGroup>

<ItemGroup>
<NukeMetadata Include="**\*.json" Exclude="bin\**;obj\**" />
<NukeExternalFiles Include="**\*.*.ext" Exclude="bin\**;obj\**" />
<None Remove="*.csproj.DotSettings;*.ref.*.txt" />
<None Include="..\appveyor-release.yml" Link="appveyor-release.yml" />
<None Include="..\appveyor.gitversion.yml" Link="appveyor.gitversion.yml" />
<None Include="..\Build-DebugPack.ps1" Link="Build-DebugPack.ps1" />
<None Include="..\Build-ReleasePack.ps1" Link="Build-ReleasePack.ps1" />

<!-- Common build related files -->
<None Include="..\build.ps1" />
<None Include="..\build.sh" />
<None Include="..\.nuke" />
<None Include="..\global.json" Condition="Exists('..\global.json')" />
<None Include="..\nuget.config" Condition="Exists('..\nuget.config')" />
<None Include="..\azure-pipelines.yml" Condition="Exists('..\azure-pipelines.yml')" />
<None Include="..\Jenkinsfile" Condition="Exists('..\Jenkinsfile')" />
<None Include="..\appveyor.yml" Condition="Exists('..\appveyor.yml')" />
<None Include="..\.travis.yml" Condition="Exists('..\.travis.yml')" />
<None Include="..\GitVersion.yml" Condition="Exists('..\GitVersion.yml')" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/ColumnizerLib.UnitTests/ColumnizerLib.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
<Version>3.13.3</Version>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter">
<Version>3.15.1</Version>
<Version>4.2.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
7 changes: 1 addition & 6 deletions src/ColumnizerLib/IAutoLogLineColumnizerCallback.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LogExpert
namespace LogExpert
{
public interface IAutoLogLineColumnizerCallback
{
Expand Down
29 changes: 11 additions & 18 deletions src/GlassfishColumnizer/GlassfishColumnizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ internal class XmlConfig : IXmlLogConfiguration

public string Stylesheet { get; } = null;

public string[] Namespace
{
get { return null; }
}
public string[] Namespace => null;

#endregion
}
Expand Down Expand Up @@ -135,7 +132,7 @@ public IColumnizedLogLine SplitLine(ILogLineColumnizerCallback callback, ILogLin
Column timestmp = columns[0];

string[] cols;
cols = temp.Split(this.trimChars, COLUMN_COUNT, StringSplitOptions.None);
cols = temp.Split(trimChars, COLUMN_COUNT, StringSplitOptions.None);

if (cols.Length != COLUMN_COUNT)
{
Expand All @@ -159,12 +156,12 @@ public bool IsTimeshiftImplemented()

public void SetTimeOffset(int msecOffset)
{
this.timeOffset = msecOffset;
timeOffset = msecOffset;
}

public int GetTimeOffset()
{
return this.timeOffset;
return timeOffset;
}

public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine logLine)
Expand Down Expand Up @@ -198,16 +195,12 @@ public DateTime GetTimestamp(ILogLineColumnizerCallback callback, ILogLine logLi
try
{
// convert glassfish timestamp into a readable format:
DateTime timestamp;
if (DateTime.TryParseExact(value, DATETIME_FORMAT, cultureInfo,
System.Globalization.DateTimeStyles.None, out timestamp))
if (DateTime.TryParseExact(value, DATETIME_FORMAT, cultureInfo, DateTimeStyles.None, out DateTime timestamp))
{
return timestamp.AddMilliseconds(this.timeOffset);
}
else
{
return DateTime.MinValue;
return timestamp.AddMilliseconds(timeOffset);
}

return DateTime.MinValue;
}
catch (Exception)
{
Expand All @@ -221,11 +214,11 @@ public void PushValue(ILogLineColumnizerCallback callback, int column, string va
{
try
{
DateTime newDateTime = DateTime.ParseExact(value, DATETIME_FORMAT_OUT, this.cultureInfo);
DateTime oldDateTime = DateTime.ParseExact(oldValue, DATETIME_FORMAT_OUT, this.cultureInfo);
DateTime newDateTime = DateTime.ParseExact(value, DATETIME_FORMAT_OUT, cultureInfo);
DateTime oldDateTime = DateTime.ParseExact(oldValue, DATETIME_FORMAT_OUT, cultureInfo);
long mSecsOld = oldDateTime.Ticks / TimeSpan.TicksPerMillisecond;
long mSecsNew = newDateTime.Ticks / TimeSpan.TicksPerMillisecond;
this.timeOffset = (int) (mSecsNew - mSecsOld);
timeOffset = (int) (mSecsNew - mSecsOld);
}
catch (FormatException)
{
Expand Down
2 changes: 1 addition & 1 deletion src/JsonColumnizer/JsonColumnizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.2</Version>
<Version>13.0.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion src/JsonCompactColumnizer/JsonCompactColumnizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.2</Version>
<Version>13.0.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
4 changes: 3 additions & 1 deletion src/LogExpert.Tests/ColumnizerPickerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using LogExpert.Classes;
using LogExpert.Classes.Log;
using LogExpert.Entities;

namespace LogExpert.Tests
{
Expand Down
1 change: 1 addition & 0 deletions src/LogExpert.Tests/DateFormatParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Globalization;
using System.Linq;
using LogExpert.Classes.DateTimeParser;

namespace LogExpert.Tests
{
Expand Down
8 changes: 3 additions & 5 deletions src/LogExpert.Tests/Extensions/EnumerableTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LogExpert.Extensions;
using NUnit.Framework;

namespace LogExpert.Tests.Extensions
Expand All @@ -21,15 +19,15 @@ public void Extensions_IsEmpty_NullArray()
[Test]
public void Extensions_IsEmpty_EmptyArray()
{
object[] arrayObject = new object[0];
object[] arrayObject = Array.Empty<object>();

Assert.IsTrue(arrayObject.IsEmpty());
}

[Test]
public void Extensions_IsEmpty_FilledArray()
{
object[] arrayObject = new[] {new object()};
object[] arrayObject = {new object()};

Assert.IsFalse(arrayObject.IsEmpty());
}
Expand Down
40 changes: 40 additions & 0 deletions src/LogExpert.Tests/JSONSaveTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.IO;
using LogExpert.Config;
using Newtonsoft.Json;
using NUnit.Framework;

namespace LogExpert.Tests
{
[TestFixture]
public class JSONSaveTest
{
[Test(Author = "Hirogen", Description = "Save Options as JSON and Check if the written file can be cast again into the settings object")]
public void SaveOptionsAsJSON()
{
ConfigManager.Settings.alwaysOnTop = true;
ConfigManager.Save(SettingsFlags.All);
string configDir = ConfigManager.ConfigDir;
string settingsFile = configDir + "\\settings.json";

Settings settings = null;

Assert.DoesNotThrow(CastSettings);
Assert.NotNull(settings);
Assert.True(settings.alwaysOnTop);

ConfigManager.Settings.alwaysOnTop = false;
ConfigManager.Save(SettingsFlags.All);

settings = null;
Assert.DoesNotThrow(CastSettings);
Assert.NotNull(settings);
Assert.False(settings.alwaysOnTop);


void CastSettings()
{
settings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText(settingsFile));
}
}
}
}
Loading

0 comments on commit 0516a61

Please sign in to comment.