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

Use AsyncTask from xamarin-android-tools #9017

Merged
merged 15 commits into from
Jul 2, 2024
Merged
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xamarin/monodroid:main@e11d9a5af8f00a88d15bd87c777608f17c4ece78
xamarin/monodroid:main@038240c52a7dc2e66b9ad2ddb20b9886836eaec9
2 changes: 1 addition & 1 deletion Documentation/guides/MSBuildBestPractices.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ public class MyTask : AndroidTask
The benefit here is that if an unhandled exception is thrown, `MyTask`
will automatically generate proper error codes.

`AndroidAsyncTask` has an additional override for doing work on a
`AsyncTask` has an additional override for doing work on a
background thread:

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<ItemGroup>
<ProjectReference Include="..\xa-prep-tasks\xa-prep-tasks.csproj" />
<ProjectReference Include="..\..\external\xamarin-android-tools\src\Microsoft.Android.Build.BaseTasks\Microsoft.Android.Build.BaseTasks.csproj" />
<ProjectReference Include="..\..\external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Xamarin.Android.Tools.AndroidSdk.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
using System.Text;
using System.Diagnostics;

using Microsoft.Android.Build.Tasks;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

using Xamarin.Build;

using Tasks = System.Threading.Tasks;

namespace Xamarin.Android.Tools.BootstrapTasks
{
public class RunParallelCmds : AsyncTask
{
public override string TaskPrefix => "RPCMD";

[Required]
public ITaskItem[] Commands { get; set; }

Expand Down
2 changes: 0 additions & 2 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Tools.AndroidSdk.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Tools.AndroidSdk.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Android.Tools.Versions.props" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Build.AsyncTask.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Xamarin.Build.AsyncTask.pdb" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)K4os.Compression.LZ4.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ELFSharp.dll" />
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)ManifestOverlays\Timing.xml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Xamarin.Android.BuildTools.PrepTasks
{
public class XASleepInternal : AndroidAsyncTask
public class XASleepInternal : AsyncTask
{
public override string TaskPrefix => "XASI";
public int Milliseconds { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using System.Text;
using Xamarin.Android.Tools;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
Expand Down
3 changes: 1 addition & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/Aapt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
using System.Text.RegularExpressions;
using System.Collections.Generic;
using Xamarin.Android.Tools;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
public class Aapt : AndroidAsyncTask
public class Aapt : AsyncTask
{
public override string TaskPrefix => "APT";

Expand Down
3 changes: 1 addition & 2 deletions src/Xamarin.Android.Build.Tasks/Tasks/Aapt2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
using System.Collections.Concurrent;
using Xamarin.Android.Tools;
using ThreadingTasks = System.Threading.Tasks;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks {

public abstract class Aapt2 : AndroidAsyncTask {
public abstract class Aapt2 : AsyncTask {

private const int MAX_PATH = 260;
private const int ASCII_MAX_CHAR = 127;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;

using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
public class CalculateLayoutCodeBehind : AndroidAsyncTask
public class CalculateLayoutCodeBehind : AsyncTask
{
public override string TaskPrefix => "CLC";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
using Microsoft.Build.Utilities;

using Xamarin.Android.Tools;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
public class CompileNativeAssembly : AndroidAsyncTask
public class CompileNativeAssembly : AsyncTask
{
public override string TaskPrefix => "CNA";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;

using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
// TODO: add doc comments to the generated properties
//
public partial class GenerateLayoutBindings : AndroidAsyncTask
public partial class GenerateLayoutBindings : AsyncTask
{
public override string TaskPrefix => "GLB";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
using System.Linq;
using System.Text;
using Xamarin.Android.Tools;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
/// <summary>
/// We used to invoke aapt/aapt2 per library (many times!), this task does the work to generate R.java for libraries without calling aapt/aapt2.
/// </summary>
public partial class GenerateLibraryResources : AndroidAsyncTask
public partial class GenerateLibraryResources : AsyncTask
{
public override string TaskPrefix => "GLR";

Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/GetAotArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Xamarin.Android.Tasks
/// The <Aot/> task subclasses this in "legacy" Xamarin.Android.
/// The <GetAotAssemblies/> task subclasses this in .NET 6+.
/// </summary>
public abstract class GetAotArguments : AndroidAsyncTask
public abstract class GetAotArguments : AsyncTask
{
[Required]
public string AndroidApiLevel { get; set; } = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Xamarin.Android.Tasks;

public class GetMicrosoftNuGetPackagesMap : AndroidAsyncTask
public class GetMicrosoftNuGetPackagesMap : AsyncTask
{
static readonly HttpClient http_client = new HttpClient ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
using Microsoft.Build.Utilities;

using Xamarin.Android.Tools;
using Xamarin.Build;
using Microsoft.Android.Build.Tasks;

namespace Xamarin.Android.Tasks
{
public class LinkApplicationSharedLibraries : AndroidAsyncTask
public class LinkApplicationSharedLibraries : AsyncTask
{
public override string TaskPrefix => "LAS";

Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Xamarin.Android.Tasks;

public class MavenDownload : AndroidAsyncTask
public class MavenDownload : AsyncTask
{
public override string TaskPrefix => "MDT";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@
<ItemGroup>
<_ExtraPackageSource Include="$(PkgXamarin_LibZipSharp)\lib\$(TargetFrameworkNETStandard)\libZipSharp.pdb" />
<_ExtraPackageTarget Include="$(OutputPath)\libZipSharp.pdb" />
<_ExtraPackageSource Include="$(PkgXamarin_Build_AsyncTask)\lib\$(TargetFrameworkNETStandard)\Xamarin.Build.AsyncTask.pdb" />
<_ExtraPackageTarget Include="$(OutputPath)\Xamarin.Build.AsyncTask.pdb" />
<_ExtraPackageSource Include="$(PkgMono_Cecil)\lib\$(TargetFrameworkNETStandard)\Mono.Cecil.pdb" />
<_ExtraPackageTarget Include="$(OutputPath)\Mono.Cecil.pdb" />
<_ExtraPackageSource Include="$(PkgMono_Cecil)\lib\$(TargetFrameworkNETStandard)\Mono.Cecil.Mdb.pdb" />
Expand Down