From d24f7fe687fc18efc72efccb7363050e0693c08c Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Tue, 20 Mar 2018 13:42:06 -0400 Subject: [PATCH 1/9] [msbuild] Skip reference assemblies passed to mtouch - Fixes issue #3199: Could not AOT the assembly System.Runtime.CompilerServices.Unsafe.dll (MT3001) (https://github.com/xamarin/xamarin-macios/issues/3199) - Test case: https://www.dropbox.com/s/kxt3isgzn74nq35/Issue3199.zip?dl=0 Problem ======= Given a Nuget Package added via the "package reference" mechanism and the said package having netstandard `lib` **and** `ref` folders; MTouch was getting reference assemblies and was trying to AOT them. This resulted in an error as those assemblies are only facades. Solution ======== Skipping the assemblies that have `/ref/` in their path seems like the simplest and yet most functional solution to the problem. As it turn out, there is some logic already in place that copies the `lib` assemblies to the destination folder. It seems equivalent to marking them as "Local Copy". What this does is that it makes those assemblies available to msbuild via `@(ReferenceCopyLocalPaths)`. This gives us the opportunity to safely remove the `ref` assemblies from `@(ReferencePath)`. *Note: `mtouch` is getting the assemblies to reference via a combination of `@(ReferencePath)` and `@(ReferenceCopyLocalPaths)`.* --- msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index 7acf4c97b5a2..dcea076f00dd 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -780,7 +780,9 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. Outputs="$(_NativeExecutable);$(DeviceSpecificOutputPath)mtouch.stamp"> - + + + Date: Thu, 22 Mar 2018 15:08:12 -0400 Subject: [PATCH 2/9] Bye bye hardcoded path comparison --- msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index dcea076f00dd..dc73ea995a05 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -780,8 +780,12 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. Outputs="$(_NativeExecutable);$(DeviceSpecificOutputPath)mtouch.stamp"> - - + + + + + + From fb7b79d59a4b658443a26288f9595af4bbcffcae Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Thu, 22 Mar 2018 15:16:23 -0400 Subject: [PATCH 3/9] Even simpler --- msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets index dc73ea995a05..8edccd355be7 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets @@ -780,13 +780,12 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. Outputs="$(_NativeExecutable);$(DeviceSpecificOutputPath)mtouch.stamp"> - - - + + Date: Fri, 23 Mar 2018 16:50:54 -0400 Subject: [PATCH 4/9] [msbuild] Add monotouch-test test --- tests/monotouch-test/Issue3199Test.cs | 26 ++++++++++++++++++++++ tests/monotouch-test/monotouch-test.csproj | 5 +++++ 2 files changed, 31 insertions(+) create mode 100644 tests/monotouch-test/Issue3199Test.cs diff --git a/tests/monotouch-test/Issue3199Test.cs b/tests/monotouch-test/Issue3199Test.cs new file mode 100644 index 000000000000..13706cecb5f9 --- /dev/null +++ b/tests/monotouch-test/Issue3199Test.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using Foundation; +using NUnit.Framework; + +namespace MonoTouchFixtures { + [TestFixture] + [Preserve (AllMembers = true)] + public class Issue3199Test { + + [Test] + // FIXME: Replace by actual MSBuild test when we transition the tests from xbuild to MSBuild: https://github.com/xamarin/xamarin-macios/issues/3810 + public void NetstandardPackageReferenceTest () + { + // The error only happens when *building* for device, when we try to AOT a reference assembly. + TestRuntime.AssertDevice (); + + var dt = new KeyValuePair [2]; + // The assert is pretty irrelevent but a test without an assert isn't a real test :P + // What matter here is that the call requires `System.Runtime.CompilerServices.Unsafe` which comes from a NugetPackage added via + // the PackageReference mechanism. Without the fix to https://github.com/xamarin/xamarin-macios/issues/3199 we get a build error for monotouch-test. + Assert.DoesNotThrow (() => Unsafe.As, byte> (ref dt [0]), "Should not throw"); + } + } +} diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index 76025ed2bcfb..6f6d7d12df71 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -339,6 +339,11 @@ + + + 4.4.0 + + From 044b34b6adec0b62c71705d193aae08f68bd83a1 Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Mon, 26 Mar 2018 10:31:12 -0400 Subject: [PATCH 5/9] [makefile] Enable msbuild for generated makefiles The generated makefile that allow us to run tests such as `monotouch-test` is now using msbuild. In addition instead of doing a `/t:Build` it;s making use of msbuild `/restore` target which will automatically restore all NuGet packages and build the project. --- tests/xharness/MakefileGenerator.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/xharness/MakefileGenerator.cs b/tests/xharness/MakefileGenerator.cs index d2e9a492c2cb..910c67b85a38 100644 --- a/tests/xharness/MakefileGenerator.cs +++ b/tests/xharness/MakefileGenerator.cs @@ -150,11 +150,11 @@ public static void CreateMacMakefile (Harness harness, IEnumerable ta writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Build), "{0}", target.ProjectPath.Replace (" ", "\\ ") + " " + guiUnitDependency); writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore tests-mac.sln"); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Clean), ""); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Exec), ""); @@ -308,7 +308,7 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); } writer.WriteTarget ("build{0}-sim{3}-{1}", "{2}", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); // clean sim project target @@ -318,7 +318,7 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); } writer.WriteTarget ("clean{0}-sim{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); // run sim project target @@ -411,15 +411,15 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); writer.WriteTarget ("build{0}-dev32-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ ")); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget ("build{0}-dev64-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ ")); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } else { writer.WriteTarget ("build{0}-dev{3}-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } @@ -435,15 +435,15 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); writer.WriteTarget ("clean{0}-dev32-{1}", string.Empty, make_escaped_suffix, make_escaped_name); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget ("clean{0}-dev64-{1}", string.Empty, make_escaped_suffix, make_escaped_name); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } else { writer.WriteTarget ("clean{0}-dev{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } From 72a633dc5b729e9da7528ca4256033a0bec96c04 Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Mon, 26 Mar 2018 16:07:54 -0400 Subject: [PATCH 6/9] [xharness] Use msbuild in some places too - Removed `new string [] { "Import", "Project" },` which is causing issues when using msbuild (hopefully it's not breaking things since we're mostly using msbuild now). --- tests/xharness/Jenkins.cs | 8 ++++++++ tests/xharness/ProjectFileExtensions.cs | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index 4907c1eaf5b6..1f9af08b81df 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -324,6 +324,7 @@ IEnumerable CreateRunSimulatorTasks () Platform = pair.Item2, Ignored = pair.Item3, TestName = project.Name, + UseMSBuild = true, }; derived.CloneTestProject (pair.Item1); var simTasks = CreateRunSimulatorTaskAsync (derived); @@ -365,6 +366,7 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_Unified64, TestName = project.Name, + UseMSBuild = true, }; build64.CloneTestProject (project); rv.Add (new RunDeviceTask (build64, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports64Bit)) { Ignored = ignored || !IncludeiOS }); @@ -375,6 +377,7 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_Unified32, TestName = project.Name, + UseMSBuild = true, }; build32.CloneTestProject (project); rv.Add (new RunDeviceTask (build32, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports32Bit)) { Ignored = ignored || !IncludeiOS }); @@ -386,6 +389,7 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_TodayExtension64, TestName = project.Name, + UseMSBuild = true, }; buildToday.CloneTestProject (todayProject); rv.Add (new RunDeviceTask (buildToday, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports64Bit)) { Ignored = ignored || !IncludeiOSExtensions }); @@ -399,6 +403,7 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.tvOS, TestName = project.Name, + UseMSBuild = true, }; buildTV.CloneTestProject (tvOSProject); rv.Add (new RunDeviceTask (buildTV, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.tvOS)) { Ignored = ignored || !IncludetvOS }); @@ -412,6 +417,7 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.watchOS, TestName = project.Name, + UseMSBuild = true, }; buildWatch.CloneTestProject (watchOSProject); rv.Add (new RunDeviceTask (buildWatch, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.watchOS)) { Ignored = ignored || !IncludewatchOS }); @@ -2664,6 +2670,8 @@ protected override async Task ExecuteAsync () args.Append ($"/p:Platform={ProjectPlatform} "); if (SpecifyConfiguration) args.Append ($"/p:Configuration={ProjectConfiguration} "); + if (UseMSBuild) + args.Append ("/restore "); args.Append (StringUtils.Quote (ProjectFile)); xbuild.StartInfo.Arguments = args.ToString (); SetEnvironmentVariables (xbuild); diff --git a/tests/xharness/ProjectFileExtensions.cs b/tests/xharness/ProjectFileExtensions.cs index d158dd6464df..9dafa1c27b5f 100644 --- a/tests/xharness/ProjectFileExtensions.cs +++ b/tests/xharness/ProjectFileExtensions.cs @@ -767,7 +767,6 @@ public static void ResolveAllPaths (this XmlDocument csproj, string project_path new string [] { "ObjcBindingCoreSource", "Include" }, new string [] { "ObjcBindingNativeLibrary", "Include" }, new string [] { "ObjcBindingNativeFramework", "Include" }, - new string [] { "Import", "Project" }, new string [] { "FilesToCopy", "Include" }, new string [] { "FilesToCopyFoo", "Include" }, new string [] { "FilesToCopyFooBar", "Include" }, From 6e9601737d1826964a44be35dd4fc156fdff2f7a Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Tue, 27 Mar 2018 17:42:52 -0400 Subject: [PATCH 7/9] Revert "[msbuild] Add monotouch-test test" This reverts commit 3e7633561e8d3a06b368bff8a23a255f3692f66d. --- tests/monotouch-test/Issue3199Test.cs | 26 ---------------------- tests/monotouch-test/monotouch-test.csproj | 5 ----- 2 files changed, 31 deletions(-) delete mode 100644 tests/monotouch-test/Issue3199Test.cs diff --git a/tests/monotouch-test/Issue3199Test.cs b/tests/monotouch-test/Issue3199Test.cs deleted file mode 100644 index 13706cecb5f9..000000000000 --- a/tests/monotouch-test/Issue3199Test.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using Foundation; -using NUnit.Framework; - -namespace MonoTouchFixtures { - [TestFixture] - [Preserve (AllMembers = true)] - public class Issue3199Test { - - [Test] - // FIXME: Replace by actual MSBuild test when we transition the tests from xbuild to MSBuild: https://github.com/xamarin/xamarin-macios/issues/3810 - public void NetstandardPackageReferenceTest () - { - // The error only happens when *building* for device, when we try to AOT a reference assembly. - TestRuntime.AssertDevice (); - - var dt = new KeyValuePair [2]; - // The assert is pretty irrelevent but a test without an assert isn't a real test :P - // What matter here is that the call requires `System.Runtime.CompilerServices.Unsafe` which comes from a NugetPackage added via - // the PackageReference mechanism. Without the fix to https://github.com/xamarin/xamarin-macios/issues/3199 we get a build error for monotouch-test. - Assert.DoesNotThrow (() => Unsafe.As, byte> (ref dt [0]), "Should not throw"); - } - } -} diff --git a/tests/monotouch-test/monotouch-test.csproj b/tests/monotouch-test/monotouch-test.csproj index 6f6d7d12df71..76025ed2bcfb 100644 --- a/tests/monotouch-test/monotouch-test.csproj +++ b/tests/monotouch-test/monotouch-test.csproj @@ -339,11 +339,6 @@ - - - 4.4.0 - - From d17b5413371fce98db5048838d890bd33cd9e140 Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Tue, 27 Mar 2018 17:43:06 -0400 Subject: [PATCH 8/9] Revert "[makefile] Enable msbuild for generated makefiles" This reverts commit 044b34b6adec0b62c71705d193aae08f68bd83a1. --- tests/xharness/MakefileGenerator.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/xharness/MakefileGenerator.cs b/tests/xharness/MakefileGenerator.cs index 910c67b85a38..d2e9a492c2cb 100644 --- a/tests/xharness/MakefileGenerator.cs +++ b/tests/xharness/MakefileGenerator.cs @@ -150,11 +150,11 @@ public static void CreateMacMakefile (Harness harness, IEnumerable ta writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Build), "{0}", target.ProjectPath.Replace (" ", "\\ ") + " " + guiUnitDependency); writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore tests-mac.sln"); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Clean), ""); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Exec), ""); @@ -308,7 +308,7 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); } writer.WriteTarget ("build{0}-sim{3}-{1}", "{2}", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); // clean sim project target @@ -318,7 +318,7 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); } writer.WriteTarget ("clean{0}-sim{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); // run sim project target @@ -411,15 +411,15 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); writer.WriteTarget ("build{0}-dev32-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ ")); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget ("build{0}-dev64-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ ")); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } else { writer.WriteTarget ("build{0}-dev{3}-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /restore $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } @@ -435,15 +435,15 @@ public static void CreateMakefile (Harness harness, IEnumerable u writer.WriteLine (); writer.WriteTarget ("clean{0}-dev32-{1}", string.Empty, make_escaped_suffix, make_escaped_name); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); writer.WriteTarget ("clean{0}-dev64-{1}", string.Empty, make_escaped_suffix, make_escaped_name); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } else { writer.WriteTarget ("clean{0}-dev{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix); - writer.WriteLine ("\t$(Q_MSBUILD) $(SYSTEM_MSBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); + writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath); writer.WriteLine (); } From 598956eb2f171b8242a081d36860ffd59a99dbe4 Mon Sep 17 00:00:00 2001 From: Vincent Dondain Date: Tue, 27 Mar 2018 17:43:24 -0400 Subject: [PATCH 9/9] Revert "[xharness] Use msbuild in some places too" This reverts commit 72a633dc5b729e9da7528ca4256033a0bec96c04. --- tests/xharness/Jenkins.cs | 8 -------- tests/xharness/ProjectFileExtensions.cs | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index 1f9af08b81df..4907c1eaf5b6 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -324,7 +324,6 @@ IEnumerable CreateRunSimulatorTasks () Platform = pair.Item2, Ignored = pair.Item3, TestName = project.Name, - UseMSBuild = true, }; derived.CloneTestProject (pair.Item1); var simTasks = CreateRunSimulatorTaskAsync (derived); @@ -366,7 +365,6 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_Unified64, TestName = project.Name, - UseMSBuild = true, }; build64.CloneTestProject (project); rv.Add (new RunDeviceTask (build64, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports64Bit)) { Ignored = ignored || !IncludeiOS }); @@ -377,7 +375,6 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_Unified32, TestName = project.Name, - UseMSBuild = true, }; build32.CloneTestProject (project); rv.Add (new RunDeviceTask (build32, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports32Bit)) { Ignored = ignored || !IncludeiOS }); @@ -389,7 +386,6 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.iOS_TodayExtension64, TestName = project.Name, - UseMSBuild = true, }; buildToday.CloneTestProject (todayProject); rv.Add (new RunDeviceTask (buildToday, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.iOS && dev.Supports64Bit)) { Ignored = ignored || !IncludeiOSExtensions }); @@ -403,7 +399,6 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.tvOS, TestName = project.Name, - UseMSBuild = true, }; buildTV.CloneTestProject (tvOSProject); rv.Add (new RunDeviceTask (buildTV, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.tvOS)) { Ignored = ignored || !IncludetvOS }); @@ -417,7 +412,6 @@ IEnumerable CreateRunDeviceTasks () ProjectPlatform = "iPhone", Platform = TestPlatform.watchOS, TestName = project.Name, - UseMSBuild = true, }; buildWatch.CloneTestProject (watchOSProject); rv.Add (new RunDeviceTask (buildWatch, Devices.ConnectedDevices.Where ((dev) => dev.DevicePlatform == DevicePlatform.watchOS)) { Ignored = ignored || !IncludewatchOS }); @@ -2670,8 +2664,6 @@ protected override async Task ExecuteAsync () args.Append ($"/p:Platform={ProjectPlatform} "); if (SpecifyConfiguration) args.Append ($"/p:Configuration={ProjectConfiguration} "); - if (UseMSBuild) - args.Append ("/restore "); args.Append (StringUtils.Quote (ProjectFile)); xbuild.StartInfo.Arguments = args.ToString (); SetEnvironmentVariables (xbuild); diff --git a/tests/xharness/ProjectFileExtensions.cs b/tests/xharness/ProjectFileExtensions.cs index 9dafa1c27b5f..d158dd6464df 100644 --- a/tests/xharness/ProjectFileExtensions.cs +++ b/tests/xharness/ProjectFileExtensions.cs @@ -767,6 +767,7 @@ public static void ResolveAllPaths (this XmlDocument csproj, string project_path new string [] { "ObjcBindingCoreSource", "Include" }, new string [] { "ObjcBindingNativeLibrary", "Include" }, new string [] { "ObjcBindingNativeFramework", "Include" }, + new string [] { "Import", "Project" }, new string [] { "FilesToCopy", "Include" }, new string [] { "FilesToCopyFoo", "Include" }, new string [] { "FilesToCopyFooBar", "Include" },