From 9afb67ca5af752b43d60f072fea19a797d71089f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 15 Jan 2026 13:12:41 +0100 Subject: [PATCH] [msbuild] Simplify DetectSdkLocation to not detect whether we're building for the simulator or not. We already know if we're building for the simulator or not when calling the DetectSdkLocation task, so just tell it. --- .../Xamarin.Shared.Sdk.DefaultItems.targets | 7 +--- .../Tasks/DetectSdkLocation.cs | 35 ++----------------- msbuild/Xamarin.Shared/Xamarin.Shared.targets | 4 +-- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets index b266a902fd6f..b970adc12d0d 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets @@ -59,13 +59,8 @@ - - <_IsDotNetSimulatorBuild Condition="$(RuntimeIdentifier.Contains('simulator')) Or $(RuntimeIdentifiers.Contains('simulator'))">true - <_IsDotNetSimulatorBuild Condition="'$(_IsDotNetSimulatorBuild)' == ''">false - - - iPhoneSimulator + iPhoneSimulator iPhone diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocation.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocation.cs index 8b62df6c88e7..084c0cc3ecd3 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocation.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSdkLocation.cs @@ -15,13 +15,10 @@ public class DetectSdkLocations : XamarinTask, ICancelableTask { const string SdkVersionDefaultValue = "default"; #region Inputs - public string TargetArchitectures { - get; set; - } = ""; - - public string IsDotNetSimulatorBuild { + [Required] + public bool SdkIsSimulator { get; set; - } = ""; + } #endregion Inputs @@ -37,11 +34,6 @@ public string SdkDevPath { get; set; } = ""; - [Output] - public bool SdkIsSimulator { - get; set; - } - [Output] public string SdkPlatform { get; set; @@ -154,8 +146,6 @@ bool ExecuteImpl () AppleSdkSettings.Init (); - SetIsSimulator (); - if (EnsureAppleSdkRoot ()) EnsureSdkPath (); EnsureXamarinSdkRoot (); @@ -165,25 +155,6 @@ bool ExecuteImpl () return !Log.HasLoggedErrors; } - void SetIsSimulator () - { - switch (Platform) { - case ApplePlatform.MacCatalyst: - case ApplePlatform.MacOSX: - return; - } - - TargetArchitecture architectures; - if (string.IsNullOrEmpty (TargetArchitectures) || !Enum.TryParse (TargetArchitectures, out architectures)) - architectures = TargetArchitecture.Default; - - if (!string.IsNullOrEmpty (IsDotNetSimulatorBuild)) { - SdkIsSimulator = string.Equals (IsDotNetSimulatorBuild, "true", StringComparison.OrdinalIgnoreCase); - } else { - SdkIsSimulator = (architectures & (TargetArchitecture.i386 | TargetArchitecture.x86_64)) != 0; - } - } - protected bool EnsureAppleSdkRoot () { var currentSdk = CurrentSdk; diff --git a/msbuild/Xamarin.Shared/Xamarin.Shared.targets b/msbuild/Xamarin.Shared/Xamarin.Shared.targets index 83d5757f6bde..66a7012475cf 100644 --- a/msbuild/Xamarin.Shared/Xamarin.Shared.targets +++ b/msbuild/Xamarin.Shared/Xamarin.Shared.targets @@ -2067,10 +2067,9 @@ Copyright (C) 2018 Microsoft. All rights reserved. @@ -2078,7 +2077,6 @@ Copyright (C) 2018 Microsoft. All rights reserved. -