Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Emit warnings if using deprecated bind…
Browse files Browse the repository at this point in the history
…ings fallback flags.
  • Loading branch information
jpobst committed Nov 16, 2023
1 parent 3659766 commit a110495
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ It is shared between "legacy" binding projects and .NET 5 projects.
<NoWarn Condition=" '$(DocumentationFile)' != '' ">$(NoWarn);CS1573;CS1591</NoWarn>
</PropertyGroup>

<Target Name="_CheckNonIdealBindingConfigurations">
<AndroidWarning Code="XA1037"
ResourceName="XA1037"
FormatArguments="_AndroidUseJavaLegacyResolver;10"
Condition=" '$(_AndroidUseJavaLegacyResolver)' == 'true' "
/>
<AndroidWarning Code="XA1037"
ResourceName="XA1037"
FormatArguments="_AndroidEmitLegacyInterfaceInvokers;10"
Condition=" '$(_AndroidEmitLegacyInterfaceInvokers)' == 'true' "
/>
</Target>

<Target Name="_SetAndroidGenerateManagedBindings"
Condition=" '@(InputJar->Count())' != '0' Or '@(EmbeddedJar->Count())' != '0' Or '@(LibraryProjectZip->Count())' != '0' Or '@(_JavaBindingSource->Count())' != '0' ">
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ properties that determine build ordering.
<PropertyGroup Condition=" '$(AndroidApplication)' != 'True' ">
<BuildDependsOn>
_ValidateLinkMode;
_CheckNonIdealBindingConfigurations;
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForBuild;
_CategorizeAndroidLibraries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods Condition=" '$(AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods)' == '' ">true</AndroidBoundInterfacesContainStaticAndDefaultInterfaceMethods>
<AndroidBoundInterfacesContainTypes Condition=" '$(AndroidBoundInterfacesContainTypes)' == '' ">true</AndroidBoundInterfacesContainTypes>
<AndroidBoundInterfacesContainConstants Condition=" '$(AndroidBoundInterfacesContainConstants)' == '' ">true</AndroidBoundInterfacesContainConstants>
<_AndroidEmitLegacyInterfaceInvokers Condition=" '$(AndroidEmitLegacyInterfaceInvokers)' == '' ">false</_AndroidEmitLegacyInterfaceInvokers>
<_AndroidEmitLegacyInterfaceInvokers Condition=" '$(_AndroidEmitLegacyInterfaceInvokers)' == '' ">false</_AndroidEmitLegacyInterfaceInvokers>
<AndroidEnableObsoleteOverrideInheritance Condition=" '$(AndroidEnableObsoleteOverrideInheritance)' == '' ">true</AndroidEnableObsoleteOverrideInheritance>
<AndroidEnableRestrictToAttributes Condition=" '$(AndroidEnableRestrictToAttributes)' == '' ">obsolete</AndroidEnableRestrictToAttributes>

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -996,4 +996,10 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS
<comment>The following are literal names and should not be translated: Maven
{0} - User supplied Maven repository type</comment>
</data>
<data name="XA1037" xml:space="preserve">
<value>The '{0}' MSBuild property is deprecated and will be removed in .NET {1}. See https://aka.ms/net-android-deprecations for more details.</value>
<comment>The following are literal names and should not be translated: MSBuild, .NET.
{0} - The deprecated MSBuild property name
{1} - The numeric version of .NET</comment>
</data>
</root>

0 comments on commit a110495

Please sign in to comment.