diff --git a/Make.config b/Make.config index 4301b9ea563c..bad444a4a984 100644 --- a/Make.config +++ b/Make.config @@ -247,7 +247,7 @@ SYSTEM_CSC=$(MONO_PREFIX)/bin/csc SYSTEM_SN=$(MONO_PREFIX)/bin/sn SYSTEM_MONO=$(MONO_PREFIX)/bin/mono SYSTEM_MONO32=$(MONO_PREFIX)/bin/mono32 -SYSTEM_XBUILD=$(MONO_PREFIX)/bin/xbuild +SYSTEM_XBUILD=$(MONO_PREFIX)/bin/msbuild SYSTEM_MSBUILD=unset MSBuildExtensionsPath && $(MONO_PREFIX)/bin/msbuild SYSTEM_RESGEN=$(MONO_PREFIX)/bin/resgen diff --git a/fsharp/Makefile b/fsharp/Makefile index 67154c773055..28a2fc0e1efb 100644 --- a/fsharp/Makefile +++ b/fsharp/Makefile @@ -156,8 +156,8 @@ build/%.dll: $(BIN_DIR)/%.dll | build/monotouch build/xamarinmacmobile build/xam $(Q) cp $< $@ $(Q_SN) MONO_CFG_DIR="$(TOP)" sn -q -R "$@" "$(PRODUCT_KEY_PATH)" -build.stamp: export XBUILD_FRAMEWORK_FOLDERS_PATH=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -build.stamp: export MSBuildExtensionsPath=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +build.stamp: export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +build.stamp: export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild build.stamp: $(FSHARP_FILES) $(FSHARP_PATH)/Makefile $(MAKE) -C $(FSHARP_PATH)/src/fsharp build-proto $(MAKE) -C $(FSHARP_PATH)/src/fsharp $(FSHARP_BUILD_TARGETS) diff --git a/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj b/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj index 8b8c956adf44..5587059785ec 100644 --- a/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj +++ b/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj @@ -24,11 +24,10 @@ - - - - - + + + + @@ -53,4 +52,4 @@ Xamarin.MacDev.Tasks.Core - \ No newline at end of file + diff --git a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj index 842b8a801a65..db34a0e1d5ba 100644 --- a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj +++ b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj @@ -23,11 +23,10 @@ - - - - - + + + + diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/MsBuildTasks/CopyBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/MsBuildTasks/CopyBase.cs index 82cd294c4439..69ebc90f00f3 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/MsBuildTasks/CopyBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks.Core/MsBuildTasks/CopyBase.cs @@ -3,6 +3,5 @@ public abstract class CopyBase : Copy { public string SessionId { get; set; } - public bool UseSymboliclinksIfPossible { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Xamarin.MacDev.Tasks.Core.csproj b/msbuild/Xamarin.MacDev.Tasks.Core/Xamarin.MacDev.Tasks.Core.csproj index cacfe91b1773..8b8c6b2e29fa 100644 --- a/msbuild/Xamarin.MacDev.Tasks.Core/Xamarin.MacDev.Tasks.Core.csproj +++ b/msbuild/Xamarin.MacDev.Tasks.Core/Xamarin.MacDev.Tasks.Core.csproj @@ -33,10 +33,9 @@ - - - - + + + diff --git a/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj b/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj index 61692007b979..ed47aba4f58a 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj +++ b/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj @@ -33,10 +33,9 @@ - - - - + + + diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetPropertyValueTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetPropertyValueTaskBase.cs index 422ec8a533de..74eef97aee85 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetPropertyValueTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/GetPropertyValueTaskBase.cs @@ -55,7 +55,7 @@ static bool TryRunMSBuildGetPropertyValueTarget (string path, string propertyNam arguments = string.Format ("{0} /p:TargetFrameworkIdentifier={1}", arguments, targetFrameworkIdentifier); } - var psi = new ProcessStartInfo ("/Library/Frameworks/Mono.framework/Commands/xbuild", arguments); + var psi = new ProcessStartInfo ("/Library/Frameworks/Mono.framework/Commands/msbuild", arguments); psi.UseShellExecute = false; psi.RedirectStandardError = true; diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj index 91f579db7c49..45fc042c9530 100644 --- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj +++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj @@ -32,14 +32,13 @@ true - + - - - + + + - diff --git a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj index 962b723cb94f..fb7b1341be7f 100644 --- a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj +++ b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj @@ -95,9 +95,9 @@ - - - + + + diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/BindingProject.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/BindingProject.cs index a30ebf880834..6f431baee16c 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/BindingProject.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/BindingProject.cs @@ -24,7 +24,7 @@ public void BuildTest () AppBundlePath = mtouchPaths.AppBundlePath; var dllPath = Path.Combine(mtouchPaths.ProjectBinPath, "bindings-test.dll"); - Engine.GlobalProperties.SetProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); RunTarget (proj, "Build", 0); Assert.IsTrue (File.Exists (dllPath), "{1} binding dll does not exist: {0} ", dllPath, Platform); @@ -43,7 +43,7 @@ public void FrameworkTest () AppBundlePath = mtouchPaths.AppBundlePath; var dllPath = Path.Combine(mtouchPaths.ProjectBinPath, "bindings-test.dll"); - Engine.GlobalProperties.SetProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); RunTarget (proj, "Build", 0); Assert.IsTrue (File.Exists (dllPath), "{1} binding dll does not exist: {0} ", dllPath, Platform); diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs index 2feaea790b00..3a67d395a849 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs @@ -3,9 +3,9 @@ using System.Linq; using System.Collections; -using NUnit.Framework; +using Microsoft.Build.Evaluation; -using Microsoft.Build.BuildEngine; +using NUnit.Framework; namespace Xamarin.iOS.Tasks { @@ -30,8 +30,8 @@ public void TestACToolTaskCatchesJsonException () var project = SetupProject (Engine, csproj); AppBundlePath = mtouchPaths ["app_bundlepath"]; - Engine.GlobalProperties.SetProperty("Platform", platform); - Engine.GlobalProperties.SetProperty("Configuration", config); + Engine.ProjectCollection.SetGlobalProperty("Platform", platform); + Engine.ProjectCollection.SetGlobalProperty("Configuration", config); if (clean) { RunTarget (project, "Clean"); @@ -56,8 +56,9 @@ public void TestACToolTaskCatchesJsonException () } project = SetupProject (Engine, mtouchPaths.ProjectCSProjPath); + var projectInstance = project.CreateProjectInstance (); - Engine.BuildProject (project, new [] { target }, new Hashtable { {"Platform", "iPhone"} }, BuildSettings.None); + Engine.BuildProject (projectInstance, new [] { target }, new Hashtable { {"Platform", "iPhone"} }); if (Engine.Logger.ErrorEvents.Count != 1) { string messages = string.Empty; if (Engine.Logger.ErrorEvents.Count > 0) diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs index 289ddbe10280..d638f2505827 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs @@ -35,8 +35,8 @@ public void BuildExtension (string hostAppName, string extensionName, string bun AppBundlePath = mtouchPaths ["app_bundlepath"]; string extensionPath = Path.Combine(AppBundlePath, "PlugIns", extensionName + ".appex"); - Engine.GlobalProperties.SetProperty ("Platform", platform); - Engine.GlobalProperties.SetProperty ("Configuration", config); + Engine.ProjectCollection.SetGlobalProperty ("Platform", platform); + Engine.ProjectCollection.SetGlobalProperty ("Configuration", config); RunTarget (proj, "Clean"); Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, bundlePath); diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/WatchKit.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/WatchKit.cs index dfe6912ebbd1..3aa0b94acbd4 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/WatchKit.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Extensions/WatchKit.cs @@ -47,7 +47,7 @@ public void InvalidBundleIdTest () File.WriteAllText (appInfoPath, appInfoContents.Replace ("com.xamarin.MyWatchApp", "com.xamarin.MyWatchAppX")); var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath); - Engine.GlobalProperties.SetProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); AppBundlePath = mtouchPaths ["app_bundlepath"]; RunTarget (proj, "Build", 2); Assert.AreEqual ("The App Extension 'WatchExtension' has an invalid CFBundleIdentifier (com.xamarin.MyWatchApp.WatchExtension), it does not begin with the main app bundle's CFBundleIdentifier (com.xamarin.MyWatchAppX).", Engine.Logger.ErrorEvents [0].Message, "#1"); @@ -73,12 +73,12 @@ public void CreateIpa () AppBundlePath = mtouchPaths.AppBundlePath; - Engine.GlobalProperties.SetProperty ("Platform", Platform); - Engine.GlobalProperties.SetProperty ("BuildIpa", "true"); - Engine.GlobalProperties.SetProperty ("IpaIncludeArtwork", "true"); - Engine.GlobalProperties.SetProperty ("CodesignProvision", "Automatic"); // Provisioning profile - Engine.GlobalProperties.SetProperty ("CodesignKey", "iPhone Developer"); - Engine.GlobalProperties.SetProperty ("Configuration", configuration); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("BuildIpa", "true"); + Engine.ProjectCollection.SetGlobalProperty ("IpaIncludeArtwork", "true"); + Engine.ProjectCollection.SetGlobalProperty ("CodesignProvision", "Automatic"); // Provisioning profile + Engine.ProjectCollection.SetGlobalProperty ("CodesignKey", "iPhone Developer"); + Engine.ProjectCollection.SetGlobalProperty ("Configuration", configuration); RunTarget (proj, "Clean"); Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, Platform); @@ -115,7 +115,7 @@ public void CreateIpa () string wkPath = "WatchKitSupport/WK"; Assert.Contains (wkPath, lines, wkPath + " does not exist"); - var ipaIncludeArtwork = proj.GetEvaluatedProperty ("IpaIncludeArtwork"); + var ipaIncludeArtwork = proj.GetPropertyValue ("IpaIncludeArtwork"); Assert.IsTrue (output.Contains ("iTunesMetadata.plist"), string.Format ("The ipa should contain at least one iTunesMetadata.plist file if we are using an AppStore config and IpaIncludeArtwork is true. IpaIncludeArtwork: {0}", ipaIncludeArtwork)); RunTarget (proj, "Clean"); diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/NativeReferences.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/NativeReferences.cs index c74924a3b190..13dbd4ca404b 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/NativeReferences.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/NativeReferences.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using NUnit.Framework; namespace Xamarin.iOS.Tasks { @@ -16,12 +17,12 @@ public void BasicTest () { var mtouchPaths = SetupProjectPaths ("MyTabbedApplication", "../", true, Platform); - Engine.GlobalProperties.SetProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath); - var nr = proj.AddNewItem ("NativeReference", Path.Combine (".", "..", "..", "..", "tests", "test-libraries", ".libs", "ios", "XTest.framework")); - nr.SetMetadata ("IsCxx", "False"); - nr.SetMetadata ("Kind", "Framework"); + var nr = proj.AddItem ("NativeReference", Path.Combine (".", "..", "..", "..", "tests", "test-libraries", ".libs", "ios", "XTest.framework")).First (); + nr.SetMetadataValue ("IsCxx", "False"); + nr.SetMetadataValue ("Kind", "Framework"); AppBundlePath = mtouchPaths.AppBundlePath; @@ -40,14 +41,14 @@ public void WithIncrementalBuilds () var mtouchPaths = SetupProjectPaths ("MyiOSAppWithBinding", "../", true, Platform); - Engine.GlobalProperties.SetProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath); - proj.GlobalProperties.SetProperty ("MtouchFastDev", "true"); - proj.GlobalProperties.SetProperty ("MtouchExtraArgs", "-vvvv"); - proj.GlobalProperties.SetProperty ("MtouchArch", "ARM64"); // only use ARM64 to speed up the build. - proj.GlobalProperties.SetProperty ("MtouchLink", "Full"); // also to speed up the build. + proj.SetGlobalProperty ("MtouchFastDev", "true"); + proj.SetGlobalProperty ("MtouchExtraArgs", "-vvvv"); + proj.SetGlobalProperty ("MtouchArch", "ARM64"); // only use ARM64 to speed up the build. + proj.SetGlobalProperty ("MtouchLink", "Full"); // also to speed up the build. AppBundlePath = mtouchPaths.AppBundlePath; diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ProjectTest.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ProjectTest.cs index 0f1c45bdfa24..982594095397 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ProjectTest.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ProjectTest.cs @@ -42,8 +42,8 @@ public string BuildProject (string appName, string platform, string config, int var proj = SetupProject (Engine, csproj); AppBundlePath = mtouchPaths ["app_bundlepath"]; - Engine.GlobalProperties.SetProperty("Platform", platform); - Engine.GlobalProperties.SetProperty("Configuration", config); + Engine.ProjectCollection.SetGlobalProperty("Platform", platform); + Engine.ProjectCollection.SetGlobalProperty("Configuration", config); if (clean) { RunTarget (proj, "Clean"); diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs index 39cabef0af1e..d75500f495eb 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -5,6 +6,7 @@ using Mono.Cecil; using NUnit.Framework; using Xamarin.MacDev; +using Microsoft.Build.Execution; namespace Xamarin.iOS.Tasks { @@ -135,30 +137,30 @@ static bool BundleResourceExists (string path, ref int extra) [Test] public void GetReferencedAssemblies_Executable () { - RunTarget (MonoTouchProject, TargetName.ResolveReferences); - var references = MonoTouchProject.GetEvaluatedItemsByName ("ReferencePath").ToArray (); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.ResolveReferences); + var references = MonoTouchProjectInstance.GetItems ("ReferencePath").ToArray (); Assert.AreEqual (6, references.Length, "#1"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("MyLibrary")), "#2"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System")), "#3a"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#3b"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#3c"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#3d"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("Xamarin.iOS")), "#3e"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("MyLibrary")), "#2"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System")), "#3a"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Xml")), "#3b"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Core")), "#3c"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("mscorlib")), "#3d"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("Xamarin.iOS")), "#3e"); } [Test] public void GetReferencedAssemblies_Library () { - RunTarget (LibraryProject, TargetName.ResolveReferences); - var references = LibraryProject.GetEvaluatedItemsByName ("ReferencePath").ToArray (); + RunTargetOnInstance (LibraryProjectInstance, TargetName.ResolveReferences); + var references = LibraryProjectInstance.GetItems ("ReferencePath").ToArray (); Assert.AreEqual (5, references.Length, "#1"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System")), "#2a"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Xml")), "#2b"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("System.Core")), "#2c"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("mscorlib")), "#2d"); - Assert.IsTrue (references.Any (t => t.Include.Contains ("Xamarin.iOS")), "#2e"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System")), "#2a"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Xml")), "#2b"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("System.Core")), "#2c"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("mscorlib")), "#2d"); + Assert.IsTrue (references.Any (t => t.EvaluatedInclude.Contains ("Xamarin.iOS")), "#2e"); } [Test] @@ -167,7 +169,7 @@ public void BuildExecutable () var expectedFiles = ExpectedExecutableFiles; int extra = 0; - RunTarget (MonoTouchProject, TargetName.Build); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Build); Assert.IsTrue (Directory.Exists (AppBundlePath), "#1"); foreach (var file in expectedFiles) @@ -187,7 +189,7 @@ public void BuildExecutable () [Test] public void CopyContentToBundle () { - RunTarget (MonoTouchProject, TargetName.CopyResourcesToBundle); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.CopyResourcesToBundle); foreach (var v in ExpectedExecutableBundleResources) Assert.IsTrue (File.Exists (v) || Directory.Exists (v), string.Format ("{0} was not copied to the bundle", Path.GetFullPath (v))); @@ -196,12 +198,12 @@ public void CopyContentToBundle () [Test] public void CleanExecutable () { - RunTarget (MonoTouchProject, TargetName.Clean); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Clean); Assert.IsFalse (Directory.Exists (MonoTouchProjectBinPath), "#1a"); Assert.IsFalse (Directory.Exists (MonoTouchProjectObjPath), "#1b"); - RunTarget (MonoTouchProject, TargetName.Build); - RunTarget (MonoTouchProject, TargetName.Clean); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Build); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Clean); Assert.IsEmpty (Directory.GetDirectories (MonoTouchProjectBinPath, "*.dSYM", SearchOption.AllDirectories), "#2a"); Assert.IsEmpty (Directory.GetFiles (MonoTouchProjectBinPath, "*.*", SearchOption.AllDirectories), "#2b"); Assert.IsFalse (Directory.Exists (MonoTouchProjectObjPath), "#2c"); @@ -210,12 +212,12 @@ public void CleanExecutable () [Test] public void CleanLibrary () { - RunTarget (LibraryProject, TargetName.Clean); + RunTargetOnInstance (LibraryProjectInstance, TargetName.Clean); Assert.IsFalse (Directory.Exists (LibraryProjectBinPath), "#1a"); Assert.IsFalse (Directory.Exists (LibraryProjectObjPath), "#1b"); - RunTarget (LibraryProject, TargetName.Build); - RunTarget (LibraryProject, TargetName.Clean); + RunTargetOnInstance (LibraryProjectInstance, TargetName.Build); + RunTargetOnInstance (LibraryProjectInstance, TargetName.Clean); Assert.IsEmpty (Directory.GetFiles (LibraryProjectBinPath, "*.*", SearchOption.AllDirectories), "#2a"); Assert.IsFalse (Directory.Exists (LibraryProjectObjPath), "#2b"); } @@ -223,7 +225,7 @@ public void CleanLibrary () [Test] public void CompileInterfaceDefinitions_Library () { - RunTarget (LibraryProject, TargetName.CompileInterfaceDefinitions); + RunTargetOnInstance (LibraryProjectInstance, TargetName.CompileInterfaceDefinitions); Assert.IsNotEmpty (Directory.GetFiles (LibraryProjectObjPath, "*.*", SearchOption.AllDirectories), "#1"); } @@ -236,14 +238,14 @@ public void OptimizePngs_DefaultValue () [Test] public void OptimizePngs_True () { - MonoTouchProject.AddNewPropertyGroup (true).AddNewProperty ("OptimizePNGs", "True"); + MonoTouchProjectInstance.SetProperty ("OptimizePNGs", "True"); OptimizePngs_Core (true); } [Test] public void OptimizePngs_False () { - MonoTouchProject.AddNewPropertyGroup (true).AddNewProperty ("OptimizePNGs", "False"); + MonoTouchProjectInstance.SetProperty ("OptimizePNGs", "False"); OptimizePngs_Core (false); } @@ -252,7 +254,7 @@ void OptimizePngs_Core (bool shouldBeDifferent) var originalFile = Path.Combine (MonoTouchProjectPath, "Resources", "image.png"); var optimisedFile = Path.Combine (AppBundlePath, "image.png"); - RunTarget (MonoTouchProject, TargetName.Build); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Build); Assert.IsTrue (File.Exists (optimisedFile), "#1"); if (shouldBeDifferent) @@ -286,7 +288,7 @@ public void RebuildExecutable_TouchLibraryDll () RunTarget (MonoTouchProject, TargetName.Build); var timestamps = ExpectedExecutableFiles.ToDictionary (file => file, file => GetLastModified (file)); - Touch (Path.Combine (LibraryProjectBinPath, "MyLibrary.dll")); + Touch (Path.Combine (LibraryProjectObjPath, "MyLibrary.dll")); RunTarget (MonoTouchProject, TargetName.Build); var newTimestamps = ExpectedExecutableFiles.ToDictionary (file => file, file => GetLastModified (file)); @@ -355,8 +357,8 @@ public void BuildLibrary () [Test] public void BuildLibrary_NoInterfaceDefinitions () { - foreach (var item in LibraryProject.GetEvaluatedItemsByName ("InterfaceDefinition")) - LibraryProject.RemoveItem ((Microsoft.Build.BuildEngine.BuildItem)item); + LibraryProject.RemoveItems (LibraryProject.GetItems ("InterfaceDefinition")); + LibraryProjectInstance = LibraryProject.CreateProjectInstance (); BuildLibraryCore (ExpectedLibraryEmbeddedResources.Where (s => !s.Contains ("storyboardc")).ToArray ()); } @@ -364,9 +366,9 @@ public void BuildLibrary_NoInterfaceDefinitions () void BuildLibraryCore (string[] expectedResources) { var library = Path.Combine (LibraryProjectBinPath, "MyLibrary.dll"); - RunTarget (LibraryProject, TargetName.Build); + RunTargetOnInstance (LibraryProjectInstance, TargetName.Build); - Assert.IsTrue (string.IsNullOrEmpty (LibraryProject.GetEvaluatedProperty ("AppBundleDir")), "#1"); + Assert.IsTrue (string.IsNullOrEmpty (LibraryProjectInstance.GetPropertyValue ("AppBundleDir")), "#1"); var entries = Directory.GetFileSystemEntries (LibraryProjectBinPath); Assert.AreEqual (2, entries.Length, "#1"); Assert.IsTrue (File.Exists (library), "#2"); @@ -384,29 +386,29 @@ void BuildLibraryCore (string[] expectedResources) public void GenerateBundleName_ExecutableProject () { // Initially the AssemblyName is set and there is no app bundle dir - Assert.AreEqual ("MySingleView", MonoTouchProject.GetEvaluatedProperty ("AssemblyName"), "#1"); - Assert.IsTrue (string.IsNullOrEmpty (MonoTouchProject.GetEvaluatedProperty ("AppBundleDir")), "#2"); + Assert.AreEqual ("MySingleView", MonoTouchProjectInstance.GetPropertyValue ("AssemblyName"), "#1"); + Assert.IsTrue (string.IsNullOrEmpty (MonoTouchProjectInstance.GetPropertyValue ("AppBundleDir")), "#2"); // Now we should have an AppBundleDir - RunTarget (MonoTouchProject, TargetName.GenerateBundleName); - Assert.AreEqual ("bin/iPhoneSimulator/Debug/MySingleView.app", MonoTouchProject.GetEvaluatedProperty ("AppBundleDir"), "#3"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.GenerateBundleName); + Assert.AreEqual (@"bin\iPhoneSimulator\Debug\MySingleView.app", MonoTouchProjectInstance.GetPropertyValue ("AppBundleDir"), "#3"); } [Test] public void PackLibraryResources_ExecutableProject () { - RunTarget (MonoTouchProject, TargetName.PackLibraryResources); - var embeddedResources = MonoTouchProject.GetEvaluatedItemsByName ("EmbeddedResource").ToArray (); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.PackLibraryResources); + var embeddedResources = MonoTouchProjectInstance.GetItems ("EmbeddedResource").ToArray (); Assert.AreEqual (2, embeddedResources.Length, "#1"); - Assert.IsTrue (embeddedResources.Any (i => i.FinalItemSpec == "LinkedEmbeddedResource.txt"), "#1"); - Assert.IsTrue (embeddedResources.Any (i => i.FinalItemSpec == Path.Combine ("Folder", "EmbeddedResource.txt")), "#2"); + Assert.IsTrue (embeddedResources.Any (i => i.EvaluatedInclude == "LinkedEmbeddedResource.txt"), "#1"); + Assert.IsTrue (embeddedResources.Any (i => i.EvaluatedInclude == Path.Combine ("Folder", "EmbeddedResource.txt")), "#2"); } [Test] public void PackLibraryResources_LibraryProject () { - RunTarget (LibraryProject, TargetName.PackLibraryResources); - var embeddedResources = LibraryProject.GetEvaluatedItemsByName ("EmbeddedResource").ToArray (); + RunTargetOnInstance (LibraryProjectInstance, TargetName.PackLibraryResources); + var embeddedResources = LibraryProjectInstance.GetItems ("EmbeddedResource").ToArray (); Assert.AreEqual (13, embeddedResources.Length, "#1"); } @@ -414,8 +416,8 @@ public void PackLibraryResources_LibraryProject () public void UnpackLibraryResources_ExecutableProject () { // We unpack 4 embedded resources from the library project into BundleResources - RunTarget (MonoTouchProject, TargetName.Build); - var bundleResources = MonoTouchProject.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.Build); + var bundleResources = MonoTouchProjectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); Assert.IsTrue (bundleResources.Length >= 33, "#1"); } @@ -423,8 +425,8 @@ public void UnpackLibraryResources_ExecutableProject () public void UnpackLibraryResources_LibraryProject () { // We should not unpack any EmbeddedResources into BundleResources - RunTarget (LibraryProject, TargetName.Build); - var bundleResources = LibraryProject.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); + RunTargetOnInstance (LibraryProjectInstance, TargetName.Build); + var bundleResources = LibraryProjectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); Assert.AreEqual (11, bundleResources.Length, "#1"); } @@ -439,35 +441,35 @@ public void BundleResources () plist.SetMinimumOSVersion ("7.0"); plist.Save (path, true); - RunTarget (MonoTouchProject, TargetName.CollectBundleResources); - - var bundleItems = MonoTouchProject.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine ("Folder", "BundleResource.txt") && i.GetMetadata ("LogicalName") == "Folder/BundleResource.txt"), "#1"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine ("Folder", "Content.txt") && i.GetMetadata ("LogicalName") == "Folder/Content.txt"), "#2"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == "LinkedBundleResource.txt" && i.GetMetadata ("LogicalName") == "Folder/LinkedBundleResource.txt"), "#3"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == "LinkedContent.txt" && i.GetMetadata ("LogicalName") == "Folder/LinkedContent.txt"), "#4"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons29x29.png") && i.GetMetadata ("LogicalName") == "AppIcons29x29.png"), "#5"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons29x29@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons29x29@2x.png"), "#6"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons40x40@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons40x40@2x.png"), "#7"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons57x57.png") && i.GetMetadata ("LogicalName") == "AppIcons57x57.png"), "#8"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons57x57@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons57x57@2x.png"), "#9"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons60x60@2x.png"), "#10"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "LaunchImage-568h@2x.png") && i.GetMetadata ("LogicalName") == "LaunchImage-568h@2x.png"), "#11"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "LaunchImage.png") && i.GetMetadata ("LogicalName") == "LaunchImage.png"), "#12"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (actool, "LaunchImage@2x.png") && i.GetMetadata ("LogicalName") == "LaunchImage@2x.png"), "#13"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "MainStoryboard.storyboardc", "1-view-2.nib") && i.GetMetadata ("LogicalName") == "MainStoryboard.storyboardc/1-view-2.nib"), "#14"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "MainStoryboard.storyboardc", "Info.plist") && i.GetMetadata ("LogicalName") == "MainStoryboard.storyboardc/Info.plist"), "#15"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "MainStoryboard.storyboardc", "UIViewController-1.nib") && i.GetMetadata ("LogicalName") == "MainStoryboard.storyboardc/UIViewController-1.nib"), "#16"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.CollectBundleResources); + + var bundleItems = MonoTouchProjectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine ("Folder", "BundleResource.txt") && i.GetMetadataValue ("LogicalName") == "Folder/BundleResource.txt"), "#1"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine ("Folder", "Content.txt") && i.GetMetadataValue ("LogicalName") == "Folder/Content.txt"), "#2"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == "LinkedBundleResource.txt" && i.GetMetadataValue ("LogicalName") == "Folder/LinkedBundleResource.txt"), "#3"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == "LinkedContent.txt" && i.GetMetadataValue ("LogicalName") == "Folder/LinkedContent.txt"), "#4"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons29x29.png") && i.GetMetadataValue ("LogicalName") == "AppIcons29x29.png"), "#5"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons29x29@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons29x29@2x.png"), "#6"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons40x40@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons40x40@2x.png"), "#7"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons57x57.png") && i.GetMetadataValue ("LogicalName") == "AppIcons57x57.png"), "#8"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons57x57@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons57x57@2x.png"), "#9"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#10"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "LaunchImage-568h@2x.png") && i.GetMetadataValue ("LogicalName") == "LaunchImage-568h@2x.png"), "#11"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "LaunchImage.png") && i.GetMetadataValue ("LogicalName") == "LaunchImage.png"), "#12"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (actool, "LaunchImage@2x.png") && i.GetMetadataValue ("LogicalName") == "LaunchImage@2x.png"), "#13"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "MainStoryboard.storyboardc", "1-view-2.nib") && i.GetMetadataValue ("LogicalName") == "MainStoryboard.storyboardc/1-view-2.nib"), "#14"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "MainStoryboard.storyboardc", "Info.plist") && i.GetMetadataValue ("LogicalName") == "MainStoryboard.storyboardc/Info.plist"), "#15"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "MainStoryboard.storyboardc", "UIViewController-1.nib") && i.GetMetadataValue ("LogicalName") == "MainStoryboard.storyboardc/UIViewController-1.nib"), "#16"); if (bundleItems.Length > ExpectedExecutableBundleResources.Length) { - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "en.lproj", "TranslatedView.nib", "runtime.nib") && i.GetMetadata ("LogicalName") == "en.lproj/TranslatedView.nib/runtime.nib"), "#17"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "FolderView.nib", "runtime.nib") && i.GetMetadata ("LogicalName") == "FolderView.nib/runtime.nib"), "#18"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "iPhoneView.nib", "runtime.nib") && i.GetMetadata ("LogicalName") == "iPhoneView.nib/runtime.nib"), "#19"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "en.lproj", "TranslatedView.nib", "runtime.nib") && i.GetMetadataValue ("LogicalName") == "en.lproj/TranslatedView.nib/runtime.nib"), "#17"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "FolderView.nib", "runtime.nib") && i.GetMetadataValue ("LogicalName") == "FolderView.nib/runtime.nib"), "#18"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "iPhoneView.nib", "runtime.nib") && i.GetMetadataValue ("LogicalName") == "iPhoneView.nib/runtime.nib"), "#19"); } else { - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "en.lproj", "TranslatedView.nib") && i.GetMetadata ("LogicalName") == "en.lproj/TranslatedView.nib"), "#17"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "FolderView.nib") && i.GetMetadata ("LogicalName") == "FolderView.nib"), "#18"); - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine (ibtool, "iPhoneView.nib") && i.GetMetadata ("LogicalName") == "iPhoneView.nib"), "#19"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "en.lproj", "TranslatedView.nib") && i.GetMetadataValue ("LogicalName") == "en.lproj/TranslatedView.nib"), "#17"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "FolderView.nib") && i.GetMetadataValue ("LogicalName") == "FolderView.nib"), "#18"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine (ibtool, "iPhoneView.nib") && i.GetMetadataValue ("LogicalName") == "iPhoneView.nib"), "#19"); } - Assert.IsTrue (bundleItems.Any (i => i.FinalItemSpec == Path.Combine ("Resources", "image.png") && i.GetMetadata ("LogicalName") == "image.png"), "#20"); + Assert.IsTrue (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine ("Resources", "image.png") && i.GetMetadataValue ("LogicalName") == "image.png"), "#20"); } [Test (Description = "Xambug #39137")] @@ -484,12 +486,14 @@ public void AddAppIcon_NoClean() plist.SetMinimumOSVersion ("7.0"); plist.Save (path, true); - RunTarget (project, TargetName.CompileImageAssets); + var projectInstance = project.CreateProjectInstance (); + RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0); - var bundleItemsNoAppIcon = project.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); - Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons60x60@2x.png"), "#1"); + var bundleItemsNoAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); + Assert.IsFalse (bundleItemsNoAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#1"); project = SetupProject (Engine, MonoTouchProjectCSProjPath); + projectInstance = project.CreateProjectInstance (); // Put a thread.sleep so that we get noticeable timestamps. Thread.Sleep (1000); @@ -499,10 +503,10 @@ public void AddAppIcon_NoClean() // Re-run the task with app icon set this time and no clean. // The task should be aware the app icon is now being used. - RunTarget (project, TargetName.CompileImageAssets); + RunTargetOnInstance (projectInstance, TargetName.CompileImageAssets, 0); - var bundleItemsWithAppIcon = project.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); - Assert.IsTrue (bundleItemsWithAppIcon.Any (i => i.FinalItemSpec == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadata ("LogicalName") == "AppIcons60x60@2x.png"), "#2"); + var bundleItemsWithAppIcon = projectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); + Assert.IsTrue (bundleItemsWithAppIcon.Any (i => i.EvaluatedInclude == Path.Combine (actool, "AppIcons60x60@2x.png") && i.GetMetadataValue ("LogicalName") == "AppIcons60x60@2x.png"), "#2"); } [Test (Description = "Xambug #16331")] @@ -512,11 +516,11 @@ public void Disappearing_Bundle_Resource () string resourceGone = resource + ".disabled"; try { File.Move (resource, resourceGone); - RunTarget_WithErrors (MonoTouchProject, "_CollectBundleResources"); - var bundleItems = MonoTouchProject.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); + RunTarget_WithErrors (MonoTouchProjectInstance, "_CollectBundleResources"); + var bundleItems = MonoTouchProjectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); Assert.IsNotNull (bundleItems, "#1"); Assert.IsTrue (bundleItems.Length >= 17, "#2"); - Assert.IsFalse (bundleItems.Any (i => i.FinalItemSpec == Path.Combine ("Folder", "BundleResource.txt")), "#3"); + Assert.IsFalse (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine ("Folder", "BundleResource.txt")), "#3"); } finally { File.Move (resourceGone, resource); } @@ -529,11 +533,11 @@ public void Disappearing_Content () string resourceGone = resource + ".disabled"; try { File.Move (resource, resourceGone); - RunTarget_WithErrors (MonoTouchProject, "_CollectBundleResources"); - var bundleItems = MonoTouchProject.GetEvaluatedItemsByName ("_BundleResourceWithLogicalName").ToArray (); + RunTarget_WithErrors (MonoTouchProjectInstance, "_CollectBundleResources"); + var bundleItems = MonoTouchProjectInstance.GetItems ("_BundleResourceWithLogicalName").ToArray (); Assert.IsNotNull (bundleItems, "#1"); Assert.IsTrue (bundleItems.Length >= 17, "#2"); - Assert.IsFalse (bundleItems.Any (i => i.FinalItemSpec == Path.Combine ("Folder", "Content.txt")), "#3"); + Assert.IsFalse (bundleItems.Any (i => i.EvaluatedInclude == Path.Combine ("Folder", "Content.txt")), "#3"); } finally { File.Move (resourceGone, resource); } @@ -542,29 +546,31 @@ public void Disappearing_Content () [Test] public void DetectAppManifest_ExecutableProject () { - RunTarget (MonoTouchProject, TargetName.DetectAppManifest); - Assert.IsNotNull (MonoTouchProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.DetectAppManifest); + Assert.IsFalse (string.IsNullOrEmpty(MonoTouchProjectInstance.GetPropertyValue ("_AppManifest")), "#1"); } [Test] public void DetectAppManifest_ExecutableProject_NoPList () { RemoveItemsByName (MonoTouchProject, "None"); - RunTarget_WithErrors (MonoTouchProject, TargetName.DetectAppManifest); - Assert.IsNull (MonoTouchProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance (); + + RunTarget_WithErrors (MonoTouchProjectInstance, TargetName.DetectAppManifest); + Assert.IsNullOrEmpty (MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), "#1"); } [Test] public void DetectAppManifest_ExecutableProject_TwoPLists () { RemoveItemsByName (MonoTouchProject, "None"); + MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance (); - var group = MonoTouchProject.AddNewItemGroup (); - group.AddNewItem ("None", "Fake/Info.plist"); - group.AddNewItem ("None", "Info.plist"); + MonoTouchProjectInstance.AddItem ("None", "Fake/Info.plist"); + MonoTouchProjectInstance.AddItem ("None", "Info.plist"); - RunTarget (MonoTouchProject, TargetName.DetectAppManifest); - Assert.AreEqual ("Info.plist", MonoTouchProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.DetectAppManifest); + Assert.AreEqual ("Info.plist", MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), "#1"); } [Test] @@ -573,12 +579,13 @@ public void DetectAppManifest_ExecutableProject_LinkedPList () string linkedPlist = CreateTempFile (Path.Combine (TempDir, "Linked.plist")); RemoveItemsByName (MonoTouchProject, "None"); - var group = MonoTouchProject.AddNewItemGroup (); - group.AddNewItem ("None", linkedPlist); - group.ToArray ().Last ().SetMetadata ("Link", "Info.plist"); + MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance (); + + var item = MonoTouchProjectInstance.AddItem ("None", linkedPlist); + item.SetMetadata ("Link", "Info.plist"); - RunTarget (MonoTouchProject, TargetName.DetectAppManifest); - Assert.AreEqual (linkedPlist, MonoTouchProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.DetectAppManifest); + Assert.AreEqual (linkedPlist, MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), "#1"); } [Test] @@ -587,20 +594,20 @@ public void DetectAppManifest_ExecutableProject_LogicalNamePList () string logicalPlist = CreateTempFile (Path.Combine (TempDir, "Logical.plist")); RemoveItemsByName (MonoTouchProject, "None"); + MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance (); - var group = MonoTouchProject.AddNewItemGroup (); - group.AddNewItem ("None", logicalPlist); - group.ToArray ().Last ().SetMetadata ("LogicalName", "Info.plist"); + var item = MonoTouchProjectInstance.AddItem ("None", logicalPlist); + item.SetMetadata ("LogicalName", "Info.plist"); - RunTarget (MonoTouchProject, TargetName.DetectAppManifest); - Assert.AreEqual (logicalPlist, MonoTouchProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + RunTargetOnInstance (MonoTouchProjectInstance, TargetName.DetectAppManifest); + Assert.AreEqual (logicalPlist, MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), "#1"); } [Test] public void DetectAppManifest_LibraryProject () { - RunTarget (LibraryProject, TargetName.DetectAppManifest); - Assert.IsNull (LibraryProject.GetEvaluatedProperty ("_AppManifest"), "#1"); + RunTargetOnInstance (LibraryProjectInstance, TargetName.DetectAppManifest); + Assert.IsNullOrEmpty (LibraryProjectInstance.GetPropertyValue ("_AppManifest"), "#1"); } } } diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/Logger.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/Logger.cs index e6775b2f4116..65489e78ba67 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/Logger.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/Logger.cs @@ -5,7 +5,6 @@ using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters.Binary; using System.Threading; -using Microsoft.Build.BuildEngine; using Microsoft.Build.Framework; using NUnit.Framework; using Microsoft.Build.Utilities; @@ -193,7 +192,7 @@ string FormatText (string txt) public void Print (string message) { - writer.WriteLine (FormatText (message)); + writer.Write (FormatText (message)); } } diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestBase.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestBase.cs index dc4417e4727c..a60405e8d20e 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestBase.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestBase.cs @@ -4,7 +4,8 @@ using System.IO; using System.Linq; using System.Text; -using Microsoft.Build.BuildEngine; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; using Microsoft.Build.Utilities; using NUnit.Framework; using Xamarin.MacDev; @@ -77,10 +78,18 @@ public Project LibraryProject { get; private set; } + public ProjectInstance LibraryProjectInstance { + get; set; + } + public Project MonoTouchProject { get; private set; } + public ProjectInstance MonoTouchProjectInstance { + get; set; + } + public string LibraryProjectBinPath; public string LibraryProjectObjPath; public string LibraryProjectPath; @@ -139,7 +148,9 @@ public virtual void Setup () SetupEngine (); MonoTouchProject = SetupProject (Engine, MonoTouchProjectCSProjPath); + MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance (); LibraryProject = SetupProject (Engine, LibraryProjectCSProjPath); + LibraryProjectInstance = LibraryProject.CreateProjectInstance (); CleanUp (); } @@ -149,12 +160,9 @@ public void SetupEngine () Engine = new TestEngine (); } - public Project SetupProject (Engine engine, string projectPath) + public Project SetupProject (TestEngine engine, string projectPath) { - var proj = new Project (engine); - proj.Load (projectPath); - - return proj; + return engine.ProjectCollection.LoadProject (projectPath); } public virtual string TargetFrameworkIdentifier { @@ -192,6 +200,9 @@ public void CleanUp () { File.SetLastWriteTimeUtc (file, DateTime.UtcNow); foreach (var file in Directory.GetFiles (LibraryProjectPath, "*.*", SearchOption.AllDirectories)) File.SetLastWriteTimeUtc (file, DateTime.UtcNow); + + Engine.UnloadAllProjects (); + Engine = new TestEngine (); } protected void SafeDelete (string path) @@ -297,8 +308,7 @@ protected DateTime GetLastModified (string file) protected void RemoveItemsByName (Project project, string itemName) { - foreach (var item in project.GetEvaluatedItemsByName (itemName).ToArray ()) - project.RemoveItem (item); + project.RemoveItems (project.GetItems (itemName)); } protected string SetPListKey (string key, PObject value) @@ -327,7 +337,12 @@ protected void Touch (string file) public void RunTarget (Project project, string target, int expectedErrorCount = 0) { - Engine.BuildProject (project, new [] { target }, new Hashtable { {"Platform", "iPhone"} }, BuildSettings.None); + RunTargetOnInstance (project.CreateProjectInstance (), target, expectedErrorCount); + } + + public void RunTargetOnInstance (ProjectInstance instance, string target, int expectedErrorCount = 0) + { + Engine.BuildProject (instance, new [] { target }, new Hashtable { {"Platform", "iPhone"} }); if (expectedErrorCount != Engine.Logger.ErrorEvents.Count) { string messages = string.Empty; if (Engine.Logger.ErrorEvents.Count > 0) { @@ -339,7 +354,12 @@ public void RunTarget (Project project, string target, int expectedErrorCount = public void RunTarget_WithErrors (Project project, string target) { - Engine.BuildProject (project, new [] { target }, new Hashtable (), BuildSettings.None); + RunTarget_WithErrors (project.CreateProjectInstance (), target); + } + + public void RunTarget_WithErrors (ProjectInstance instance, string target) + { + Engine.BuildProject (instance, new [] { target }, new Hashtable ()); Assert.IsTrue (Engine.Logger.ErrorEvents.Count > 0, "#RunTarget-HasExpectedErrors"); } diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestEngine.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestEngine.cs index ddcbf69db26d..a75805752df8 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestEngine.cs +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TestHelpers/TestEngine.cs @@ -5,35 +5,53 @@ using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters.Binary; using System.Threading; -using Microsoft.Build.BuildEngine; using Microsoft.Build.Framework; +using Microsoft.Build.Evaluation; +using Microsoft.Build.Execution; +using Microsoft.Build.Logging; using NUnit.Framework; using Microsoft.Build.Utilities; namespace Xamarin.iOS.Tasks { - public class TestEngine : Engine, IBuildEngine + public class TestEngine : IBuildEngine { public Logger Logger { get; set; } - + public TestEngine () { Logger = new Logger (); + ProjectCollection = new ProjectCollection (); - RegisterLogger (Logger); + ProjectCollection.RegisterLogger (Logger); var printer = new ConsoleReportPrinter (); var cl = new ConsoleLogger (LoggerVerbosity.Diagnostic, printer.Print, printer.SetForeground, printer.ResetColor); - RegisterLogger (cl); + ProjectCollection.RegisterLogger (cl); } - public bool BuildProjectFile (string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) + public bool BuildProjectFile (string projectFileName, string [] targetNames, IDictionary globalProperties, IDictionary targetOutputs) { throw new NotImplementedException (); } + + public bool BuildProject (ProjectInstance instance, string [] targetNames, IDictionary globalProperties) + { + if (globalProperties != null) { + foreach (DictionaryEntry de in globalProperties) { + //Note: trying to set this on the project causes the project to be added to the PC + // again, which of course, fails + instance.SetProperty ((string)de.Key, (string)de.Value); + } + } + + //FIXME: assumption that we are still using the same PC! + return instance.Build (targetNames, ProjectCollection.Loggers); + } + public void LogCustomEvent (CustomBuildEventArgs e) { Logger.CustomEvents.Add (e); @@ -51,6 +69,11 @@ public void LogWarningEvent (BuildWarningEventArgs e) Logger.WarningsEvents.Add (e); } + public void UnloadAllProjects () + { + ProjectCollection.UnloadAllProjects (); + } + public int ColumnNumberOfTaskNode { get { return 0; } } @@ -63,6 +86,8 @@ public int LineNumberOfTaskNode { public string ProjectFileOfTaskNode { get { return ""; } } + + public ProjectCollection ProjectCollection { get; set; } } } diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj b/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj index 3fae72678c6b..f2868ba73480 100644 --- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj +++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj @@ -32,10 +32,10 @@ - - - - + + + + ..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll diff --git a/msbuild/xbuild-in-place b/msbuild/xbuild-in-place index 25b1cf797165..aabe2791b775 100755 --- a/msbuild/xbuild-in-place +++ b/msbuild/xbuild-in-place @@ -5,14 +5,14 @@ build_in_place_dir="$(python -c "import os; print os.path.realpath('$self/../_ma xammac_framework_dir="$build_in_place_dir/Library/Frameworks/Xamarin.Mac.framework/Versions/Current" xbuild_external_dir="$build_in_place_dir/Library/Frameworks/Mono.framework/External" -export XBUILD_FRAMEWORK_FOLDERS_PATH="$xbuild_external_dir/xbuild-frameworks" -export MSBuildExtensionsPath="$xbuild_external_dir/xbuild" +export TargetFrameworkFallbackSearchPaths="$xbuild_external_dir/xbuild-frameworks" +export MSBuildExtensionsPathFallbackPathsOverride="$xbuild_external_dir/xbuild" XamarinMacFrameworkRoot="$xammac_framework_dir" TargetFrameworkIdentifier=Xamarin.Mac TargetFrameworkVersion=v2.0 -/Library/Frameworks/Mono.framework/Commands/xbuild \ +/Library/Frameworks/Mono.framework/Commands/msbuild \ /property:XamarinMacFrameworkRoot="$XamarinMacFrameworkRoot" \ /property:TargetFrameworkIdentifier="$TargetFrameworkIdentifier" \ /property:TargetFrameworkVersion="$TargetFrameworkVersion" \ diff --git a/tests/Makefile b/tests/Makefile index 30632b6db703..9994d79b156b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -41,8 +41,9 @@ EXEC_UNIT_SERVER=XCODE_DEVELOPER_ROOT=$(XCODE_DEVELOPER_ROOT) MONOTOUCH_ROOT=$(I export MD_APPLE_SDK_ROOT=$(abspath $(XCODE_DEVELOPER_ROOT)/../..) export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export MSBUILD_EXE_PATH=$(MONO_PREFIX)/lib/mono/msbuild/15.0/bin/MSBuild.dll +export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current @@ -176,10 +177,10 @@ Makefile.inc: xharness/xharness.exe -include Makefile.inc $(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe: - XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj + TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj $(GUI_UNIT_PATH)/bin/xammac_mobile/GuiUnit.exe: - XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_xammac_mobile.csproj + TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_xammac_mobile.csproj Makefile-mac.inc: xharness/xharness.exe $(Q_GEN) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --configure --autoconf --mac --rootdir $(CURDIR) diff --git a/tests/common/ExecutionHelper.cs b/tests/common/ExecutionHelper.cs index afa2770dedca..617bbae65709 100644 --- a/tests/common/ExecutionHelper.cs +++ b/tests/common/ExecutionHelper.cs @@ -108,6 +108,23 @@ bool IndexOfAny (string line, out int start, out int end, params string [] value return false; } + string RemovePathAtEnd (string line) + { + if (line.TrimEnd ().EndsWith ("]")) { + var start = line.LastIndexOf ("["); + if (start >= 0) { + // we want to get the space before `[` too. + if (start > 0 && line [start - 1] == ' ') + start --; + + line = line.Substring (0, start); + return line; + } + } + + return line; + } + public void ParseMessages () { messages.Clear (); @@ -120,9 +137,11 @@ public void ParseMessages () msg.IsError = true; origin = line.Substring (0, idxError); line = line.Substring (endError); + line = RemovePathAtEnd (line); } else if (IndexOfAny (line, out var idxWarning, out var endWarning, ": warning ", ": warning ")) { origin = line.Substring (0, idxWarning); line = line.Substring (endWarning); + line = RemovePathAtEnd (line); } else if (line.StartsWith ("error ", StringComparison.Ordinal)) { msg.IsError = true; line = line.Substring (6); @@ -356,7 +375,7 @@ class XBuild public static string ToolPath { get { - return "/Library/Frameworks/Mono.framework/Commands/xbuild"; + return "/Library/Frameworks/Mono.framework/Commands/msbuild"; } } diff --git a/tests/common/mac/ProjectTestHelpers.cs b/tests/common/mac/ProjectTestHelpers.cs index 09114330138e..3b313432c9c0 100644 --- a/tests/common/mac/ProjectTestHelpers.cs +++ b/tests/common/mac/ProjectTestHelpers.cs @@ -141,7 +141,6 @@ public class UnifiedTestConfig // Not necessarly required public bool FSharp { get; set; } public bool XM45 { get; set; } - public bool DiagnosticMSBuild { get; set; } public bool Release { get; set; } = false; public string ProjectName { get; set; } = ""; @@ -226,30 +225,26 @@ public static string RunAndAssert (string exe, StringBuilder args, string stepNa } // In most cases we generate projects in tmp and this is not needed. But nuget and test projects can make that hard - public static void CleanUnifiedProject (string csprojTarget, bool useMSBuild = false) + public static void CleanUnifiedProject (string csprojTarget) { - RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/" + (useMSBuild ? "msbuild" : "xbuild"), new StringBuilder (csprojTarget + " /t:clean"), "Clean"); + RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/msbuild", new StringBuilder (csprojTarget + " /t:clean"), "Clean"); } - public static string BuildProject (string csprojTarget, bool isUnified, bool diagnosticMSBuild = false, bool shouldFail = false, bool useMSBuild = false, bool release = false, string[] environment = null) + public static string BuildProject (string csprojTarget, bool isUnified, bool shouldFail = false, bool release = false, string[] environment = null) { - if (Environment.GetEnvironmentVariable ("XM_FORCE_MSBUILD") != null) - useMSBuild = true; - string rootDirectory = FindRootDirectory (); // TODO - This is not enough for MSBuild to really work. We need stuff to have it not use system targets! // These are required to have xbuild use are local build instead of system install - if (!useMSBuild) { - Environment.SetEnvironmentVariable ("XBUILD_FRAMEWORK_FOLDERS_PATH", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild-frameworks"); - Environment.SetEnvironmentVariable ("MSBuildExtensionsPath", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild"); - Environment.SetEnvironmentVariable ("XAMMAC_FRAMEWORK_PATH", rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current"); - } + Environment.SetEnvironmentVariable ("TargetFrameworkFallbackSearchPaths", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild-frameworks"); + Environment.SetEnvironmentVariable ("MSBuildExtensionsPathFallbackPathsOverride", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild"); + Environment.SetEnvironmentVariable ("XAMMAC_FRAMEWORK_PATH", rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current"); + Environment.SetEnvironmentVariable ("XamarinMacFrameworkRoot", rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current"); // This is to force build to use our mmp and not system mmp StringBuilder buildArgs = new StringBuilder (); if (isUnified) { - buildArgs.Append (diagnosticMSBuild ? " /verbosity:diagnostic " : " /verbosity:normal "); + buildArgs.Append (" /verbosity:diagnostic "); buildArgs.Append (" /property:XamarinMacFrameworkRoot=" + rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current "); if (release) @@ -271,7 +266,7 @@ public static string BuildProject (string csprojTarget, bool isUnified, bool dia }; if (isUnified) - return RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/" + (useMSBuild ? "msbuild" : "xbuild"), buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment); + return RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/msbuild", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment); else return RunAndAssert ("/Applications/Visual Studio.app/Contents/MacOS/vstool", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment); } @@ -400,10 +395,10 @@ public static string GenerateUnifiedExecutableProject (UnifiedTestConfig config) return GenerateEXEProject (config); } - public static string GenerateAndBuildUnifiedExecutable (UnifiedTestConfig config, bool shouldFail = false, bool useMSBuild = false, string[] environment = null) + public static string GenerateAndBuildUnifiedExecutable (UnifiedTestConfig config, bool shouldFail = false, string[] environment = null) { string csprojTarget = GenerateUnifiedExecutableProject (config); - return BuildProject (csprojTarget, isUnified: true, diagnosticMSBuild: config.DiagnosticMSBuild, shouldFail: shouldFail, useMSBuild: useMSBuild, release: config.Release, environment: environment); + return BuildProject (csprojTarget, isUnified: true, shouldFail: shouldFail, release: config.Release, environment: environment); } public static string RunGeneratedUnifiedExecutable (UnifiedTestConfig config) @@ -413,11 +408,11 @@ public static string RunGeneratedUnifiedExecutable (UnifiedTestConfig config) return RunEXEAndVerifyGUID (config.TmpDir, config.guid, exePath); } - public static OutputText TestUnifiedExecutable (UnifiedTestConfig config, bool shouldFail = false, bool useMSBuild = false, string[] environment = null) + public static OutputText TestUnifiedExecutable (UnifiedTestConfig config, bool shouldFail = false, string[] environment = null) { AddGUIDTestCode (config); - string buildOutput = GenerateAndBuildUnifiedExecutable (config, shouldFail, useMSBuild, environment); + string buildOutput = GenerateAndBuildUnifiedExecutable (config, shouldFail, environment); if (shouldFail) return new OutputText (buildOutput, ""); @@ -439,7 +434,7 @@ public static OutputText TestClassicExecutable (string tmpDir, string testCode = { Guid guid = Guid.NewGuid (); string csprojTarget = GenerateClassicEXEProject (tmpDir, "ClassicExample.csproj", testCode + GenerateOutputCommand (tmpDir,guid), csprojConfig, includeMonoRuntime: includeMonoRuntime); - string buildOutput = BuildProject (csprojTarget, isUnified : false, diagnosticMSBuild: false, shouldFail : shouldFail); + string buildOutput = BuildProject (csprojTarget, isUnified : false, shouldFail : shouldFail); if (shouldFail) return new OutputText (buildOutput, ""); @@ -456,7 +451,7 @@ public static OutputText TestSystemMonoExecutable (UnifiedTestConfig config, boo config.ProjectName = $"{projectName}.csproj"; string csprojTarget = GenerateSystemMonoEXEProject (config); - string buildOutput = BuildProject (csprojTarget, isUnified: true, diagnosticMSBuild: config.DiagnosticMSBuild, shouldFail: shouldFail, release: config.Release); + string buildOutput = BuildProject (csprojTarget, isUnified: true, shouldFail: shouldFail, release: config.Release); if (shouldFail) return new OutputText (buildOutput, ""); diff --git a/tests/common/mac/project_building.mk b/tests/common/mac/project_building.mk index 1694dad2ba51..5779134722a2 100644 --- a/tests/common/mac/project_building.mk +++ b/tests/common/mac/project_building.mk @@ -11,8 +11,8 @@ SOURCES = $(TEST_SRC) \ ALL_SOURCE_FILES = $(TEST_SRC) $(SOURCES) $(EXTRA_FILES) Makefile export MD_APPLE_SDK_ROOT=$(shell dirname `dirname $(XCODE_DEVELOPER_ROOT)`) -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current ifeq ($(V)$(BUILD_REVISION),) diff --git a/tests/mac-binding-project/Makefile b/tests/mac-binding-project/Makefile index 82b2a5e71f17..2a8eea5ba8c7 100644 --- a/tests/mac-binding-project/Makefile +++ b/tests/mac-binding-project/Makefile @@ -2,8 +2,8 @@ TOP=../.. include $(TOP)/Make.config export MD_APPLE_SDK_ROOT=$(shell dirname `dirname $(XCODE_DEVELOPER_ROOT)`) -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current diff --git a/tests/mmptest/Makefile b/tests/mmptest/Makefile index 7360d28891f4..0af6ff70e2ca 100644 --- a/tests/mmptest/Makefile +++ b/tests/mmptest/Makefile @@ -1,8 +1,8 @@ TOP = ../.. include $(TOP)/Make.config -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current diff --git a/tests/mmptest/regression/Makefile b/tests/mmptest/regression/Makefile index ab63b6b7661d..e792e38f0c19 100644 --- a/tests/mmptest/regression/Makefile +++ b/tests/mmptest/regression/Makefile @@ -5,8 +5,8 @@ include $(TOP)/Make.config MMP=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp export MD_APPLE_SDK_ROOT=$(shell dirname `dirname $(XCODE94_DEVELOPER_ROOT)`) -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current diff --git a/tests/mmptest/src/MMPTest.cs b/tests/mmptest/src/MMPTest.cs index f88af1830b68..118111f0c136 100644 --- a/tests/mmptest/src/MMPTest.cs +++ b/tests/mmptest/src/MMPTest.cs @@ -359,9 +359,9 @@ public void Unified_FailedBuild_ShouldRequireAnotherBuildNotSkipMMP () // And try again. // If we fail, we'll likley fail with "did not generate an exe" before returning but let's check anyway - string secondBuildOutput = TI.BuildProject (Path.Combine (tmpDir, TI.GetUnifiedExecutableProjectName (test)), true, diagnosticMSBuild: true); + string secondBuildOutput = TI.BuildProject (Path.Combine (tmpDir, TI.GetUnifiedExecutableProjectName (test)), true); Assert.IsTrue (!secondBuildOutput.Contains ("Skipping target \"_CompileToNative"), "Did not skip"); - Assert.IsTrue (secondBuildOutput.Contains ("CompileToNative needs to be built as output file"), "Did need to build"); + Assert.IsTrue (secondBuildOutput.Contains ("Building target \"_CompileToNative\" completely"), "Did need to build"); } }); } @@ -685,15 +685,15 @@ public void BuildingSameSolutionTwice_ShouldNotRunACToolTwice () string project = TI.GenerateUnifiedExecutableProject (test); - string buildOutput = TI.BuildProject (project, true, diagnosticMSBuild: true, useMSBuild: true); + string buildOutput = TI.BuildProject (project, true); Assert.True (buildOutput.Contains ("actool execution started with arguments"), $"Initial build should run actool"); - buildOutput = TI.BuildProject (project, true, diagnosticMSBuild: true, useMSBuild: true); + buildOutput = TI.BuildProject (project, true); Assert.False (buildOutput.Contains ("actool execution started with arguments"), $"Second build should not run actool"); TI.RunAndAssert ("touch", Path.Combine (tmpDir, "Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png"), "touch icon"); - buildOutput = TI.BuildProject (project, true, diagnosticMSBuild: true, useMSBuild: true); + buildOutput = TI.BuildProject (project, true); Assert.True (buildOutput.Contains ("actool execution started with arguments"), $"Build after touching icon must run actool"); }); } diff --git a/tests/mmptest/src/NetStandardTests.cs b/tests/mmptest/src/NetStandardTests.cs index 70d07c6f340f..fa972b95390b 100644 --- a/tests/mmptest/src/NetStandardTests.cs +++ b/tests/mmptest/src/NetStandardTests.cs @@ -31,7 +31,7 @@ static void NetStandardTestCore (string tmpDir, bool full) string netStandardProject = TI.GenerateNetStandardProject (config); TI.RunAndAssert("/usr/local/share/dotnet/dotnet", $"restore {netStandardProject}", "Restore"); - TI.BuildProject(netStandardProject, true, useMSBuild: true); + TI.BuildProject(netStandardProject, true); config.ItemGroup = $@" @@ -49,7 +49,7 @@ static void NetStandardTestCore (string tmpDir, bool full) config.CSProjConfig = "--registrar=dynamic"; config.XM45 = full; - TI.TestUnifiedExecutable(config, useMSBuild: true); + TI.TestUnifiedExecutable(config); } } } diff --git a/tests/mmptest/src/PackageReferenceTests.cs b/tests/mmptest/src/PackageReferenceTests.cs index 25e534496619..8dc13526a6d4 100644 --- a/tests/mmptest/src/PackageReferenceTests.cs +++ b/tests/mmptest/src/PackageReferenceTests.cs @@ -26,7 +26,7 @@ public void AppsWithPackageReferencs_BuildAndRun (bool full) string project = TI.GenerateUnifiedExecutableProject (config); TI.NugetRestore (project); - TI.BuildProject (project, true, useMSBuild: true); + TI.BuildProject (project, true); TI.RunGeneratedUnifiedExecutable (config); }); } @@ -44,7 +44,7 @@ public void ExtensionProjectPackageReferencs_Build () TI.CopyFileWithSubstitutions (main, main, s => s.Replace ("%TESTCODE%", TestCode)); TI.NugetRestore (project); - string output = TI.BuildProject (Path.Combine (tmpDir, "Today/TodayExtensionTest.csproj"), isUnified: true, useMSBuild: true); + string output = TI.BuildProject (Path.Combine (tmpDir, "Today/TodayExtensionTest.csproj"), isUnified: true); Assert.IsTrue (!output.Contains ("MM2013")); }); } diff --git a/tests/msbuild-mac/src/MSBuild-Smoke.cs b/tests/msbuild-mac/src/MSBuild-Smoke.cs index 5c531dc607d1..da02bd5670f1 100644 --- a/tests/msbuild-mac/src/MSBuild-Smoke.cs +++ b/tests/msbuild-mac/src/MSBuild-Smoke.cs @@ -163,11 +163,11 @@ public void BuildingSameBindingProject_TwoTimes_ShallNotInvokeMMPTwoTimes () { var config = new TI.UnifiedTestConfig (tmpDir) { ProjectName = project, ItemGroup = nativeRefItemGroup }; string projectPath = TI.GenerateBindingLibraryProject (config); - string buildOutput = TI.BuildProject (projectPath, isUnified: true, diagnosticMSBuild: true); - Assert.IsTrue (buildOutput.Contains ("Target CoreCompile needs to be built")); + string buildOutput = TI.BuildProject (projectPath, isUnified: true); + Assert.IsTrue (buildOutput.Contains (@"Building target ""CoreCompile""")); - string secondBuildOutput = TI.BuildProject (projectPath, isUnified: true, diagnosticMSBuild: true); - Assert.IsFalse (secondBuildOutput.Contains ("Target CoreCompile needs to be built")); + string secondBuildOutput = TI.BuildProject (projectPath, isUnified: true); + Assert.IsFalse (secondBuildOutput.Contains (@"Building target ""CoreCompile""")); } }); } @@ -181,11 +181,11 @@ public void BuildingSameProject_TwoTimes_ShallNotInvokeMMPTwoTimes () { var config = new TI.UnifiedTestConfig (tmpDir) { ProjectName = project }; string projectPath = TI.GenerateEXEProject (config); - string buildOutput = TI.BuildProject (projectPath, isUnified: true, diagnosticMSBuild: true); - Assert.IsTrue (buildOutput.Contains ("Target _CompileToNative needs to be built")); + string buildOutput = TI.BuildProject (projectPath, isUnified: true); + Assert.IsTrue (buildOutput.Contains (@"Building target ""_CompileToNative""")); - string secondBuildOutput = TI.BuildProject (projectPath, isUnified: true, diagnosticMSBuild: true); - Assert.IsFalse (secondBuildOutput.Contains ("Target _CompileToNative needs to be built")); + string secondBuildOutput = TI.BuildProject (projectPath, isUnified: true); + Assert.IsFalse (secondBuildOutput.Contains (@"Building target ""_CompileToNative""")); } }); } diff --git a/tests/msbuild-mac/src/RoslynSmokeTests.cs b/tests/msbuild-mac/src/RoslynSmokeTests.cs index 71f5e7d93793..6b81270313f8 100644 --- a/tests/msbuild-mac/src/RoslynSmokeTests.cs +++ b/tests/msbuild-mac/src/RoslynSmokeTests.cs @@ -26,7 +26,7 @@ public void XMModernRosylnProjet_ShouldBuildAndRunWithMSBuild () TI.CleanUnifiedProject (projectPath); RestoreRoslynNuget ("Modern"); - TI.BuildProject (projectPath, true, useMSBuild: true); + TI.BuildProject (projectPath, true); TI.RunAndAssert (Path.Combine (RoslynTestProjectRoot, "Modern/bin/Debug/RoslynTestApp.app/Contents/MacOS/RoslynTestApp"), new StringBuilder (), "Run"); } @@ -37,7 +37,7 @@ public void XMFullRosylnProjet_ShouldBuildAndRunWithMSBuild () TI.CleanUnifiedProject (projectPath); RestoreRoslynNuget ("Full"); - TI.BuildProject (projectPath, true, useMSBuild: true); + TI.BuildProject (projectPath, true); TI.RunAndAssert (Path.Combine (RoslynTestProjectRoot, "Full/bin/Debug/RoslynTestApp.app/Contents/MacOS/RoslynTestApp"), new StringBuilder (), "Run"); } } diff --git a/tests/msbuild-mac/src/RuntimeTests.cs b/tests/msbuild-mac/src/RuntimeTests.cs index 8f09dfd61d27..f0a1a370c983 100644 --- a/tests/msbuild-mac/src/RuntimeTests.cs +++ b/tests/msbuild-mac/src/RuntimeTests.cs @@ -18,7 +18,7 @@ public void AssemblyRegistration () var projectPath = Path.Combine (TestProjectRoot, projectName, $"{projectName}.csproj"); TI.CleanUnifiedProject (projectPath); - TI.BuildProject (projectPath, true, useMSBuild: false); + TI.BuildProject (projectPath, true); TI.RunAndAssert (Path.Combine (Path.GetDirectoryName (projectPath), $"bin/Debug/{projectName}.app/Contents/MacOS/{projectName}"), new StringBuilder (), "Run"); } } diff --git a/tests/mtouch/Makefile b/tests/mtouch/Makefile index 0e2d9b2ac680..0043a940c067 100644 --- a/tests/mtouch/Makefile +++ b/tests/mtouch/Makefile @@ -3,8 +3,8 @@ TOP=../.. include $(TOP)/Make.config export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) -export XBUILD_FRAMEWORK_FOLDERS_PATH=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks -export MSBuildExtensionsPath=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild +export TargetFrameworkFallbackSearchPaths=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks +export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild check: run-tests @@ -29,7 +29,7 @@ run-tests: test.config @[[ ! -e .failed-stamp ]] build: - $(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore mtouch.sln + $(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore packages.config $(SYSTEM_XBUILD) mtouch.csproj $(XBUILD_VERBOSITY) $(Q) rm -f .failed-stamp diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs index e0bbc25a3dfb..0ebf062c0119 100644 --- a/tests/xharness/Jenkins.cs +++ b/tests/xharness/Jenkins.cs @@ -2472,8 +2472,8 @@ protected void SetEnvironmentVariables (Process process) case TestPlatform.watchOS: process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; process.StartInfo.EnvironmentVariables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); - process.StartInfo.EnvironmentVariables ["XBUILD_FRAMEWORK_FOLDERS_PATH"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); - process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); + process.StartInfo.EnvironmentVariables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); + process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine (Harness.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); break; case TestPlatform.Mac: case TestPlatform.Mac_Classic: @@ -2482,15 +2482,15 @@ protected void SetEnvironmentVariables (Process process) case TestPlatform.Mac_UnifiedXM45: case TestPlatform.Mac_UnifiedXM45_32: process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; - process.StartInfo.EnvironmentVariables ["XBUILD_FRAMEWORK_FOLDERS_PATH"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); - process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); + process.StartInfo.EnvironmentVariables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); + process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); process.StartInfo.EnvironmentVariables ["XamarinMacFrameworkRoot"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); process.StartInfo.EnvironmentVariables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; case TestPlatform.All: // Don't set: // MSBuildExtensionsPath - // XBUILD_FRAMEWORK_FOLDERS_PATH + // TargetFrameworkFallbackSearchPaths // because these values used by both XM and XI and we can't set it to two different values at the same time. // Any test that depends on these values should not be using 'TestPlatform.All' process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot; @@ -2751,7 +2751,7 @@ protected override async Task ExecuteAsync () await RestoreNugetsAsync (log, resource); using (var xbuild = new Process ()) { - xbuild.StartInfo.FileName = UseMSBuild ? "msbuild" : "xbuild"; + xbuild.StartInfo.FileName = UseMSBuild ? "msbuild" : "msbuild"; var args = new StringBuilder (); args.Append ("/verbosity:diagnostic "); if (SpecifyPlatform) @@ -2787,7 +2787,7 @@ async Task CleanProjectAsync (Log log, string project_file, string project_platf { // Don't require the desktop resource here, this shouldn't be that resource sensitive using (var xbuild = new Process ()) { - xbuild.StartInfo.FileName = "xbuild"; + xbuild.StartInfo.FileName = "msbuild"; var args = new StringBuilder (); args.Append ("/verbosity:diagnostic "); if (project_platform != null) diff --git a/tests/xharness/MakefileGenerator.cs b/tests/xharness/MakefileGenerator.cs index 2e0796e1ba35..5f51eb0d49aa 100644 --- a/tests/xharness/MakefileGenerator.cs +++ b/tests/xharness/MakefileGenerator.cs @@ -181,8 +181,8 @@ public static void CreateMacMakefile (Harness harness, IEnumerable ta writer.WriteLine (); writer.WriteLine ("MD_APPLE_SDK_ROOT_EVALUATED:=$(shell dirname `dirname $(XCODE_DEVELOPER_ROOT)`)"); - var enviromentalVariables = new Dictionary () { { "XBUILD_FRAMEWORK_FOLDERS_PATH", "$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks"}, - { "MSBuildExtensionsPath", "$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild"}, + var enviromentalVariables = new Dictionary () { { "TargetFrameworkFallbackSearchPaths", "$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks"}, + { "MSBuildExtensionsPathFallbackPaths", "$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild"}, { "MD_APPLE_SDK_ROOT", "$(MD_APPLE_SDK_ROOT_EVALUATED)"} }; diff --git a/tests/xharness/ProjectFileExtensions.cs b/tests/xharness/ProjectFileExtensions.cs index e5bf9e9558dc..df9970739522 100644 --- a/tests/xharness/ProjectFileExtensions.cs +++ b/tests/xharness/ProjectFileExtensions.cs @@ -822,7 +822,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 [] { "Import", "Project", "CustomBuildActions.targets", "../SyncTestResources.targets" }, new string [] { "FilesToCopy", "Include" }, new string [] { "FilesToCopyFoo", "Include" }, new string [] { "FilesToCopyFooBar", "Include" }, @@ -870,10 +870,19 @@ public static void ResolveAllPaths (this XmlDocument csproj, string project_path var a = node.Attributes [attrib]; if (a == null) continue; + + // entries after index 2 is a list of values to filter the attribute value against. + var found = kvp.Length == 2; + var skipLogicalName = kvp.Length > 2; + for (var i = 2; i < kvp.Length; i++) + found |= a.Value == kvp [i]; + if (!found) + continue; + // Fix any default LogicalName values (but don't change existing ones). var ln = node.SelectElementNodes ("LogicalName")?.SingleOrDefault (); var links = node.SelectElementNodes ("Link"); - if (ln == null && !links.Any ()) { + if (!skipLogicalName && ln == null && !links.Any ()) { ln = csproj.CreateElement ("LogicalName", MSBuild_Namespace); node.AppendChild (ln);