Skip to content

Commit cb7a6ed

Browse files
committed
Remove CliFx references and update exception handling in BuildWorker; add pragma warnings in test files.
1 parent a13dddc commit cb7a6ed

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

ebuild.Tests/Unit/CliParserConverterTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using NUnit.Framework;
22
using System.Collections.Generic;
33
using ebuild.cli;
4-
4+
#pragma warning disable CS0649
55
namespace ebuild.Tests.Unit
66
{
77
[TestFixture]
@@ -42,8 +42,10 @@ public void Dictionary_values_are_converted_to_int()
4242
parser.Parse(new[] { "cmd", "--map=foo=42", "--map=bar=7" });
4343
parser.ApplyParsedToCommands();
4444
var root = (TestDictRoot)parser.currentCommandChain.First!.Value;
45-
Assert.That(root.Map.ContainsKey("foo") && root.Map["foo"] == 42);
46-
Assert.That(root.Map.ContainsKey("bar") && root.Map["bar"] == 7);
45+
Assert.That(root.Map!.ContainsKey("foo") && root.Map["foo"] == 42);
46+
Assert.That(root.Map!.ContainsKey("bar") && root.Map["bar"] == 7);
4747
}
4848
}
4949
}
50+
51+
#pragma warning restore CS0649

ebuild.Tests/Unit/CliParserSubcommandTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using NUnit.Framework;
22
using ebuild.cli;
3-
3+
#pragma warning disable CS0649
44
namespace ebuild.Tests.Unit
55
{
66
[TestFixture]
@@ -94,3 +94,4 @@ public void Nested_subcommand_opt_out_prevents_registration()
9494
}
9595
}
9696
}
97+
#pragma warning restore CS0649

ebuild.Tests/Unit/CliParserUnitTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using NUnit.Framework;
22
using System;
33
using ebuild.cli;
4-
4+
#pragma warning disable CS0649 // Field is never assigned to
55
namespace ebuild.Tests.Unit
66
{
77
[TestFixture]
@@ -119,3 +119,4 @@ public void Short_option_attached_quoted_value_with_spaces_parses()
119119
}
120120
}
121121
}
122+
#pragma warning restore CS0649

ebuild/EBuild.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Reflection;
22
using System.Text;
3-
using CliFx;
43
using ebuild.api;
54
using ebuild.api.Toolchain;
65
using ebuild.cli;

ebuild/Modules/BuildGraph/BuildWorker.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using CliFx.Exceptions;
21
using ebuild.api;
32
using ebuild.BuildGraph;
43
using Microsoft.Extensions.Logging;
@@ -29,7 +28,7 @@ public async Task WorkOnNodesAsync(List<Node> nodes, CancellationToken cancellat
2928
catch (Exception exception)
3029
{
3130
// If there was an error promote it to clifx exception
32-
throw new CliFxException($"Pre-build step \"{step.Name}\" failed: {exception.Message}", 1, false, exception);
31+
throw new Exception($"Pre-build step \"{step.Name}\" failed: {exception.Message}", exception);
3332
}
3433
}
3534
}
@@ -57,10 +56,8 @@ await Parallel.ForEachAsync(
5756
if (exceptions.Count > 0)
5857
{
5958
// Aggregate all exceptions and throw as CliFxException
60-
throw new CliFxException(
59+
throw new Exception(
6160
$"Compilation of {Module.Name} failed with {exceptions.Count} source file uncompiled(s): {string.Join("; ", exceptions.Select(e => e.Message))}",
62-
1,
63-
false,
6461
new AggregateException(exceptions)
6562
);
6663
}
@@ -75,7 +72,7 @@ await Parallel.ForEachAsync(
7572
}
7673
catch (Exception ex)
7774
{
78-
throw new CliFxException($"Linking failed: {ex.Message}", 1, false, ex);
75+
throw new Exception($"Linking failed: {ex.Message}", ex);
7976
}
8077
}
8178
}
@@ -88,7 +85,7 @@ await Parallel.ForEachAsync(
8885
}
8986
catch (Exception ex)
9087
{
91-
throw new CliFxException($"Copying shared library failed: {ex.Message}", 1, false, ex);
88+
throw new Exception($"Copying shared library failed: {ex.Message}", ex);
9289
}
9390
}
9491
// 3rd run additional dependency nodes non-parallel
@@ -100,7 +97,7 @@ await Parallel.ForEachAsync(
10097
}
10198
catch (Exception ex)
10299
{
103-
throw new CliFxException($"Processing additional dependency failed: {ex.Message}", 1, false, ex);
100+
throw new Exception($"Processing additional dependency failed: {ex.Message}", ex);
104101
}
105102
}
106103

@@ -116,7 +113,7 @@ await Parallel.ForEachAsync(
116113
catch (Exception exception)
117114
{
118115
// If there was an error promote it to clifx exception
119-
throw new CliFxException($"Post-build step \"{step.Name}\" failed: {exception.Message}", 1, false, exception);
116+
throw new Exception($"Post-build step \"{step.Name}\" failed: {exception.Message}", exception);
120117
}
121118
}
122119

ebuild/ebuild.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="CliFx" Version="2.3.6" />
1110
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.9" />
1211
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
1312
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />

0 commit comments

Comments
 (0)