Skip to content

Commit

Permalink
[One .NET] drop support for DX (#4920)
Browse files Browse the repository at this point in the history
Context: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html

On February 1, 2021 DX will be removed from the Android SDK.  It is
very possible this will happen before .NET 6 ships.  There are also
currently a few MSBuild tests that fail when using DX.

  * Drop support for DX in .NET 5+.  Emit `XA1023` as an *error*.
  * Don't even include `Xamarin.Android.DX.targets` in .NET 5+ packages.
  * Add several tests to the `dotnet` category.
  * Any tests using `AndroidDexTool=dx` will be ignored.

I left the `PackagingTest.CheckClassesDexIsIncluded()` test so that it
verifies you get an `XA1023` build error when using DX with .NET 5+.

Other changes:

  * There were some related warning messages that I moved to the
    `_CheckNonIdealConfigurations` MSBuild target.  These seem like
    they should all be in the same MSBuild target.
  • Loading branch information
jonathanpeppers authored Jul 16, 2020
1 parent b17a813 commit 22bc14b
Show file tree
Hide file tree
Showing 22 changed files with 182 additions and 64 deletions.
3 changes: 3 additions & 0 deletions Documentation/guides/OneDotNet.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ previous Xamarin.Android releases.
`$(AndroidClassParser)` will be `class-parse` by default. `jar2xml`
will not be supported.

`$(AndroidDexTool)` will be `d8` by default. `dx` will not be
supported.

`$(AndroidCodegenTarget)` will be `XAJavaInterop1` by default.
`XamarinAndroid` will not be supported.

Expand Down
14 changes: 10 additions & 4 deletions Documentation/guides/messages/xa1023.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
---
title: Xamarin.Android warning XA1023
description: XA1023 warning code
title: Xamarin.Android error/warning XA1023
description: XA1023 error/warning code
ms.date: 05/18/2020
---
# Xamarin.Android warning XA1023
# Xamarin.Android error/warning XA1023

## Example messages

```
warning XA1023: Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.
warning XA1023: Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.
```

```
error XA1023: Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.
```

## Issue
Expand All @@ -17,6 +21,8 @@ Google has deprecated the DX DEX Compiler in favor of the [D8 DEX
Compiler][d8]. On [February 1, 2021][dx], DX will no longer be a part
of Android SDK or Android Studio.

The DX DEX Compiler will not supported in .NET 5 or higher.

[d8]: https://developer.android.com/studio/command-line/d8
[dx]: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html

Expand Down
2 changes: 1 addition & 1 deletion build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.D8.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Designer.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DesignTime.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DX.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DX.targets" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.EmbeddedResource.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.FSharp.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Legacy.targets" />
Expand Down
11 changes: 10 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs

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

8 changes: 6 additions & 2 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,12 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</comment>
</data>
<data name="XA1023" xml:space="preserve">
<value>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</value>
<comment>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</comment>
<value>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</value>
<comment>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</comment>
</data>
<data name="XA1023_dotnet" xml:space="preserve">
<value>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</value>
<comment>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</comment>
</data>
<data name="XA1024" xml:space="preserve">
<value>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</value>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
11 changes: 8 additions & 3 deletions src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
{0} - The file name of the library</note>
</trans-unit>
<trans-unit id="XA1023">
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1023_dotnet">
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
</trans-unit>
<trans-unit id="XA1024">
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>
Expand Down
Loading

0 comments on commit 22bc14b

Please sign in to comment.