Skip to content

[generator] Add api flag "no-alternatives" to skip generating interface member alternatives. #601

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

Merged
merged 1 commit into from
Mar 13, 2020

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Mar 13, 2020

Context: #509

In #600 we began cleaning up our existing "alternative" hacks for bindings that use the new C#8 DIM features. However, as we add new API interfaces we will continue to generate new [Obsolete] "alternative" classes. We do not need to add new already-obsolete API to our bindings.

This PR creates a new attribute for <interface> elements called @no-alternatives. When this attribute is set to true we will not generate the alternative classes for this interface.

This will be used in Mono.Android.dll like this:

<attr api-since="30" path="/api/package/interface[contains(@merge.SourceFile,'api-30.xml.in')]" name="no-alternatives">true</attr>

This will keep any new interfaces added in API-30 from creating [Obsolete] alternative classes.

This diff https://gist.github.com/jpobst/27f4109aceb8d74b257cefa773704cac shows the difference between Mono.Android.dll master - API-R and what this PR will do. Note the diff is reversed to work around an issue in mono-api-html. Basically it shows that we will keep 3 new alternative classes in API-R from being created.

@jpobst jpobst marked this pull request as ready for review March 13, 2020 19:42
@jpobst jpobst requested a review from jonpryor March 13, 2020 19:43
@jonpryor jonpryor merged commit bd7c60a into master Mar 13, 2020
@jonpryor jonpryor deleted the no-alternatives branch March 13, 2020 19:50
jonpryor pushed a commit that referenced this pull request Mar 16, 2020
Context: #509

In 105d544 we began cleaning up our existing "alternative" hacks for
bindings that use the new C#8 DIM features.  However, as we add new
API interfaces we will continue to generate new `[Obsolete]`
"alternative" classes.

We do not need to add new already-obsolete API to our bindings.

Update `generator` so that Metadata.xml files can now add a
`//interface/@no-alternatives` attribute.  When this attribute is
`true`, the alternative types won't be emitted.

This will be used in `Mono.Android.dll` like this:

	<attr api-since="30" path="/api/package/interface[contains(@merge.SourceFile,'api-30.xml.in')]" name="no-alternatives">true</attr>

which will prevent any interfaces added in API-R+ from creating
`[Obsolete]` alternative classes.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants