Skip to content

Commit 835c59b

Browse files
authored
[Xamarin.Android.Build.Tasks] Warn obsolete binding property values (#4577)
Both `$(AndroidClassParser)`=jar2xml and `$(AndroidCodegenTarget)`=XamarinAndroid were replaced 5+ years ago by `class-parse` and `XAJavaInterop1`, respectively. We already are not adding new features to them, like: * C#8 Default Interface Methods (dotnet/java-interop@29f97075) * C#8 Nullable Reference Types (dotnet/java-interop@59d86def) * Kotlin binding support (dotnet/java-interop@439bd839) Projects using them are not benefiting from our improvements. We would also like to some day stop maintaining these configurations in the .NET 5 time-frame. Add warnings to Bindings project builds if these configurations are still used: XA4231: The Android class parser value 'jar2xml' is dreprecated and will be removed in a future version of Xamain.Android. Update the project properties to use 'class-parse'. XA4232: The Android code generation target 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
1 parent 1abd430 commit 835c59b

20 files changed

+306
-1
lines changed

Documentation/guides/messages/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ ms.date: 01/24/2020
134134
+ XA4228: Unable to find specified //activity-alias/@android:targetActivity: '{targetActivity}'
135135
+ XA4229: Unrecognized \`TransformFile\` root element: {element}.
136136
+ XA4230: Error parsing XML: {exception}
137+
+ [XA4231](xa4231.md): The Android class parser value 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.
138+
+ [XA4232](xa4232.md): The Android code generation target 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
137139
+ XA4300: Native library '{library}' will not be bundled because it has an unsupported ABI.
138140
+ [XA4301](xa4301.md): Apk already contains the item `xxx`.
139141
+ [XA4302](xa4302.md): Unhandled exception merging \`AndroidManifest.xml\`: {ex}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Xamarin.Android warning XA4231
3+
description: XA4231 warning code
4+
ms.date: 04/23/2020
5+
---
6+
# Xamarin.Android warning XA4231
7+
8+
## Example messages
9+
10+
```
11+
warning XA4231: The Android class parser value 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.
12+
```
13+
14+
## Issue
15+
16+
The Android class parser `jar2xml` has been deprecated.
17+
18+
## Solution
19+
20+
To resolve this warning, update the **Android Class Parser** setting in the Visual
21+
Studio project property pages or the **.jar file parser** setting in Visual
22+
Studio for Mac to **class-parse**. This corresponds to the `class-parse` value
23+
for the `AndroidClassParser` MSBuild property in the _.csproj_ file:
24+
25+
```xml
26+
<PropertyGroup>
27+
<AndroidClassParser>class-parse</AndroidClassParser>
28+
</PropertyGroup>
29+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
title: Xamarin.Android warning XA4232
3+
description: XA4232 warning code
4+
ms.date: 04/23/2020
5+
---
6+
# Xamarin.Android warning XA4232
7+
8+
## Example messages
9+
10+
```
11+
warning XA4232: The Android code generation target 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
12+
```
13+
14+
## Issue
15+
16+
The Android code generation target `XamarinAndroid` has been deprecated.
17+
18+
## Solution
19+
20+
To resolve this warning, update the **Android Codegen target** setting in the
21+
Visual Studio project property pages or the **Code generation target** setting
22+
in Visual Studio for Mac to **XAJavaInterop1**. This corresponds to the
23+
`XAJavaInterop1` value for the `AndroidCodegenTarget` MSBuild property in the
24+
_.csproj_ file:
25+
26+
```xml
27+
<PropertyGroup>
28+
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
29+
</PropertyGroup>
30+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
### Bindings projects XA4231 warning for deprecated jar2xml parser
2+
3+
Any bindings project that has the `AndroidClassParser` MSBuild property set to
4+
the old `jar2xml` parser or any other unrecognized value will now get a XA4231
5+
build warning:
6+
7+
```
8+
warning XA4231: The Android class parser 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse' instead.
9+
```
10+
11+
To resolve this warning, update the **Android Class Parser** setting in the Visual
12+
Studio project property pages or the **.jar file parser** setting in Visual
13+
Studio for Mac to **class-parse**. This corresponds to the `class-parse` value
14+
for the `AndroidClassParser` MSBuild property in the _.csproj_ file:
15+
16+
```xml
17+
<PropertyGroup>
18+
<AndroidClassParser>class-parse</AndroidClassParser>
19+
</PropertyGroup>
20+
```
21+
22+
### Bindings projects XA4232 warning for deprecated XamarinAndroid code generation target
23+
24+
Any bindings project that has the `AndroidCodegenTarget` MSBuild property set to
25+
the old `XamarinAndroid` code generation target or any other unrecognized value
26+
will now get a XA4232 build warning:
27+
28+
```
29+
warning XA4232: The Android code generation target value 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
30+
```
31+
32+
To resolve this warning, update the **Android Codegen target** setting in the
33+
Visual Studio project property pages or the **Code generation target** setting
34+
in Visual Studio for Mac to **XAJavaInterop1**. This corresponds to the
35+
`XAJavaInterop1` value for the `AndroidCodegenTarget` MSBuild property in the
36+
_.csproj_ file:
37+
38+
```xml
39+
<PropertyGroup>
40+
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
41+
</PropertyGroup>
42+
```

src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Xamarin.Android.Build.Tasks/Properties/Resources.resx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,16 @@ In this message, "root element" refers to the root element of an XML file.
559559
<value>Error parsing XML: {0}</value>
560560
<comment>{0} - The exception message and stack trace of the associated exception</comment>
561561
</data>
562+
<data name="XA4231" xml:space="preserve">
563+
<value>The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</value>
564+
<comment>The following are literal names and should not be translated: class-parse
565+
{0} - The name of the current class parser value</comment>
566+
</data>
567+
<data name="XA4232" xml:space="preserve">
568+
<value>The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</value>
569+
<comment>The following are literal names and should not be translated: XAJavaInterop1
570+
{0} - The name of the current code generation target</comment>
571+
</data>
562572
<data name="XA4300" xml:space="preserve">
563573
<value>Native library '{0}' will not be bundled because it has an unsupported ABI.</value>
564574
<comment>The abbreviation "ABI" should not be translated.

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.cs.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ In this message, "root element" refers to the root element of an XML file.
537537
<target state="new">Error parsing XML: {0}</target>
538538
<note>{0} - The exception message and stack trace of the associated exception</note>
539539
</trans-unit>
540+
<trans-unit id="XA4231">
541+
<source>The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</source>
542+
<target state="new">The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</target>
543+
<note>The following are literal names and should not be translated: class-parse
544+
{0} - The name of the current class parser value</note>
545+
</trans-unit>
546+
<trans-unit id="XA4232">
547+
<source>The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</source>
548+
<target state="new">The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</target>
549+
<note>The following are literal names and should not be translated: XAJavaInterop1
550+
{0} - The name of the current code generation target</note>
551+
</trans-unit>
540552
<trans-unit id="XA4300">
541553
<source>Native library '{0}' will not be bundled because it has an unsupported ABI.</source>
542554
<target state="translated">Nativní knihovna {0} se nezahrne do sady prostředků, protože má nepodporované ABI.</target>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.de.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ In this message, "root element" refers to the root element of an XML file.
537537
<target state="new">Error parsing XML: {0}</target>
538538
<note>{0} - The exception message and stack trace of the associated exception</note>
539539
</trans-unit>
540+
<trans-unit id="XA4231">
541+
<source>The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</source>
542+
<target state="new">The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</target>
543+
<note>The following are literal names and should not be translated: class-parse
544+
{0} - The name of the current class parser value</note>
545+
</trans-unit>
546+
<trans-unit id="XA4232">
547+
<source>The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</source>
548+
<target state="new">The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</target>
549+
<note>The following are literal names and should not be translated: XAJavaInterop1
550+
{0} - The name of the current code generation target</note>
551+
</trans-unit>
540552
<trans-unit id="XA4300">
541553
<source>Native library '{0}' will not be bundled because it has an unsupported ABI.</source>
542554
<target state="translated">Die native Bibliothek "{0}" wird nicht gebündelt, weil sie eine nicht unterstützte ABI umfasst.</target>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.es.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ In this message, "root element" refers to the root element of an XML file.
537537
<target state="new">Error parsing XML: {0}</target>
538538
<note>{0} - The exception message and stack trace of the associated exception</note>
539539
</trans-unit>
540+
<trans-unit id="XA4231">
541+
<source>The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</source>
542+
<target state="new">The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</target>
543+
<note>The following are literal names and should not be translated: class-parse
544+
{0} - The name of the current class parser value</note>
545+
</trans-unit>
546+
<trans-unit id="XA4232">
547+
<source>The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</source>
548+
<target state="new">The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</target>
549+
<note>The following are literal names and should not be translated: XAJavaInterop1
550+
{0} - The name of the current code generation target</note>
551+
</trans-unit>
540552
<trans-unit id="XA4300">
541553
<source>Native library '{0}' will not be bundled because it has an unsupported ABI.</source>
542554
<target state="translated">La biblioteca nativa "{0}" no se empaquetará porque tiene un conjunto ABI no admitido.</target>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.fr.xlf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,18 @@ In this message, "root element" refers to the root element of an XML file.
537537
<target state="new">Error parsing XML: {0}</target>
538538
<note>{0} - The exception message and stack trace of the associated exception</note>
539539
</trans-unit>
540+
<trans-unit id="XA4231">
541+
<source>The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</source>
542+
<target state="new">The Android class parser value '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.</target>
543+
<note>The following are literal names and should not be translated: class-parse
544+
{0} - The name of the current class parser value</note>
545+
</trans-unit>
546+
<trans-unit id="XA4232">
547+
<source>The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</source>
548+
<target state="new">The Android code generation target '{0}' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.</target>
549+
<note>The following are literal names and should not be translated: XAJavaInterop1
550+
{0} - The name of the current code generation target</note>
551+
</trans-unit>
540552
<trans-unit id="XA4300">
541553
<source>Native library '{0}' will not be bundled because it has an unsupported ABI.</source>
542554
<target state="translated">La bibliothèque native '{0}' n'est pas incluse dans le bundle, car elle a un ABI non pris en charge.</target>

0 commit comments

Comments
 (0)