Skip to content

Commit b8658f4

Browse files
authored
Update dependencies (#11)
This commit updates dependencies and updates build in line with changes in System.Commandline. Pin FluentAssertions to 7.0.0
1 parent 0274645 commit b8658f4

2 files changed

Lines changed: 47 additions & 32 deletions

File tree

Directory.Packages.props

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111
<!-- Test -->
1212
<ItemGroup>
13-
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
14-
<PackageVersion Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.14.0" />
15-
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
13+
<PackageVersion Include="BenchmarkDotNet" Version="0.15.4" />
14+
<PackageVersion Include="BenchmarkDotNet.Diagnostics.dotTrace" Version="0.15.4" />
15+
<PackageVersion Include="FluentAssertions" Version="[7.0.0]" />
1616
<PackageVersion Include="LanguageDetection.Ai" Version="1.1.0" />
17-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
17+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1818
<PackageVersion Include="NTextCat" Version="0.3.65" />
1919
<PackageVersion Include="StrongNamer" Version="0.2.5" />
2020
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
2121
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
22-
<PackageVersion Include="xunit" Version="2.9.2" />
23-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
22+
<PackageVersion Include="xunit" Version="2.9.3" />
23+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
2424
</ItemGroup>
2525

2626
<!-- Build -->
2727
<ItemGroup>
28-
<PackageVersion Include="Bullseye" Version="5.0.0" />
29-
<PackageVersion Include="Fractions" Version="8.0.4" />
28+
<PackageVersion Include="Bullseye" Version="6.0.0" />
29+
<PackageVersion Include="Fractions" Version="8.3.2" />
3030
<PackageVersion Include="SimpleExec" Version="12.0.0" />
31-
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
31+
<PackageVersion Include="System.CommandLine" Version="2.0.0-rc.1.25451.107" />
3232
<PackageVersion Include="MinVer" Version="6.0.0" />
3333
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
3434
<PackageVersion Include="ConfigureAwaitChecker.Analyzer" Version="5.0.0.1" />

build/Build/Program.cs

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@
99
const string packOutput = "nuget";
1010
const string reportOutput = "accuracy-reports";
1111

12-
var language = new Option<string[]>(["--language"], "languages to generate an accuracy report for")
12+
var language = new Option<string[]>("--language")
1313
{
1414
Arity = ArgumentArity.ZeroOrMore,
15+
Description = "languages to generate an accuracy report for"
1516
};
1617

17-
var detector = new Option<string[]>(["--implementation"], "implementations to generate an accuracy report for")
18+
var detector = new Option<string[]>("--implementation")
1819
{
1920
Arity = ArgumentArity.ZeroOrMore,
21+
Description = "implementations to generate an accuracy report for"
2022
};
21-
detector.FromAmong("Lingua", "NTextCat", "LanguageDetection");
23+
detector.AcceptOnlyFromAmong("Lingua", "NTextCat", "LanguageDetection");
2224

23-
var compare = new Option<bool>("--compare",
24-
"whether implementations should use the same subset of supported languages when generating an accuracy report");
25+
var compare = new Option<bool>("--compare")
26+
{
27+
Description = "whether implementations should use the same subset of supported languages when generating an accuracy report"
28+
};
2529

2630
var cmd = new RootCommand
2731
{
@@ -36,11 +40,13 @@
3640
};
3741

3842
foreach (var (aliases, description) in Options.Definitions)
39-
cmd.Add(new Option<bool>(aliases.ToArray(), description));
43+
{
44+
var option = new Option<bool>(aliases[0], aliases.Skip(1).ToArray()) { Description = description };
45+
cmd.Add(option);
46+
}
4047

41-
cmd.SetHandler(async () =>
48+
cmd.SetAction(async (cmdLine) =>
4249
{
43-
var cmdLine = cmd.Parse(args);
4450
var tokens = cmdLine.CommandResult.Tokens.Select(token => token.Value).ToList();
4551
var targets = new List<string>();
4652
var seen = false;
@@ -62,39 +68,39 @@
6268
targets.Add(t);
6369
}
6470

65-
var options = new Options(Options.Definitions.Select(d => (d.Aliases[0],
66-
cmdLine.GetValueForOption(cmd.Options.OfType<Option<bool>>().Single(o => o.HasAlias(d.Aliases[0]))))));
71+
var options = new Options(Options.Definitions.Select(d =>
72+
(d.Aliases[0], cmdLine.GetValue<bool>(d.Aliases[0]))));
6773

6874
Target(Restore, () =>
6975
{
7076
Run("dotnet", "restore");
7177
Run("dotnet", "tool restore");
7278
});
7379

74-
Target(CleanBuildOutput, DependsOn(Restore), () =>
80+
Target(CleanBuildOutput, [Restore], () =>
7581
{
7682
Run("dotnet", "clean -c Release -v m --nologo");
7783
});
7884

79-
Target(Format, DependsOn(Restore), () =>
85+
Target(Format, [Restore], () =>
8086
{
8187
Run("dotnet", "format");
8288
});
8389

84-
Target(BuildSln, DependsOn(CleanBuildOutput, Format), () =>
90+
Target(BuildSln, [CleanBuildOutput, Format], () =>
8591
{
8692
Run("dotnet", "build -c Release --nologo");
8793
});
8894

89-
Target(Test, DependsOn(BuildSln), () =>
95+
Target(Test, [BuildSln], () =>
9096
{
9197
Run("dotnet", "test tests/Lingua.Tests -c Release --no-build --verbosity normal");
9298
});
9399

94-
Target(Report, DependsOn(CleanReportOutput, BuildSln), () =>
100+
Target(Report, [CleanReportOutput, BuildSln], () =>
95101
{
96102
var filter = new StringBuilder();
97-
var languages = cmdLine.GetValueForOption(language);
103+
var languages = cmdLine.GetValue(language);
98104
if (languages?.Length > 0)
99105
{
100106
foreach (var l in languages)
@@ -108,7 +114,7 @@
108114
}
109115
}
110116

111-
var detectors = cmdLine.GetValueForOption(detector);
117+
var detectors = cmdLine.GetValue(detector);
112118
if (detectors?.Length > 0)
113119
{
114120
if (filter.Length > 0)
@@ -131,7 +137,7 @@
131137
}
132138

133139
var additionalArgs = new StringBuilder();
134-
if (cmdLine.GetValueForOption(compare))
140+
if (cmdLine.GetValue(compare))
135141
additionalArgs.Append(" --environment TEST_COMPARE=\"true\"");
136142
if (filter.Length > 0)
137143
additionalArgs.Append($" --filter \"{filter}\" --environment TEST_FILTER=\"{filter}\"");
@@ -161,20 +167,29 @@
161167
Directory.Delete(packOutput, true);
162168
});
163169

164-
Target(Clean, DependsOn(CleanBuildOutput, CleanReportOutput, CleanPackOutput));
170+
Target(Clean, [CleanBuildOutput, CleanReportOutput, CleanPackOutput]);
165171

166-
Target(Pack, DependsOn(Clean, Format), () =>
172+
Target(Pack, [Clean, Format], () =>
167173
{
168174
var outputDir = Directory.CreateDirectory(packOutput);
169175
Run("dotnet", $"pack -c Release -o \"{outputDir.FullName}\" --nologo");
170176
});
171177

172-
Target(Default, DependsOn(Test));
178+
Target(Default, [Test]);
173179

174-
await RunTargetsAndExitAsync(targets, options, messageOnly: ex => ex is SimpleExec.ExitCodeException);
180+
try
181+
{
182+
await RunTargetsAndExitAsync(targets, options, messageOnly: ex => ex is SimpleExec.ExitCodeException);
183+
return 0;
184+
}
185+
catch
186+
{
187+
return 1;
188+
}
175189
});
176190

177-
return await cmd.InvokeAsync(args);
191+
var parseResult = cmd.Parse(args);
192+
return await parseResult.InvokeAsync();
178193

179194
internal static class BuildTargets
180195
{

0 commit comments

Comments
 (0)