From 62c9e03ad1fce57c35b0a776a246cef35e798ac2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Fri, 20 May 2022 12:39:31 +0200 Subject: [PATCH] [dotnet] Make sure to not run the linker when we're on a disconnected Windows build. This also means that we shouldn't load the linker's output. Note that we need to check _LoadLinkerOutput even if we've already disabled the linker, because there may be linker output from a previous (connected) build, and we don't want to load that. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1542438. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 7 ++++++- tests/dotnet/UnitTests/ProjectTest.cs | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index f20e4a4e5cda..4425655fe534 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -267,6 +267,11 @@ true + + <_PreviousPublishTrimmedValue>$(PublishTrimmed) + + + @@ -754,7 +759,7 @@ - + diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index bb5ddd20eb3c..6468d3f37a93 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -418,7 +418,8 @@ public void InvalidRuntimeIdentifiers (ApplePlatform platform, string runtimeIde [Test] [TestCase ("iossimulator-x64", false)] [TestCase ("ios-arm64", true)] - public void IsNotMacBuild (string runtimeIdentifier, bool isDeviceBuild) + [TestCase ("ios-arm64", true, "PublishTrimmed=true;UseInterpreter=true")] + public void IsNotMacBuild (string runtimeIdentifier, bool isDeviceBuild, string extraProperties = null) { if (isDeviceBuild) Configuration.AssertDeviceAvailable (); @@ -429,6 +430,12 @@ public void IsNotMacBuild (string runtimeIdentifier, bool isDeviceBuild) Clean (project_path); var properties = GetDefaultProperties (runtimeIdentifier); properties ["IsMacEnabled"] = "false"; + if (extraProperties is not null) { + foreach (var assignment in extraProperties.Split (';')) { + var split = assignment.Split ('='); + properties [split [0]] = split [1]; + } + } var result = DotNet.AssertBuild (project_path, properties); AssertThatLinkerDidNotExecute (result); var appExecutable = Path.Combine (appPath, Path.GetFileName (project_path));