Skip to content

Commit 07325f4

Browse files
committed
Merge branch 'develop' into feat/filetype-maps
2 parents a5bb729 + a3cb110 commit 07325f4

109 files changed

Lines changed: 6007 additions & 1935 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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
- name: Create Net Core Release
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
50+
- name: Create Linux Release
51+
run: dotnet publish ${{ env.TOOL_PROJ_PATH }} --configuration Release -f net10.0 --runtime linux-x64 --self-contained true --output ./releases/linux-x64 /p:DebugType=None /p:DebugSymbols=false
5052
- name: Upload a Build Artifact
5153
uses: actions/upload-artifact@v7
5254
with:
@@ -109,12 +111,13 @@ jobs:
109111
# Create a GitHub release on push to main only
110112
if: |
111113
github.ref == 'refs/heads/main' && github.event_name == 'push'
112-
uses: softprops/action-gh-release@v2
114+
uses: softprops/action-gh-release@v3
113115
with:
114116
name: v${{ steps.nbgv.outputs.SemVer2 }}
115117
tag_name: v${{ steps.nbgv.outputs.SemVer2 }}
116118
token: ${{ secrets.GITHUB_TOKEN }}
117119
generate_release_notes: true
118120
files: |
119121
./releases/net481/ModVerify.exe
120-
./releases/ModVerify-Net10.zip
122+
./releases/ModVerify-Net10.zip
123+
./releases/linux-x64/ModVerify

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
<ItemGroup>
3535
<PackageReference Update="SauceControl.InheritDoc" Version="2.0.2" />
36-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.201" PrivateAssets="All"/>
36+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.203" PrivateAssets="All"/>
3737
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
3838
<PrivateAssets>all</PrivateAssets>
3939
<Version>3.9.50</Version>

ModVerify.slnx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<Project Path="modules/ModdingToolBase/src/Updater/ExternalUpdater.Core/ExternalUpdater.Core.csproj" />
1818
</Folder>
1919
<Folder Name="/PetroglyphTools/">
20+
<Project Path="src/PetroglyphTools/PG.StarWarsGame.Engine.FileSystem.Test/PG.StarWarsGame.Engine.FileSystem.Test.csproj" />
21+
<Project Path="src/PetroglyphTools/PG.StarWarsGame.Engine.FileSystem/PG.StarWarsGame.Engine.FileSystem.csproj" />
2022
<Project Path="src/PetroglyphTools/PG.StarWarsGame.Engine/PG.StarWarsGame.Engine.csproj" />
2123
<Project Path="src/PetroglyphTools/PG.StarWarsGame.Files.ALO/PG.StarWarsGame.Files.ALO.csproj" />
2224
<Project Path="src/PetroglyphTools/PG.StarWarsGame.Files.ChunkFiles.Test/PG.StarWarsGame.Files.ChunkFiles.Test.csproj" Id="cf14a3d6-9f76-479a-9ae2-c3f2e8c6464c">

README.md

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,58 @@ In general ModVerify has two operation mods.
8080
1. `verify` Verifying a game or mod
8181
2. `createBaseline` Creating a baseline for a game or mod, that can be used for further verifications in order to verify you did not add more errors to your mods.
8282

83-
### Example
84-
This is an example run configuration that analyzes a specific mod, uses a the FoC basline and writes the output into a dedicated directory:
83+
### Examples
8584

86-
```bash
85+
#### Example 1: Auto-detection with a custom baseline
86+
Analyzes a specific mod, uses the FoC baseline and writes the output into a dedicated directory:
87+
88+
**Windows:**
89+
```bat
8790
.\ModVerify.exe verify --path "C:\My Games\FoC\Mods\MyMod" --outDir "C:\My Games\FoC\Mods\MyMod\verifyResults" --baseline ./focBaseline.json
8891
```
8992

93+
**Linux:**
94+
```bash
95+
./ModVerify verify \
96+
--path "/home/user/games/FoC/Mods/MyMod" \
97+
--outDir "/home/user/games/FoC/Mods/MyMod/verifyResults" \
98+
--baseline ./focBaseline.json
99+
```
100+
101+
#### Example 2: Manual mod setup with sub-mods, EaW fallback and default baseline
102+
Uses manual mod setup, including sub-mods and the EaW fallback game, and uses the default embedded baseline:
103+
104+
**Windows:**
105+
```bat
106+
.\ModVerify.exe verify --mods "C:\My Games\FoC\Mods\MySubMod;C:\My Games\FoC\Mods\MyMod" --game "C:\My Games\FoC" --fallbackGame "C:\My Games\EaW" --engine FOC --useDefaultBaseline
107+
```
108+
109+
**Linux:**
110+
```bash
111+
./ModVerify verify \
112+
--mods "/home/user/games/FoC/Mods/MySubMod:/home/user/games/FoC/Mods/MyMod" \
113+
--game "/home/user/games/FoC" \
114+
--fallbackGame "/home/user/games/EaW" \
115+
--engine FOC \
116+
--useDefaultBaseline
117+
```
118+
119+
#### Example 3: Layering a mod-specific baseline on top of the default baseline
120+
A typical mod-dev workflow: filter the base game's known findings with the embedded default baseline, *and* filter your mod's own accepted findings with your own baseline. The two baselines stay independent — you can regenerate your mod baseline without touching the default.
121+
122+
**Windows:**
123+
```bat
124+
.\ModVerify.exe verify --path "C:\My Games\FoC\Mods\MyMod" --useDefaultBaseline --baseline ./myModBaseline.json
125+
```
126+
127+
**Linux:**
128+
```bash
129+
./ModVerify verify \
130+
--path "/home/user/games/FoC/Mods/MyMod" \
131+
--useDefaultBaseline \
132+
--baseline ./myModBaseline.json
133+
```
134+
90135
---
91136

92137
## Available Checks
@@ -116,6 +161,33 @@ The following verifiers are currently implemented:
116161
If you want to create your own baseline use the `createBaseline` option.
117162

118163
### Example
164+
165+
**Windows**
119166
```bash
120167
ModVerify.exe createBaseline --outFile myBaseline.json --path "C:\My Games\FoC\Mods\MyMod"
121168
```
169+
**Linux**
170+
```bash
171+
./ModVerify createBaseline \
172+
--outFile myBaseline.json \
173+
--path "C:\My Games\FoC\Mods\MyMod"
174+
```
175+
176+
### Creating a mod baseline on top of a base baseline
177+
178+
If you maintain a mod and only want your baseline to contain findings your mod is responsible for, supply the base baselines you want to subtract out. Findings already covered by the base baselines are excluded from the new file. The base baselines themselves are not modified, so they can keep being maintained independently.
179+
180+
**Windows**
181+
```bat
182+
.\ModVerify.exe createBaseline --outFile myModBaseline.json --path "C:\My Games\FoC\Mods\MyMod" --useDefaultBaseline
183+
```
184+
185+
**Linux**
186+
```bash
187+
./ModVerify createBaseline \
188+
--outFile myModBaseline.json \
189+
--path "/home/user/games/FoC/Mods/MyMod" \
190+
--useDefaultBaseline
191+
```
192+
193+
You can also chain a custom base baseline via `--baseline <path>`, and combine it with `--useDefaultBaseline`.

src/ModVerify.CliApp/App/CreateBaselineAction.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using AET.ModVerify.App.Reporting;
1+
using AET.ModVerify.App.Reporting;
22
using AET.ModVerify.App.Settings;
33
using AET.ModVerify.App.Utilities;
44
using AET.ModVerify.Reporting;
5-
using AET.ModVerify.Reporting.Baseline;
65
using Microsoft.Extensions.DependencyInjection;
76
using Microsoft.Extensions.Logging;
87
using System;
@@ -15,7 +14,7 @@ internal sealed class CreateBaselineAction(AppBaselineSettings settings, IServic
1514
: ModVerifyApplicationAction<AppBaselineSettings>(settings, serviceProvider)
1615
{
1716
private readonly IFileSystem _fileSystem = serviceProvider.GetRequiredService<IFileSystem>();
18-
17+
1918
protected override void PrintAction(VerificationTarget target)
2019
{
2120
Console.WriteLine();
@@ -29,11 +28,11 @@ protected override void PrintAction(VerificationTarget target)
2928
protected override async Task<int> ProcessResult(VerificationResult result)
3029
{
3130
var baselineFactory = ServiceProvider.GetRequiredService<IBaselineFactory>();
32-
var baseline = baselineFactory.CreateBaseline(result.Target, Settings, result.Errors);
31+
var baseline = baselineFactory.CreateBaseline(result.Target, Settings, result.Errors.NewErrors);
3332

3433
var fullPath = _fileSystem.Path.GetFullPath(Settings.NewBaselinePath);
35-
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId,
36-
"Writing Baseline to '{FullPath}' with {Number} findings", fullPath, result.Errors.Count);
34+
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId,
35+
"Writing Baseline to '{FullPath}' with {Number} findings", fullPath, result.Errors.NewErrors.Count);
3736

3837
await baselineFactory.WriteBaselineAsync(baseline, Settings.NewBaselinePath);
3938

@@ -46,9 +45,4 @@ protected override async Task<int> ProcessResult(VerificationResult result)
4645

4746
return ModVerifyConstants.Success;
4847
}
49-
50-
protected override VerificationBaseline GetBaseline(VerificationTarget verificationTarget)
51-
{
52-
return VerificationBaseline.Empty;
53-
}
5448
}

src/ModVerify.CliApp/App/ModVerifyApplicationAction.cs

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
using System;
22
using System.IO.Abstractions;
3+
using System.Linq;
34
using System.Threading.Tasks;
45
using AET.ModVerify.App.GameFinder;
56
using AET.ModVerify.App.Reporting;
67
using AET.ModVerify.App.Settings;
78
using AET.ModVerify.App.TargetSelectors;
9+
using AET.ModVerify.App.Utilities;
810
using AET.ModVerify.Reporting;
911
using AET.ModVerify.Reporting.Baseline;
1012
using AET.ModVerify.Reporting.Suppressions;
1113
using AnakinRaW.ApplicationBase;
14+
using AnakinRaW.CommonUtilities.SimplePipeline;
1215
using Microsoft.Extensions.DependencyInjection;
1316
using Microsoft.Extensions.Logging;
1417

@@ -74,18 +77,59 @@ public async Task<int> ExecuteAsync()
7477
var verificationResult = await VerifyTargetAsync(verificationTarget)
7578
.ConfigureAwait(false);
7679

80+
Console.WriteLine();
81+
82+
switch (verificationResult.Status)
83+
{
84+
case VerificationCompletionStatus.Cancelled:
85+
return ModVerifyConstants.VerifyCancelled;
86+
case VerificationCompletionStatus.Failed:
87+
return ReportVerificationFailure(verificationResult.Exception!);
88+
}
89+
7790
return await ProcessResult(verificationResult);
7891
}
7992

93+
private int ReportVerificationFailure(Exception verificationException)
94+
{
95+
var exceptionToReport = verificationException switch
96+
{
97+
AggregateException aggregate => aggregate.InnerExceptions.FirstOrDefault() ?? aggregate,
98+
StepFailureException stepFailure => stepFailure.FailedSteps.First().Error!,
99+
_ => verificationException
100+
};
101+
102+
ConsoleUtilities.WriteApplicationFatalError(_appEnvironment.ApplicationName, exceptionToReport);
103+
Logger?.LogError(exceptionToReport, exceptionToReport.Message);
104+
105+
return exceptionToReport.HResult;
106+
}
107+
80108
protected abstract Task<int> ProcessResult(VerificationResult result);
81-
82-
protected abstract VerificationBaseline GetBaseline(VerificationTarget verificationTarget);
109+
110+
protected virtual BaselineCollection GetBaselines(VerificationTarget verificationTarget)
111+
{
112+
var baselineSelector = new BaselineSelector(Settings, ServiceProvider);
113+
var baselines = baselineSelector.SelectBaselines(verificationTarget);
114+
if (!baselines.IsEmpty)
115+
{
116+
Console.WriteLine();
117+
ModVerifyConsoleUtilities.WriteBaselineInfo(baselines);
118+
foreach (var entry in baselines)
119+
{
120+
Logger?.LogDebug("Using baseline {Baseline} from source '{Identifier}'",
121+
entry.Baseline.ToString(), entry.Identifier);
122+
}
123+
Console.WriteLine();
124+
}
125+
return baselines;
126+
}
83127

84128
private async Task<VerificationResult> VerifyTargetAsync(VerificationTarget verificationTarget)
85129
{
86130
var progressReporter = new VerifyConsoleProgressReporter(verificationTarget.Name, Settings.ReportSettings);
87131

88-
var baseline = GetBaseline(verificationTarget);
132+
var baselines = GetBaselines(verificationTarget);
89133
var suppressions = GetSuppressions();
90134

91135
try
@@ -95,11 +139,11 @@ private async Task<VerificationResult> VerifyTargetAsync(VerificationTarget veri
95139
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Verifying '{Target}'...", verificationTarget.Name);
96140

97141
var verificationResult = await verifierService.VerifyAsync(
98-
verificationTarget,
142+
verificationTarget,
99143
Settings.VerifierServiceSettings,
100-
baseline,
144+
baselines,
101145
suppressions,
102-
progressReporter,
146+
progressReporter,
103147
new EngineInitializeProgressReporter(verificationTarget.Engine));
104148

105149
progressReporter.Report(string.Empty, 1.0);
@@ -112,6 +156,10 @@ private async Task<VerificationResult> VerifyTargetAsync(VerificationTarget veri
112156
case VerificationCompletionStatus.Cancelled:
113157
Logger?.LogWarning(ModVerifyConstants.ConsoleEventId, "Verification was cancelled.");
114158
break;
159+
case VerificationCompletionStatus.Failed:
160+
progressReporter.ReportError("Verification failed!",
161+
$"An unexpected error occurred while verifying '{verificationTarget.Name}'.");
162+
break;
115163
case VerificationCompletionStatus.Completed:
116164
default:
117165
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId, "Verification completed successfully.");

src/ModVerify.CliApp/App/VerifyAction.cs

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using AET.ModVerify.App.Reporting;
2-
using AET.ModVerify.App.Settings;
1+
using AET.ModVerify.App.Settings;
32
using AET.ModVerify.App.Utilities;
43
using AET.ModVerify.Reporting;
54
using Microsoft.Extensions.Logging;
@@ -8,7 +7,6 @@
87
using System.Linq;
98
using System.Threading.Tasks;
109
using AET.ModVerify.Reporting.Reporters;
11-
using AET.ModVerify.Reporting.Baseline;
1210

1311
namespace AET.ModVerify.App;
1412

@@ -41,7 +39,7 @@ protected override async Task<int> ProcessResult(VerificationResult result)
4139
await reportBroker.ReportAsync(result);
4240

4341
if (Settings.AppFailsOnMinimumSeverity.HasValue &&
44-
result.Errors.Any(x => x.Severity >= Settings.AppFailsOnMinimumSeverity))
42+
result.Errors.NewErrors.Any(x => x.Severity >= Settings.AppFailsOnMinimumSeverity))
4543
{
4644
Logger?.LogInformation(ModVerifyConstants.ConsoleEventId,
4745
"The verification of {Target} completed with findings of the specified failure severity {Severity}",
@@ -53,31 +51,18 @@ protected override async Task<int> ProcessResult(VerificationResult result)
5351
return ModVerifyConstants.Success;
5452
}
5553

56-
protected override VerificationBaseline GetBaseline(VerificationTarget verificationTarget)
57-
{
58-
var baselineSelector = new BaselineSelector(Settings, ServiceProvider);
59-
var baseline = baselineSelector.SelectBaseline(verificationTarget, out var baselinePath);
60-
if (!baseline.IsEmpty)
61-
{
62-
Console.WriteLine();
63-
ModVerifyConsoleUtilities.WriteBaselineInfo(baseline, baselinePath);
64-
Logger?.LogDebug("Using baseline {Baseline} from location '{Path}'", baseline.ToString(), baselinePath);
65-
Console.WriteLine();
66-
}
67-
return baseline;
68-
}
69-
7054
private IReadOnlyCollection<IVerificationReporter> CreateReporters()
7155
{
72-
var reporters = new List<IVerificationReporter>();
73-
74-
reporters.Add(IVerificationReporter.CreateConsole(new ConsoleReporterSettings
56+
var reporters = new List<IVerificationReporter>
7557
{
76-
Verbose = Settings.ReportSettings.Verbose,
77-
MinimumReportSeverity = Settings.VerifierServiceSettings.FailFastSettings.IsFailFast
78-
? VerificationSeverity.Information
79-
: VerificationSeverity.Error
80-
}, ServiceProvider));
58+
IVerificationReporter.CreateConsole(new ConsoleReporterSettings
59+
{
60+
Verbose = Settings.ReportSettings.Verbose,
61+
MinimumReportSeverity = Settings.VerifierServiceSettings.FailFastSettings.IsFailFast
62+
? VerificationSeverity.Information
63+
: VerificationSeverity.Error
64+
}, ServiceProvider)
65+
};
8166

8267
var outputDirectory = Settings.ReportDirectory;
8368
reporters.Add(IVerificationReporter.CreateJson(new JsonReporterSettings

0 commit comments

Comments
 (0)