Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jul 2, 2024
1 parent ed35118 commit 3e9fc27
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 28 deletions.
5 changes: 4 additions & 1 deletion CSharpInteractive.HostApi/Cmd/IPathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ namespace HostApi.Cmd;

internal interface IPathResolver
{
string Resolve(IHost host, string path, IPathResolver nextResolver);
string Resolve(
IHost host,
string path,
IPathResolver nextResolver);
}
1 change: 0 additions & 1 deletion CSharpInteractive.HostApi/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace HostApi;
/// <summary>
/// Runs an arbitrary executable with arguments and environment variables from the working directory.
/// </summary>
[ExcludeFromCodeCoverage]
[Target]
[DebuggerTypeProxy(typeof(CommandLineDebugView))]
public partial record CommandLine(
Expand Down
1 change: 1 addition & 0 deletions CSharpInteractive.HostApi/CommandLines.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// ReSharper disable InconsistentNaming
namespace HostApi;

[ExcludeFromCodeCoverage]
public partial record CommandLine: ICommandLine
{
public static CommandLine operator +(CommandLine command, string arg) => command.AddArgs(arg);
Expand Down
10 changes: 8 additions & 2 deletions CSharpInteractive.HostApi/IBuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ namespace HostApi;

public interface IBuildRunner
{
IBuildResult Run(ICommandLine commandLine, Action<BuildMessage>? handler = default, TimeSpan timeout = default);
IBuildResult Run(
ICommandLine commandLine,
Action<BuildMessage>? handler = default,
TimeSpan timeout = default);

Task<IBuildResult> RunAsync(ICommandLine commandLine, Action<BuildMessage>? handler = default, CancellationToken cancellationToken = default);
Task<IBuildResult> RunAsync(
ICommandLine commandLine,
Action<BuildMessage>? handler = default,
CancellationToken cancellationToken = default);
}
10 changes: 8 additions & 2 deletions CSharpInteractive.HostApi/ICommandLineRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ namespace HostApi;

public interface ICommandLineRunner
{
int? Run(ICommandLine commandLine, Action<Output>? handler = default, TimeSpan timeout = default);
int? Run(
ICommandLine commandLine,
Action<Output>? handler = default,
TimeSpan timeout = default);

Task<int?> RunAsync(ICommandLine commandLine, Action<Output>? handler = default, CancellationToken cancellationToken = default);
Task<int?> RunAsync(
ICommandLine commandLine,
Action<Output>? handler = default,
CancellationToken cancellationToken = default);
}
3 changes: 0 additions & 3 deletions CSharpInteractive.HostApi/IProperties.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
namespace HostApi;

using System.Diagnostics.Contracts;

public interface IProperties : IEnumerable<KeyValuePair<string, string>>
{
[Pure]
int Count { get; }

string this[string key] { get; set; }
Expand Down
6 changes: 5 additions & 1 deletion CSharpInteractive.HostApi/Output.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
namespace HostApi;

[Target]
public readonly record struct Output(IStartInfo StartInfo, bool IsError, string Line, int ProcessId)
public readonly record struct Output(
IStartInfo StartInfo,
bool IsError,
string Line,
int ProcessId)
{
public override string ToString() => IsError ? $"ERR {Line}" : Line;
}
4 changes: 2 additions & 2 deletions CSharpInteractive.Tests/Integration/ScriptRunTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace CSharpInteractive.Tests.Integration;
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
public class ScriptRunTests
{
private const int InitialLinesCount = 3;
private const int InitialLinesCount = 4;

[Fact]
public void ShouldRunEmptyScript()
Expand Down Expand Up @@ -166,7 +166,7 @@ public void ShouldSupportWarning()
// Then
result.ExitCode.ShouldBe(0, result.ToString());
result.StdErr.ShouldBeEmpty(result.ToString());
result.StdOut.Count.ShouldBe(InitialLinesCount + 3, result.ToString());
result.StdOut.Count.ShouldBe(InitialLinesCount + 4, result.ToString());
result.StdOut.Contains("My warning").ShouldBeTrue(result.ToString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace CSharpInteractive.Tests.Integration;
[Trait("Integration", "true")]
public class ScriptRunTeamCityScriptRunTests
{
private const int InitialMessagesCount = 3;
private const int InitialMessagesCount = 4;

[Fact]
public void ShouldAddSystemNamespace()
Expand Down
31 changes: 17 additions & 14 deletions CSharpInteractive/StatisticsPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ internal class StatisticsPresenter(ILog<StatisticsPresenter> log) : IPresenter<I
public void Show(IStatistics statistics)
{
log.Info();
log.Info(new Text("Summary:", Color.Header));

foreach (var processResult in statistics.ProcessResults)
{
log.Info(Text.Tab + processResult.Description);
}

foreach (var warning in statistics.Warnings)
{
log.Info(Text.Tab, new Text(warning, Color.Warning));
}

foreach (var error in statistics.Errors)
if (statistics.ProcessResults.Count > 0 || statistics.Warnings.Count > 0 || statistics.Errors.Count > 0)
{
log.Info(Text.Tab, new Text(error, Color.Error));
log.Info(new Text("Summary:", Color.Header));

foreach (var processResult in statistics.ProcessResults)
{
log.Info(Text.Tab + processResult.Description);
}

foreach (var warning in statistics.Warnings)
{
log.Info(Text.Tab, new Text(warning, Color.Warning));
}

foreach (var error in statistics.Errors)
{
log.Info(Text.Tab, new Text(error, Color.Error));
}
}

if (statistics.Warnings.Count > 0)
Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
</PropertyGroup>

<ItemGroup>
<CompilerVisibleProperty Include="PureDINamespace" />
<CompilerVisibleProperty Include="ImmutypeAPI" />
</ItemGroup>
</Project>

0 comments on commit 3e9fc27

Please sign in to comment.