From 8eec5f0711e7300fdb21d56bae464cf87888451b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 30 May 2024 17:06:09 +0200 Subject: [PATCH 1/5] [tests] Add test case. --- tests/dotnet/UnitTests/WindowsTest.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/dotnet/UnitTests/WindowsTest.cs b/tests/dotnet/UnitTests/WindowsTest.cs index af089615c563..25c242da2fb0 100644 --- a/tests/dotnet/UnitTests/WindowsTest.cs +++ b/tests/dotnet/UnitTests/WindowsTest.cs @@ -288,6 +288,14 @@ public void PluralRuntimeIdentifiersWithHotRestart (ApplePlatform platform, stri DotNetProjectTest.PluralRuntimeIdentifiersImpl (platform, runtimeIdentifiers, properties, isUsingHotRestart: true); } + [Category ("RemoteWindows")] + [TestCase (ApplePlatform.iOS, "ios-arm64")] + public void PluralRuntimeIdentifiersWithRemoteMac (ApplePlatform platform, string runtimeIdentifiers) + { + var properties = AddRemoteProperties (); + DotNetProjectTest.PluralRuntimeIdentifiersImpl (platform, runtimeIdentifiers, properties); + } + static void AssertWarningsEqual (IList expected, IList actual, string message) { if (expected.Count == actual.Count) { @@ -368,14 +376,17 @@ public void RemoteTest (ApplePlatform platform, string runtimeIdentifiers) Assert.AreEqual ("3.14", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString"); } - protected void AddRemoteProperties (Dictionary properties) + protected Dictionary AddRemoteProperties (Dictionary? properties = null) { + properties ??= new Dictionary (); properties ["ServerAddress"] = Environment.GetEnvironmentVariable ("MAC_AGENT_IP") ?? string.Empty; properties ["ServerUser"] = Environment.GetEnvironmentVariable ("MAC_AGENT_USER") ?? string.Empty; properties ["ServerPassword"] = Environment.GetEnvironmentVariable ("XMA_PASSWORD") ?? string.Empty; if (!string.IsNullOrEmpty (properties ["ServerUser"])) properties ["EnsureRemoteConnection"] = "true"; + + return properties; } protected Dictionary AddHotRestartProperties (Dictionary? properties = null) From 4083cfe907feed9ee6e7ed74a53ce5a44782a9cd Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 11 Jun 2024 19:57:03 +0200 Subject: [PATCH 2/5] Flail a bit. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index ddae59a13225..707f1431bb4a 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -451,7 +451,7 @@ - + From a80d4f9e10b572ce24d05700a0bc35e11e3728fe Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 1 Jul 2024 19:31:37 +0200 Subject: [PATCH 3/5] Revert "Flail a bit." This reverts commit 4083cfe907feed9ee6e7ed74a53ce5a44782a9cd. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 707f1431bb4a..ddae59a13225 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -451,7 +451,7 @@ - + From 0f4c41e5c545e30d6009011458c7fa33ca8aaf48 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 18 Jun 2024 15:59:46 +0200 Subject: [PATCH 4/5] Misc remote fix --- dotnet/targets/Xamarin.Shared.Sdk.targets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index ddae59a13225..0b011bf332f4 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1662,7 +1662,11 @@ - + From 526f085cbb819799cc04c65ffd651b670c5826e4 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 19 Jun 2024 14:24:01 +0200 Subject: [PATCH 5/5] [msbuild] Teach the WriteItemsToFile about remote Macs. --- .../Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs index e2988f41b671..d178ba3eef69 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs @@ -8,8 +8,10 @@ using Microsoft.Build.Tasks; using System.Xml.Linq; +using Xamarin.Messaging.Build.Client; + namespace Xamarin.MacDev.Tasks { - public class WriteItemsToFile : XamarinTask { + public class WriteItemsToFile : XamarinTask, ICancelableTask { static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003"); static readonly XName ProjectElementName = XmlNs + "Project"; @@ -34,6 +36,9 @@ public class WriteItemsToFile : XamarinTask { public override bool Execute () { + if (ShouldExecuteRemotely ()) + return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; + Write (this, File?.ItemSpec, Items, ItemName, Overwrite, IncludeMetadata); return true; } @@ -78,5 +83,11 @@ static IEnumerable CreateMetadataFromItem (ITaskItem item, bool includ return Enumerable.Empty (); } + + public void Cancel () + { + if (ShouldExecuteRemotely ()) + BuildConnection.CancelAsync (BuildEngine4).Wait (); + } } }