Skip to content
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

[Xamarin.Android.Build.Tasks] Add support for $(AndroidEnableObsoleteOverrideInheritance). #8393

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Documentation/guides/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ Support for this property was added in Xamarin.Android 5.1.

This property is `False` by default.

## AndroidEnableObsoleteOverrideInheritance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. We do not expect ~anyone to actually use this, however there was an internal customer with a very custom setup that hit this and we did need to provide an opt-out. Thus we do not intend to widely document or suggest its usage.


A boolean property that determines if bound methods automatically inherit `[Obsolete]`
attributes from methods they override.

Support for this property was added in .NET 8.

This property is `True` by default.

## AndroidEnablePreloadAssemblies

A boolean property that controls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ It is shared between "legacy" binding projects and .NET 5 projects.
EnableBindingNestedInterfaceTypes="$(AndroidBoundInterfacesContainTypes)"
EnableBindingInterfaceConstants="$(AndroidBoundInterfacesContainConstants)"
EnableRestrictToAttributes="$(AndroidEnableRestrictToAttributes)"
EnableObsoleteOverrideInheritance="$(AndroidEnableObsoleteOverrideInheritance)"
Nullable="$(Nullable)"
UseJavaLegacyResolver="$(_AndroidUseJavaLegacyResolver)"
NamespaceTransforms="@(AndroidNamespaceReplacement)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
<AndroidBoundInterfacesContainConstants Condition=" '$(AndroidBoundInterfacesContainConstants)' == '' ">true</AndroidBoundInterfacesContainConstants>
<AndroidEnableObsoleteOverrideInheritance Condition=" '$(AndroidEnableObsoleteOverrideInheritance)' == '' ">true</AndroidEnableObsoleteOverrideInheritance>
<AndroidEnableRestrictToAttributes Condition=" '$(AndroidEnableRestrictToAttributes)' == '' ">obsolete</AndroidEnableRestrictToAttributes>

<!-- Mono components -->
Expand Down
4 changes: 4 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Tasks/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class BindingsGenerator : AndroidDotnetToolTask
public bool EnableBindingNestedInterfaceTypes { get; set; }
public bool EnableBindingInterfaceConstants { get; set; }
public string EnableRestrictToAttributes { get; set; }
public bool EnableObsoleteOverrideInheritance { get; set; }
public string Nullable { get; set; }

public ITaskItem[] TransformFiles { get; set; }
Expand Down Expand Up @@ -217,6 +218,9 @@ protected override string GenerateCommandLineCommands ()
if (EnableBindingStaticAndDefaultInterfaceMethods)
features.Add ("default-interface-methods");

if (!EnableObsoleteOverrideInheritance)
features.Add ("do-not-fix-obsolete-overrides");

if (string.Equals (EnableRestrictToAttributes, "obsolete", StringComparison.OrdinalIgnoreCase))
features.Add ("restrict-to-attributes");

Expand Down
Loading