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

Commit

Permalink
Fix mods leaking into jobs where they're not welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
Perksey committed Nov 5, 2023
1 parent 689b973 commit ea692b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
9 changes: 6 additions & 3 deletions sources/SilkTouchX/SilkTouchGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ public async Task<GeneratedSyntax> GenerateSyntaxAsync(
)
{
// Prepare the mods
foreach (var mod in _mods)
var jobMods =
job.Mods?.Select(x => _mods.First(y => y.GetType().Name == x)).ToArray()
?? Array.Empty<IMod>();
foreach (var mod in jobMods)
{
_logger.LogDebug("Using mod {0} for {1}", mod.GetType().Name, key);
await mod.BeforeJobAsync(key, job);
Expand All @@ -93,7 +96,7 @@ public async Task<GeneratedSyntax> GenerateSyntaxAsync(

// Mod the response files
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var mod in _mods)
foreach (var mod in jobMods)
{
_logger.LogInformation(
"Applying {0} mod to response files for {1}...",
Expand Down Expand Up @@ -186,7 +189,7 @@ await Task.Run(

// Mod the bindings
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var mod in _mods)
foreach (var mod in jobMods)
{
_logger.LogInformation(
"Applying {0} mod to syntax trees for {1}...",
Expand Down
14 changes: 0 additions & 14 deletions sources/SilkTouchX/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@
"GLFWmonitor",
"GLFWwindow"
]
},
"AddVTables": {
"VTables": [
{
"Kind": "DllImport",
"IsDefault": true
},
{
"Kind": "StaticWrapper"
},
{
"Kind": "ThisThread"
}
]
}
}
}
Expand Down

0 comments on commit ea692b6

Please sign in to comment.