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

Commit

Permalink
Wasn't setting rewriter profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Perksey committed Nov 10, 2023
1 parent b549473 commit bb6e175
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sources/SilkTouchX/Mods/AddApiProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public record Configuration
/// <summary>
/// The API profile declarations.
/// </summary>
public IEnumerable<ApiProfileDecl>? Profiles { get; init; }
public ApiProfileDecl[]? Profiles { get; init; }
}

/// <summary>
Expand Down Expand Up @@ -801,7 +801,7 @@ public override Task<GeneratedSyntax> AfterScrapeAsync(string key, GeneratedSynt
continue;
}

var profile = cfg.Profiles
rewriter.Profile = cfg.Profiles
?.Where(
x =>
path[8..].StartsWith(
Expand All @@ -810,15 +810,15 @@ public override Task<GeneratedSyntax> AfterScrapeAsync(string key, GeneratedSynt
)
)
.MaxBy(x => x.SourceSubdirectory.Length);
if (profile is null)
if (rewriter.Profile is null)
{
continue;
}

logger.LogDebug("Identified profile {} for {}", profile, path);
if (profile.BakedOutputSubdirectory is not null)
logger.LogDebug("Identified profile {} for {}", rewriter.Profile, path);
if (rewriter.Profile.BakedOutputSubdirectory is not null)
{
var discrim = $"sources/{profile.BakedOutputSubdirectory.Trim('/')}";
var discrim = $"sources/{rewriter.Profile.BakedOutputSubdirectory.Trim('/')}";
if (!bakery.TryGetValue(discrim, out var bakeSet))
{
bakeSet = bakery[discrim] = new BakeSet();
Expand All @@ -830,6 +830,7 @@ public override Task<GeneratedSyntax> AfterScrapeAsync(string key, GeneratedSynt

syntax.Files[path] = rewriter.Visit(root);
rewriter.Baked = null;
rewriter.Profile = null;
}

foreach (var path in baked)
Expand Down

0 comments on commit bb6e175

Please sign in to comment.