-
-
Notifications
You must be signed in to change notification settings - Fork 115
Make WrapperElementsGenerator cacheable and move generated code to bunit.anglesharp package #1781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: linkdotnet <[email protected]>
…mbine Co-authored-by: linkdotnet <[email protected]>
Co-authored-by: linkdotnet <[email protected]>
|
@copilot Move out the generated files into its own assembly that then gets referenced from bunit itself. The new package should have the dependency and AngleSharp related code. |
I understand you want to move the generated AngleSharp wrapper code into a separate assembly. To ensure I implement this correctly, could you clarify a few points?
Understanding these details will help me make the right structural changes without breaking the existing architecture. |
|
I've created the The challenge is that source generators execute during compilation and generate code into the project that references them. Currently, the I've set up:
However, the generator isn't running in Could you clarify the intended architecture:
The changes are in progress at commits b5dc661 and following. |
…nit.anglesharp package Co-authored-by: linkdotnet <[email protected]>
The
WrapperElementsGeneratorwas returningIncrementalValuesProvider<ISymbol>, which isn't cacheable, causing the pipeline to trigger on every build of thebunit.webproject. Additionally, the generated AngleSharp wrapper code has been moved to a separate internal package for better separation of concerns.Changes
Introduced cacheable record types
ElementInterfacesData: Holds immutable array of element type infoElementTypeInfo: StoresName,FullyQualifiedName, andMetadataNameas stringsImplemented collect-and-execute pattern
Selectextracts minimal type information into records during compilationCombinemerges cached data withCompilationProviderto retrieve full symbols only when neededGetTypeByMetadataName()using cached metadata namesAdded defensive checks
Created new bunit.anglesharp package
bunit.anglesharpthat contains AngleSharp wrapper codeAngleSharpWrapperExtensionsfrombunittobunit.anglesharpbunit.anglesharpfor code generationbunitproject referencesbunit.anglesharpto access wrapper typesBefore
After
The generator now caches only hashable data, enabling incremental compilation to skip regeneration when AngleSharp assembly hasn't changed. The generated wrapper code is isolated in the
bunit.anglesharppackage, providing better separation of AngleSharp-specific functionality.Status
The architectural changes are in progress. The
bunit.anglesharpproject has been created and configured, but the source generator is not yet producing output in the new project. Further investigation is needed to ensure the generator properly triggers during compilation ofbunit.anglesharp.Original prompt
WrapperElementsGeneratorcachable #1397💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.