Skip to content

Commit

Permalink
Splits up copyright text
Browse files Browse the repository at this point in the history
Git can change line endings depending on checkout settings, which in turn, changes the EOL markers in multi-line strings!

This made the unit tests depending on a consistent number of lines in the copyright text fail on Appveyor. I think. *fingers crossed*
  • Loading branch information
atruskie committed Feb 14, 2019
1 parent 9e9e56d commit 799a653
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions src/AnalysisPrograms/Production/MainEntryUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace AnalysisPrograms
using Production;
using Production.Arguments;
using Production.Parsers;
using static System.Environment;

public static partial class MainEntry
{
Expand Down Expand Up @@ -200,9 +201,10 @@ internal static void BeforeExecute(MainArgs main, CommandLineApplication applica

internal static void Copyright()
{
LoggedConsole.WriteLine($@"{Meta.Description} - version {BuildMetadata.VersionString} ({(InDEBUG ? "DEBUG" : "RELEASE")} build, {BuildMetadata.BuildDate})
Git branch-version: {BuildMetadata.GitBranch}-{BuildMetadata.GitCommit}, DirtyBuild:{BuildMetadata.IsDirty}, CI:{BuildMetadata.CiBuild}
Copyright {Meta.NowYear} {Meta.Organization}");
LoggedConsole.WriteLine(
$@"{Meta.Description} - version {BuildMetadata.VersionString} ({(InDEBUG ? "DEBUG" : "RELEASE")} build, {BuildMetadata.BuildDate}){NewLine}" +
$@"Git branch-version: {BuildMetadata.GitBranch}-{BuildMetadata.GitCommit}, DirtyBuild:{BuildMetadata.IsDirty}, CI:{BuildMetadata.CiBuild}{NewLine}" +
$@"Copyright {Meta.NowYear} {Meta.Organization}{NewLine}");
}

internal static void WarnIfDeveloperEntryUsed(string message = null)
Expand Down Expand Up @@ -323,7 +325,7 @@ internal static void PrintUsage(string message, Usages usageStyle, string comman

private static void AttachExceptionHandler()
{
Environment.ExitCode = ExceptionLookup.SpecialExceptionErrorLevel;
ExitCode = ExceptionLookup.SpecialExceptionErrorLevel;

AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
}
Expand Down Expand Up @@ -409,13 +411,13 @@ private static void CurrentDomainOnUnhandledException(object sender, UnhandledEx
{
// no don't exit, we want the exception to be raised to Window's Exception handling
// this will allow the debugger to appropriately break on the right line
Environment.ExitCode = returnCode;
ExitCode = returnCode;
}
else
{
// If debugger is not attached, we *do not* want to raise the error to the Windows level
// Everything has already been logged, just exit with appropriate errorlevel
Environment.Exit(returnCode);
Exit(returnCode);
}
}

Expand Down Expand Up @@ -445,8 +447,8 @@ private static void LogProgramStats()
var thisProcess = Process.GetCurrentProcess();
var stats = new
{
Platform = Environment.OSVersion.ToString(),
Environment.ProcessorCount,
Platform = OSVersion.ToString(),
ProcessorCount,
ExecutionTime = (DateTime.Now - thisProcess.StartTime).TotalSeconds,
PeakWorkingSet = thisProcess.PeakWorkingSet64,
};
Expand All @@ -463,12 +465,12 @@ private static void ModifyVerbosity(MainArgs arguments)

private static void ParseEnvirionemnt()
{
ApPlainLogging = bool.TryParse(Environment.GetEnvironmentVariable(ApPlainLoggingKey), out var plainLogging) && plainLogging;
ApPlainLogging = bool.TryParse(GetEnvironmentVariable(ApPlainLoggingKey), out var plainLogging) && plainLogging;

// default value is true
ApMetricRecording = !bool.TryParse(Environment.GetEnvironmentVariable(ApMetricsKey), out var parseMetrics) || parseMetrics;
ApMetricRecording = !bool.TryParse(GetEnvironmentVariable(ApMetricsKey), out var parseMetrics) || parseMetrics;

ApAutoAttach = bool.TryParse(Environment.GetEnvironmentVariable(ApAutoAttachKey), out var autoAttach) && autoAttach;
ApAutoAttach = bool.TryParse(GetEnvironmentVariable(ApAutoAttachKey), out var autoAttach) && autoAttach;
}

private static void PrintAggregateException(Exception ex, int depth = 0)
Expand Down
2 changes: 1 addition & 1 deletion tests/Acoustics.Test/TestHelpers/ConsoleRedirector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Dispose()
};
Console.SetOut(writer);

LoggedConsole.Write($"------CAPTURED CONSOLE OUTPUT ({this.Lines.Count} lines)--------\n{this.GetString()}");
Console.WriteLine($"------CAPTURED CONSOLE OUTPUT ({this.Lines.Count} lines)--------\n{this.GetString()}");
this.capturedOutput.Dispose();
}

Expand Down

0 comments on commit 799a653

Please sign in to comment.