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] Emit warnings if using deprecated bindings fallback flags. #8511

Merged
merged 1 commit into from
Nov 30, 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
1 change: 1 addition & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ or 'Help->Report a Problem' in Visual Studio for Mac.
+ [XA1035](xa1035.md): The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties.
+ [XA1036](xa1036.md): AndroidManifest.xml //uses-sdk/@android:minSdkVersion '29' does not match the $(SupportedOSPlatformVersion) value '21' in the project file (if there is no $(SupportedOSPlatformVersion) value in the project file, then a default value has been assumed).
Either change the value in the AndroidManifest.xml to match the $(SupportedOSPlatformVersion) value, or remove the value in the AndroidManifest.xml (and add a $(SupportedOSPlatformVersion) value to the project file if it doesn't already exist).
+ [XA1037](xa1037.md): The '{0}' MSBuild property is deprecated and will be removed in .NET {1}. See https://aka.ms/net-android-deprecations for more details.

## XA2xxx: Linker

Expand Down
22 changes: 22 additions & 0 deletions Documentation/guides/messages/xa1037.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Xamarin.Android warning XA1037
description: XA1037 warning code
ms.date: 27/11/2023
---
# Xamarin.Android warning XA1037

## Example messages

```
The '_AndroidUseJavaLegacyResolver' MSBuild property is deprecated and will be removed in .NET 10.
See https://aka.ms/net-android-deprecations for more details.
```

## Solution

Edit your csproj directly and remove the referenced MSBuild property.

Test your project to ensure the new behavior is functionally equivalent.

If not, file an [issue](https://github.com/xamarin/xamarin-android/issues) so a
solution can be found before the deprecated flag is removed.
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>
Loading