[RGen] Teach been to ignore rgen types.#21449
Conversation
Teach bgen to ignore the types that have been marked by the BindingTypeAttribute.
e06f41c to
7a90a3f
Compare
| @@ -0,0 +1,44 @@ | |||
| #pragma warning disable APL0003 | |||
There was a problem hiding this comment.
What's this warning? I didn't see it in a search for it.
There was a problem hiding this comment.
It is defined via a ExperimentalAttribute: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-12.0/experimental-attribute
This was added in a previous PR, which is documented under https://github.com/xamarin/xamarin-macios/blob/main/docs/preview-apis.md#rgen-apl0003 i
Since we are using them, we have to ensure that we do not have a compilation warning.
|
|
||
| // check if the type has been marked as a type that will be generated by the new code generator, if that | ||
| // is the case, bgen will ignore it allowing the rgen code generator add the type to the final assembly | ||
| bool is_rgen_type = AttributeManager.HasAttribute<BindingTypeAttribute> (type); |
There was a problem hiding this comment.
Will this predicate be used in other places and if so, does it justify putting it in its own method?
There was a problem hiding this comment.
Are you talking about AttributeManager.HasAttribute<BindingTypeAttribute> that is a generic method that we use to verify if a class/method as an attribute. If you are talking about is_rgen_type, we can do that in the if.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commit.NET (No breaking changes)✅ API diff vs stable.NET (No breaking changes)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
🚀 [CI Build] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 101 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
| [SupportedOSPlatform ("maccatalyst17.0")] | ||
| [SupportedOSPlatform ("macos14.0")] | ||
| public enum AVCaptureReactionType { | ||
| [Field ("AVCaptureReactionTypeThumbsUp")] |
There was a problem hiding this comment.
RGen doesn't do all it's supposed: the [Field] attributes are supposed to generate a bunch of additional code, which isn't happening.
If that's coming later, then the [Field] attribute should be removed now, and added back when the [Field] support is back.
There was a problem hiding this comment.
Sure, but the idea was to add the field and verify the bgen was not generating anything. So it is 100% on purpose that we do not have the extension methods
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
Teach our bgen to ignore those types that have been marked as a rgen BindingType. The code adds a new smart enum in the sources that should not be processed by bgen and therefore should not have the smart enum extension method. You can verify that this is try by looking at the API diff: <img width="560" alt="Screenshot 2024-10-15 at 14 58 00" src="https://github.com/user-attachments/assets/83790ae6-d94a-424f-8f70-e33bde7c4f22">
Teach our bgen to ignore those types that have been marked as a rgen BindingType. The code adds a new smart enum in the sources that should not be processed by bgen and therefore should not have the smart enum extension method. You can verify that this is try by looking at the API diff: