Skip to content

Commit

Permalink
[msbuild] Merge the FindWatchOS2AppBundle and FindWatchOS2AppBundleTa…
Browse files Browse the repository at this point in the history
…skBase classes. (#18038)

We no longer need two have overridable logic for remote builds, so the
non-abstract task class and the abstract base class can be merged.

Also enable nullability and fix any issues.
  • Loading branch information
rolfbjarne authored Apr 13, 2023
1 parent a179f83 commit d35a8f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
24 changes: 0 additions & 24 deletions msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundle.cs

This file was deleted.

21 changes: 18 additions & 3 deletions msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundleTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,35 @@

using Xamarin.MacDev.Tasks;
using Xamarin.MacDev;
using Xamarin.Messaging.Build.Client;
using Xamarin.Utils;

#nullable enable

namespace Xamarin.iOS.Tasks {
public abstract class FindWatchOS2AppBundleTaskBase : XamarinTask {
public class FindWatchOS2AppBundle : XamarinTask, ICancelableTask {
#region Inputs

[Required]
public ITaskItem [] WatchAppReferences { get; set; }
public ITaskItem [] WatchAppReferences { get; set; } = Array.Empty<ITaskItem> ();

#endregion Inputs

#region Outputs

[Output]
public string WatchOS2AppBundle { get; set; }
public string WatchOS2AppBundle { get; set; } = string.Empty;

#endregion

public override bool Execute ()
{
if (ShouldExecuteRemotely ()) {
var taskRunner = new TaskRunner (SessionId, BuildEngine4);
taskRunner.FixReferencedItems (WatchAppReferences);
return taskRunner.RunAsync (this).Result;
}

var pwd = PathUtils.ResolveSymbolicLinks (Environment.CurrentDirectory);

if (WatchAppReferences.Length > 0) {
Expand All @@ -35,5 +44,11 @@ public override bool Execute ()

return !Log.HasLoggedErrors;
}

public void Cancel ()
{
if (ShouldExecuteRemotely ())
BuildConnection.CancelAsync (BuildEngine4).Wait ();
}
}
}

6 comments on commit d35a8f4

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.