Skip to content

Commit 554b0fb

Browse files
authored
Merge pull request #38 from AlamoEngine-Tools/develop
New Verifiers and improvements
2 parents 4eb6a1c + 95b30ac commit 554b0fb

258 files changed

Lines changed: 8737 additions & 6204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
# use publish for .NET Core
4949
run: dotnet publish ${{ env.TOOL_PROJ_PATH }} --configuration Release -f net10.0 --output ./releases/net10.0 /p:DebugType=None /p:DebugSymbols=false
5050
- name: Upload a Build Artifact
51-
uses: actions/upload-artifact@v6
51+
uses: actions/upload-artifact@v7
5252
with:
5353
name: Binary Releases
5454
path: ./releases
@@ -68,7 +68,7 @@ jobs:
6868
with:
6969
fetch-depth: 0
7070
submodules: recursive
71-
- uses: actions/download-artifact@v7
71+
- uses: actions/download-artifact@v8
7272
with:
7373
name: Binary Releases
7474
path: ./releases
@@ -103,7 +103,7 @@ jobs:
103103
# Change into the artifacts directory to avoid including the directory itself in the zip archive
104104
working-directory: ./releases/net10.0
105105
run: zip -r ../ModVerify-Net10.zip .
106-
- uses: dotnet/nbgv@v0.4.2
106+
- uses: dotnet/nbgv@v0.5.1
107107
id: nbgv
108108
- name: Create GitHub release
109109
# Create a GitHub release on push to main only

Directory.Build.props

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,17 @@
3333

3434
<ItemGroup>
3535
<PackageReference Update="SauceControl.InheritDoc" Version="2.0.2" />
36-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.102">
37-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38-
<PrivateAssets>all</PrivateAssets>
39-
</PackageReference>
36+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.201" PrivateAssets="All"/>
4037
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
4138
<PrivateAssets>all</PrivateAssets>
4239
<Version>3.9.50</Version>
4340
</PackageReference>
44-
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="" />
4541
</ItemGroup>
4642

4743
<ItemGroup Condition="'$(IsPackable)' == 'true'">
4844
<None Include="$(LicenseFile)" Pack="true" PackagePath=""/>
4945
<None Include="$(RepoRootPath)aet.png" Pack="true" PackagePath=""/>
46+
<None Include="$(RepoRootPath)README.md" Pack="true" PackagePath="" />
5047
</ItemGroup>
5148

5249
</Project>

aet.png

3.53 KB
Loading

src/ModVerify.CliApp/App/CreateBaselineAction.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
using AET.ModVerify.App.Settings;
33
using AET.ModVerify.App.Utilities;
44
using AET.ModVerify.Reporting;
5+
using AET.ModVerify.Reporting.Baseline;
56
using Microsoft.Extensions.DependencyInjection;
67
using Microsoft.Extensions.Logging;
78
using System;
8-
using System.Collections.Generic;
99
using System.IO.Abstractions;
1010
using System.Threading.Tasks;
1111

@@ -26,24 +26,22 @@ protected override void PrintAction(VerificationTarget target)
2626
Console.WriteLine();
2727
}
2828

29-
protected override async Task<int> ProcessVerifyFindings(
30-
VerificationTarget verificationTarget,
31-
IReadOnlyCollection<VerificationError> allErrors)
29+
protected override async Task<int> ProcessResult(VerificationResult result)
3230
{
3331
var baselineFactory = ServiceProvider.GetRequiredService<IBaselineFactory>();
34-
var baseline = baselineFactory.CreateBaseline(verificationTarget, Settings, allErrors);
32+
var baseline = baselineFactory.CreateBaseline(result.Target, Settings, result.Errors);
3533

3634
var fullPath = _fileSystem.Path.GetFullPath(Settings.NewBaselinePath);
3735
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId,
38-
"Writing Baseline to '{FullPath}' with {Number} findings", fullPath, allErrors.Count);
36+
"Writing Baseline to '{FullPath}' with {Number} findings", fullPath, result.Errors.Count);
3937

4038
await baselineFactory.WriteBaselineAsync(baseline, Settings.NewBaselinePath);
4139

4240
Logger?.LogDebug("Baseline successfully created.");
4341

4442
Console.WriteLine();
4543
Console.ForegroundColor = ConsoleColor.DarkGreen;
46-
Console.WriteLine($"Baseline for {verificationTarget.Name} created.");
44+
Console.WriteLine($"Baseline for {result.Target.Name} created.");
4745
Console.ResetColor();
4846

4947
return ModVerifyConstants.Success;

src/ModVerify.CliApp/App/ModVerifyApplicationAction.cs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.IO.Abstractions;
43
using System.Threading.Tasks;
54
using AET.ModVerify.App.GameFinder;
65
using AET.ModVerify.App.Reporting;
76
using AET.ModVerify.App.Settings;
87
using AET.ModVerify.App.TargetSelectors;
9-
using AET.ModVerify.Pipeline;
108
using AET.ModVerify.Reporting;
9+
using AET.ModVerify.Reporting.Baseline;
10+
using AET.ModVerify.Reporting.Suppressions;
1111
using AnakinRaW.ApplicationBase;
1212
using Microsoft.Extensions.DependencyInjection;
1313
using Microsoft.Extensions.Logging;
@@ -71,43 +71,55 @@ public async Task<int> ExecuteAsync()
7171

7272
PrintAction(verificationTarget);
7373

74-
var allErrors = await VerifyTargetAsync(verificationTarget)
74+
var verificationResult = await VerifyTargetAsync(verificationTarget)
7575
.ConfigureAwait(false);
7676

77-
return await ProcessVerifyFindings(verificationTarget, allErrors);
77+
return await ProcessResult(verificationResult);
7878
}
7979

80-
protected abstract Task<int> ProcessVerifyFindings(
81-
VerificationTarget verificationTarget,
82-
IReadOnlyCollection<VerificationError> allErrors);
80+
protected abstract Task<int> ProcessResult(VerificationResult result);
8381

8482
protected abstract VerificationBaseline GetBaseline(VerificationTarget verificationTarget);
8583

86-
private async Task<IReadOnlyCollection<VerificationError>> VerifyTargetAsync(VerificationTarget verificationTarget)
84+
private async Task<VerificationResult> VerifyTargetAsync(VerificationTarget verificationTarget)
8785
{
8886
var progressReporter = new VerifyConsoleProgressReporter(verificationTarget.Name, Settings.ReportSettings);
8987

9088
var baseline = GetBaseline(verificationTarget);
9189
var suppressions = GetSuppressions();
9290

93-
using var verifyPipeline = new GameVerifyPipeline(
94-
verificationTarget,
95-
Settings.VerifyPipelineSettings,
96-
progressReporter,
97-
new EngineInitializeProgressReporter(verificationTarget.Engine),
98-
baseline,
99-
suppressions,
100-
ServiceProvider);
101-
10291
try
10392
{
93+
var verifierService = ServiceProvider.GetRequiredService<IGameVerifierService>();
94+
10495
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Verifying '{Target}'...", verificationTarget.Name);
105-
await verifyPipeline.RunAsync().ConfigureAwait(false);
96+
97+
var verificationResult = await verifierService.VerifyAsync(
98+
verificationTarget,
99+
Settings.VerifierServiceSettings,
100+
baseline,
101+
suppressions,
102+
progressReporter,
103+
new EngineInitializeProgressReporter(verificationTarget.Engine));
104+
106105
progressReporter.Report(string.Empty, 1.0);
107-
}
108-
catch (OperationCanceledException)
109-
{
110-
Logger?.LogWarning(ModVerifyConstants.ConsoleEventId, "Verification stopped due to enabled failFast setting.");
106+
107+
switch (verificationResult.Status)
108+
{
109+
case VerificationCompletionStatus.CompletedFailFast:
110+
Logger?.LogWarning(ModVerifyConstants.ConsoleEventId, "Verification stopped due to enabled failFast setting.");
111+
break;
112+
case VerificationCompletionStatus.Cancelled:
113+
Logger?.LogWarning(ModVerifyConstants.ConsoleEventId, "Verification was cancelled.");
114+
break;
115+
case VerificationCompletionStatus.Completed:
116+
default:
117+
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Verification completed successfully.");
118+
break;
119+
}
120+
121+
return verificationResult;
122+
111123
}
112124
catch (Exception e)
113125
{
@@ -119,9 +131,6 @@ private async Task<IReadOnlyCollection<VerificationError>> VerifyTargetAsync(Ver
119131
{
120132
progressReporter.Dispose();
121133
}
122-
123-
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Finished verification");
124-
return verifyPipeline.FilteredErrors;
125134
}
126135

127136
private SuppressionList GetSuppressions()

src/ModVerify.CliApp/App/VerifyAction.cs

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using AET.ModVerify.App.Reporting;
22
using AET.ModVerify.App.Settings;
3+
using AET.ModVerify.App.Utilities;
34
using AET.ModVerify.Reporting;
45
using Microsoft.Extensions.Logging;
56
using System;
67
using System.Collections.Generic;
78
using System.Linq;
89
using System.Threading.Tasks;
9-
using AET.ModVerify.App.Utilities;
10+
using AET.ModVerify.Reporting.Reporters;
11+
using AET.ModVerify.Reporting.Baseline;
1012

1113
namespace AET.ModVerify.App;
1214

@@ -23,20 +25,27 @@ protected override void PrintAction(VerificationTarget target)
2325
Console.WriteLine();
2426
}
2527

26-
protected override async Task<int> ProcessVerifyFindings(
27-
VerificationTarget verificationTarget,
28-
IReadOnlyCollection<VerificationError> allErrors)
28+
protected override async Task<int> ProcessResult(VerificationResult result)
2929
{
3030
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Reporting Errors...");
31-
var reportBroker = new VerificationReportBroker(ServiceProvider);
32-
await reportBroker.ReportAsync(allErrors);
31+
var reportBroker = new VerificationReportBroker(CreateReporters(), ServiceProvider);
32+
33+
result = result with
34+
{
35+
Target = result.Target with
36+
{
37+
Location = result.Target.Location.MaskUsername()
38+
}
39+
};
40+
41+
await reportBroker.ReportAsync(result);
3342

3443
if (Settings.AppFailsOnMinimumSeverity.HasValue &&
35-
allErrors.Any(x => x.Severity >= Settings.AppFailsOnMinimumSeverity))
44+
result.Errors.Any(x => x.Severity >= Settings.AppFailsOnMinimumSeverity))
3645
{
3746
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId,
3847
"The verification of {Target} completed with findings of the specified failure severity {Severity}",
39-
verificationTarget.Name, Settings.AppFailsOnMinimumSeverity);
48+
result.Target.Name, Settings.AppFailsOnMinimumSeverity);
4049

4150
return ModVerifyConstants.CompletedWithFindings;
4251
}
@@ -57,4 +66,35 @@ protected override VerificationBaseline GetBaseline(VerificationTarget verificat
5766
}
5867
return baseline;
5968
}
69+
70+
private IReadOnlyCollection<IVerificationReporter> CreateReporters()
71+
{
72+
var reporters = new List<IVerificationReporter>();
73+
74+
reporters.Add(IVerificationReporter.CreateConsole(new ConsoleReporterSettings
75+
{
76+
Verbose = Settings.ReportSettings.Verbose,
77+
MinimumReportSeverity = Settings.VerifierServiceSettings.FailFastSettings.IsFailFast
78+
? VerificationSeverity.Information
79+
: VerificationSeverity.Error
80+
}, ServiceProvider));
81+
82+
var outputDirectory = Settings.ReportDirectory;
83+
reporters.Add(IVerificationReporter.CreateJson(new JsonReporterSettings
84+
{
85+
OutputDirectory = outputDirectory,
86+
MinimumReportSeverity = Settings.ReportSettings.MinimumReportSeverity,
87+
AggregateResults = true,
88+
Verbose = Settings.ReportSettings.Verbose
89+
}, ServiceProvider));
90+
91+
reporters.Add(IVerificationReporter.CreateText(new TextFileReporterSettings
92+
{
93+
Verbose = Settings.ReportSettings.Verbose,
94+
OutputDirectory = outputDirectory!,
95+
MinimumReportSeverity = Settings.ReportSettings.MinimumReportSeverity
96+
}, ServiceProvider));
97+
98+
return reporters;
99+
}
60100
}

src/ModVerify.CliApp/ModVerify.CliApp.csproj

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<OutputType>Exe</OutputType>
66
<RootNamespace>AET.ModVerify.App</RootNamespace>
77
<AssemblyName>ModVerify</AssemblyName>
8-
<ApplicationIcon>$(RepoRootPath)aet.ico</ApplicationIcon>
8+
<ApplicationIcon>Resources/aet.ico</ApplicationIcon>
99
<PackageId>AlamoEngineTools.ModVerify.CliApp</PackageId>
1010
</PropertyGroup>
1111

1212
<PropertyGroup>
1313
<Title>ModVerify Console Application</Title>
1414
<Product>AET.ModVerify</Product>
15-
<Description>Console application that analyzes game modifications for Empire at War / Forces of Corruption for common errors.</Description>
15+
<Description>An application that analyzes game modifications for Empire at War / Forces of Corruption for common errors.</Description>
1616
<PackageTags>alamo,petroglyph,glyphx</PackageTags>
1717
</PropertyGroup>
1818

@@ -25,27 +25,23 @@
2525
<NBGV_ThisAssemblyIncludesPackageVersion>true</NBGV_ThisAssemblyIncludesPackageVersion>
2626
</PropertyGroup>
2727

28-
<ItemGroup>
29-
<None Remove="Resources\Baselines\baseline-foc.json" />
30-
</ItemGroup>
31-
3228
<ItemGroup>
3329
<EmbeddedResource Include="Resources\Baselines\baseline-foc.json" />
3430
</ItemGroup>
3531

3632
<ItemGroup>
37-
<PackageReference Include="AlamoEngineTools.PG.StarWarsGame.Infrastructure" Version="5.0.1" />
38-
<PackageReference Include="AlamoEngineTools.PG.StarWarsGame.Infrastructure.Steam" Version="5.0.1" />
39-
<PackageReference Include="Figgle" Version="0.6.5" />
40-
<PackageReference Include="Figgle.Generator" Version="0.6.5" />
33+
<PackageReference Include="AlamoEngineTools.PG.StarWarsGame.Infrastructure" Version="5.0.7" />
34+
<PackageReference Include="AlamoEngineTools.PG.StarWarsGame.Infrastructure.Steam" Version="5.0.7" />
35+
<PackageReference Include="Figgle" Version="0.6.6" />
36+
<PackageReference Include="Figgle.Generator" Version="0.6.6" />
4137
<PackageReference Include="Serilog.Extensions.Logging" Version="10.0.0" />
42-
<PackageReference Include="AlamoEngineTools.SteamAbstraction" Version="5.0.1" />
38+
<PackageReference Include="AlamoEngineTools.SteamAbstraction" Version="5.0.7" />
4339
<PackageReference Include="CommandLineParser" Version="2.9.1" />
44-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.3" />
45-
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.3" />
46-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
47-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.3" />
48-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.3" />
40+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.5" />
41+
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.5" />
42+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.5" />
43+
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.5" />
44+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.5" />
4945
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
5046
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
5147
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
@@ -66,15 +62,15 @@
6662

6763
<!-- Exclude System.Index from all dependencies, excluding Microsoft.Bcl.Memory -->
6864
<ItemGroup>
69-
<PackageReference Include="Vanara.Core" Version="5.0.0" Condition="'$(TargetFramework)' == 'net481'">
65+
<PackageReference Include="Vanara.Core" Version="5.0.1" Condition="'$(TargetFramework)' == 'net481'">
7066
<ExcludeAssets>compile</ExcludeAssets>
7167
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7268
</PackageReference>
73-
<PackageReference Include="IndexRange" Version="1.0.3" Condition="'$(TargetFramework)' == 'net481'">
69+
<PackageReference Include="IndexRange" Version="1.1.0" Condition="'$(TargetFramework)' == 'net481'">
7470
<ExcludeAssets>compile</ExcludeAssets>
7571
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7672
</PackageReference>
77-
<PackageReference Include="Microsoft.Bcl.Memory" Version="10.0.3" Condition="'$(TargetFramework)' == 'net481'" />
73+
<PackageReference Include="Microsoft.Bcl.Memory" Version="10.0.5" Condition="'$(TargetFramework)' == 'net481'" />
7874
</ItemGroup>
7975

8076
<ItemGroup>
@@ -86,10 +82,6 @@
8682
<ProjectReference Include="..\ModVerify\ModVerify.csproj" />
8783
</ItemGroup>
8884

89-
<ItemGroup>
90-
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="10.0.103" />
91-
</ItemGroup>
92-
9385
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
9486
<WeaverConfiguration>
9587
<Weavers>

0 commit comments

Comments
 (0)