Repository navigation
[3.0] Overhaul SilkTouch configuration and DI - #2624
Merged
Merged
Conversation
Contributor
|
All native library builds modified in this PR shall attempt to be built by CI. |
…ob is to handle keyed resolution
Exanite
force-pushed
the
feature/silktouch-config-overhaul
branch
from
October 10, 2026 19:41
bf44782 to
7dabae1
Compare
Member
Author
|
Force pushing to rebase on develop/3.0. |
This was driving me crazy
Exanite
commented
Oct 14, 2026
Exanite
left a comment
Member
Author
There was a problem hiding this comment.
Going to post my current self code review comments. Not fully happy with how I'm handling using statements, so might revisit in the future, but it's fine for now.
Also going to work on updating docs before marking this PR ready for review.
Exanite
marked this pull request as ready for review
October 14, 2026 13:16
Exanite
commented
Oct 14, 2026
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Perksey
reviewed
Oct 18, 2026
Perksey
left a comment
Member
There was a problem hiding this comment.
I don't think there's anything too objectionable in here
Perksey
reviewed
Oct 18, 2026
Perksey
approved these changes
Oct 25, 2026
Exanite
enabled auto-merge (squash)
October 25, 2026 20:11
11 of 57 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
This PR reworks the generator to be configured through a C# API rather than a JSON file. The original reason for this was to allow more complex conditions to be easily expressed, such as for skipping mods/jobs on specific platforms.
In addition, this PR also reworks the dependency injection setup to be properly scope-based rather than using the keyed dependency resolution approach the generator was using before. This structurally avoids issues where state is accidentally shared between jobs.
The generator config is now found in a new
Silk.NET.SilkTouch.Jobsproject which is next to the SilkTouch project. Because Silk has a lot of bindings, I decided to split the config into multiple files. External consumers of SilkTouch should be able to use single file apps if more appropriate (should work, but I haven't tested yet).This PR also reworks how copyright headers, using statements, and namespaces are injected into generated documents. These were previously implicitly handled by
ModandModCSharpSyntaxRewriter, both of which were often accidentally used throughout the codebase. These are now replaced byDocumentFactory, which makes the process much more explicit. The idea is to callDocumentFactory.PopulateDocumentbefore adding new documents to the project. ClangScraper also callsDocumentFactory.ReportDocumentto generate a set of default using statements.The behavior is otherwise mostly the same other than the need to call the
DocumentFactorymethods explicitly. One behavior I decided not to replicate is implicitly deciding the header to inject into new docs.DocumentFactoryalways uses theDefaultLicenseHeaderdefined in the job config rather than taking the longest header comment found.Related issues, Discord discussions, or proposals
Original discussion with Perksey: https://discord.com/channels/521092042781229087/587346162802229298/1530907649561067693
Discord thread: https://discord.com/channels/521092042781229087/1542235869560438824
Further Comments
Next PR
This PR will be followed up by a PR that focuses on OpenXR and multi-platform ClangSharp scraping.
Tasks (from my tracker)
TransformFunctions.Silk.NET.SDL.ConditionHandle.gen.csinstead ofConditionHandle.gen.cswhen running multiple jobs at the same time.These will be replaced by DocumentFactory:
Mod(the class, not the similarly named interface)ModCSharpSyntaxRewriterTasks
DocumentFactory.PopulateDocumentalso callsReportDocumentinternally.Added during code review:
To complete within this PR:
To add to my task tracker, but sooner than later (last task has been moved):
IModContext.SourceProjectto be non-nullable.AddIncludes(new())to be optional.To add to my task tracker (these have been moved):