Skip to content

Commit

Permalink
[msbuild] Merge the DetectSdkLocations[TaskBase] classes. (#19977)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Feb 2, 2024
1 parent 4ecbdab commit bb07329
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
using Microsoft.Build.Framework;

using Xamarin.Localization.MSBuild;
using Xamarin.Messaging.Build.Client;
using Xamarin.Utils;

// Disable until we get around to enable + fix any issues.
#nullable disable

namespace Xamarin.MacDev.Tasks {
public abstract class DetectSdkLocationsCoreTaskBase : XamarinTask {
public class DetectSdkLocations : XamarinTask, ICancelableTask {
const string SdkVersionDefaultValue = "default";
#region Inputs

public string TargetArchitectures {
Expand Down Expand Up @@ -183,6 +185,15 @@ void EnsureXamarinSdkRoot ()

public override bool Execute ()
{
if (ShouldExecuteRemotely ()) {
// The new targets do not support the "default" value for the MtouchSdkVersion
// So we fix it to not break existing projects that has this value defined in the .csproj
if (!string.IsNullOrEmpty (SdkVersion) && SdkVersionDefaultValue.Equals (SdkVersion, StringComparison.OrdinalIgnoreCase))
SdkVersion = string.Empty;

return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;
}

AppleSdkSettings.Init ();

SetIsSimulator ();
Expand Down Expand Up @@ -258,5 +269,11 @@ protected string DirExists (string checkingFor, params string [] paths)
return null;
}
}

public void Cancel ()
{
if (ShouldExecuteRemotely ())
BuildConnection.CancelAsync (BuildEngine4).Wait ();
}
}
}
30 changes: 0 additions & 30 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocations.cs

This file was deleted.

6 comments on commit bb07329

@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.