Skip to content

Commit 18092d7

Browse files
committed
Change ' AndroidEnableRestrictToAttributes' to enum style for future-proofing.
1 parent 0f30f6a commit 18092d7

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Documentation/guides/building-apps/build-properties.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ This property is `False` by default.
488488

489489
## AndroidEnableRestrictToAttributes
490490

491-
A boolean property that determines whether types and members marked with
491+
An enum-style property with a valid value of `obsolete`. Set to no value to disable.
492+
493+
When set to `obsolete`, types and members marked with
492494
the Java annotation `androidx.annotation.RestrictTo` will be marked with an
493495
`[Obsolete]` attribute in the C# binding.
494496

@@ -510,7 +512,7 @@ this property to prevent these types from being bound:
510512

511513
Support for this property was added in .NET 8.
512514

513-
This property is `True` by default.
515+
This property is set to `obsolete` by default.
514516

515517
## AndroidEnableSGenConcurrent
516518

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
3737
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
3838
<AndroidBoundInterfacesContainConstants Condition=" '$(AndroidBoundInterfacesContainConstants)' == '' ">true</AndroidBoundInterfacesContainConstants>
39-
<AndroidEnableRestrictToAttributes Condition=" '$(AndroidEnableRestrictToAttributes)' == '' ">true</AndroidEnableRestrictToAttributes>
39+
<AndroidEnableRestrictToAttributes Condition=" '$(AndroidEnableRestrictToAttributes)' == '' ">obsolete</AndroidEnableRestrictToAttributes>
4040

4141
<!-- Mono components -->
4242
<AndroidEnableProfiler Condition=" '$(AndroidEnableProfiler)' == ''">false</AndroidEnableProfiler>

src/Xamarin.Android.Build.Tasks/Tasks/Generator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class BindingsGenerator : AndroidDotnetToolTask
5151
public bool EnableBindingStaticAndDefaultInterfaceMethods { get; set; }
5252
public bool EnableBindingNestedInterfaceTypes { get; set; }
5353
public bool EnableBindingInterfaceConstants { get; set; }
54-
public bool EnableRestrictToAttributes { get; set; }
54+
public string EnableRestrictToAttributes { get; set; }
5555
public string Nullable { get; set; }
5656

5757
public ITaskItem[] TransformFiles { get; set; }
@@ -217,7 +217,7 @@ protected override string GenerateCommandLineCommands ()
217217
if (EnableBindingStaticAndDefaultInterfaceMethods)
218218
features.Add ("default-interface-methods");
219219

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

223223
if (string.Equals (Nullable, "enable", StringComparison.OrdinalIgnoreCase))

0 commit comments

Comments
 (0)