diff --git a/tests/msbuild/Xamarin.MacDev.Tests/DotnetTest.cs b/tests/msbuild/Xamarin.MacDev.Tests/DotnetTest.cs index 1af6a6603d..fc30972ee8 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/DotnetTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/DotnetTest.cs @@ -15,12 +15,9 @@ namespace Xamarin.iOS.Tasks { [TestFixture ("iPhoneSimulator", "Debug")] [TestFixture ("iPhoneSimulator", "Release")] public class DotNetTest : ProjectTest { - public string ProjectConfiguration; - public DotNetTest (string platform, string configuration) - : base (platform) + : base (platform, configuration) { - ProjectConfiguration = configuration; } string tfi; diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs index 342b8d5585..8136041ce1 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs @@ -8,10 +8,9 @@ namespace Xamarin.iOS.Tasks [TestFixture ("iPhoneSimulator")] public class BindingProject : TestBase { - string Platform; public BindingProject (string platform) + : base (platform) { - Platform = platform; } [Test] diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs index 7ceb69f0d5..f3f904bb7a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs @@ -12,15 +12,14 @@ namespace Xamarin.iOS.Tasks [TestFixture] public class Bug60536 : ProjectTest { - public Bug60536 () : base ("iPhoneSimulator") + public Bug60536 () + : base ("iPhoneSimulator", "Debug") { } [Test] public void TestACToolTaskCatchesJsonException () { - var platform = "iPhoneSimulator"; - var config = "Debug"; var target = "Build"; var mtouchPaths = SetupProjectPaths ("Bug60536", "../", true, platform, config); @@ -29,8 +28,8 @@ namespace Xamarin.iOS.Tasks var project = SetupProject (Engine, csproj); AppBundlePath = mtouchPaths.AppBundlePath; - Engine.ProjectCollection.SetGlobalProperty("Platform", platform); - Engine.ProjectCollection.SetGlobalProperty("Configuration", config); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Configuration", Config); RunTarget (project, "Clean"); Assert.IsFalse (Directory.Exists (AppBundlePath), "App bundle exists after cleanup: {0} ", AppBundlePath); @@ -38,8 +37,8 @@ namespace Xamarin.iOS.Tasks Assert.IsFalse (Directory.Exists (AppBundlePath + ".mSYM"), "App bundle .mSYM exists after cleanup: {0} ", AppBundlePath + ".mSYM"); var baseDir = Path.GetDirectoryName (csproj); - var objDir = Path.Combine (baseDir, "obj", platform, config); - var binDir = Path.Combine (baseDir, "bin", platform, config); + var objDir = Path.Combine (baseDir, "obj", Platform, Config); + var binDir = Path.Combine (baseDir, "bin", Platform, Config); if (Directory.Exists (objDir)) { var path = Directory.EnumerateFiles (objDir, "*.*", SearchOption.AllDirectories).FirstOrDefault (); @@ -62,7 +61,7 @@ namespace Xamarin.iOS.Tasks Assert.AreEqual (1, Engine.Logger.ErrorEvents.Count, "#RunTarget-ErrorCount" + messages); } - var expectedFile = Path.Combine ("obj", platform, config, "actool", "cloned-assets", "Assets.xcassets", "AppIcon.appiconset", "Contents.json"); + var expectedFile = Path.Combine ("obj", Platform, Config, "actool", "cloned-assets", "Assets.xcassets", "AppIcon.appiconset", "Contents.json"); Assert.AreEqual (expectedFile, Engine.Logger.ErrorEvents[0].File, "File"); Assert.AreEqual (197, Engine.Logger.ErrorEvents[0].LineNumber, "LineNumber"); Assert.AreEqual (4, Engine.Logger.ErrorEvents[0].ColumnNumber, "ColumnNumber"); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs index 61b965ff67..8bacfc8dda 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs @@ -18,11 +18,9 @@ namespace Xamarin.iOS.Tasks //[TestFixture ("iPhoneSimulator", "Release")] public class CodesignAppBundle : ProjectTest { - readonly string config; - - public CodesignAppBundle (string platform, string configuration) : base (platform) + public CodesignAppBundle (string platform, string configuration) + : base (platform, configuration) { - config = configuration; } static bool IsCodesigned (string path) @@ -61,7 +59,7 @@ namespace Xamarin.iOS.Tasks { bool expectedCodesignResults = Platform != "iPhoneSimulator"; - BuildProject ("MyTabbedApplication", Platform, config, clean: true); + BuildProject ("MyTabbedApplication"); AssertProperlyCodesigned (expectedCodesignResults); @@ -79,7 +77,7 @@ namespace Xamarin.iOS.Tasks EnsureFilestampChange (); // Rebuild w/ no changes - BuildProject ("MyTabbedApplication", Platform, config, clean: false); + BuildProject ("MyTabbedApplication", clean: false); AssertProperlyCodesigned (expectedCodesignResults); @@ -119,7 +117,7 @@ namespace Xamarin.iOS.Tasks [Test] public void CodesignAfterModifyingAppExtensionTest () { - var csproj = BuildProject ("MyTabbedApplication", Platform, config, clean: true); + var csproj = BuildProject ("MyTabbedApplication", clean: true).ProjectCSProjPath; var testsDir = Path.GetDirectoryName (Path.GetDirectoryName (csproj)); var appexProjectDir = Path.Combine (testsDir, "MyActionExtension"); var viewController = Path.Combine (appexProjectDir, "ActionViewController.cs"); @@ -137,7 +135,7 @@ namespace Xamarin.iOS.Tasks File.WriteAllText (viewController, text); try { - BuildProject ("MyTabbedApplication", Platform, config, clean: false); + BuildProject ("MyTabbedApplication", clean: false); var newTimestamp = File.GetLastWriteTimeUtc (mainExecutable); // make sure that the main app bundle was codesigned due to the changes in the appex @@ -156,14 +154,14 @@ namespace Xamarin.iOS.Tasks { bool expectedCodesignResults = Platform != "iPhoneSimulator"; - BuildProject ("MyWatch2Container", Platform, config, clean: true); + BuildProject ("MyWatch2Container"); AssertProperlyCodesigned (expectedCodesignResults); EnsureFilestampChange (); // Rebuild w/ no changes - BuildProject ("MyWatch2Container", Platform, config, clean: false); + BuildProject ("MyWatch2Container", clean: false); // make sure everything is still codesigned properly AssertProperlyCodesigned (expectedCodesignResults); @@ -172,7 +170,7 @@ namespace Xamarin.iOS.Tasks [Test] public void CodesignAfterModifyingWatchApp2Test () { - var csproj = BuildProject ("MyWatch2Container", Platform, config, clean: true); + var csproj = BuildProject ("MyWatch2Container", clean: true).ProjectCSProjPath; var testsDir = Path.GetDirectoryName (Path.GetDirectoryName (csproj)); var appexProjectDir = Path.Combine (testsDir, "MyWatchKit2Extension"); var viewController = Path.Combine (appexProjectDir, "InterfaceController.cs"); @@ -190,7 +188,7 @@ namespace Xamarin.iOS.Tasks File.WriteAllText (viewController, text); try { - BuildProject ("MyWatch2Container", Platform, config, clean: false); + BuildProject ("MyWatch2Container", clean: false); AssertProperlyCodesigned (expectedCodesignResults); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs index 3135712da9..b14267c522 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs @@ -34,14 +34,13 @@ namespace Xamarin.iOS.Tasks public void LibraryCompilation () { var appName = "MySceneKitLibrary"; - var platform = "AnyCPU"; - var config = "Debug"; var mtouchPaths = SetupProjectPaths (appName, "../", true, platform, config); var proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath); + Platform = "AnyCPU"; - Engine.ProjectCollection.SetGlobalProperty ("Platform", platform); - Engine.ProjectCollection.SetGlobalProperty ("Configuration", config); + Engine.ProjectCollection.SetGlobalProperty ("Platform", Platform); + Engine.ProjectCollection.SetGlobalProperty ("Configuration", Config); RunTarget (proj, "Build", 0); } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs index 2a2407d56c..692404a171 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs @@ -43,14 +43,14 @@ namespace Xamarin.iOS.Tasks [Test] public void RebuildTest () { - BuildProject ("MyCoreMLApp", Platform, "Debug", clean: true); + BuildProject ("MyCoreMLApp"); AssertCompiledModelExists ("SqueezeNet"); EnsureFilestampChange (); // Rebuild w/ no changes - BuildProject ("MyCoreMLApp", Platform, "Debug", clean: false); + BuildProject ("MyCoreMLApp", clean: false); AssertCompiledModelExists ("SqueezeNet"); } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs index faa6d45414..52ae24f46c 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs @@ -12,7 +12,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - BuildExtension ("MyTabbedApplication", "MyActionExtension", Platform, "Debug"); + BuildExtension ("MyTabbedApplication", "MyActionExtension"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs index 1334fb2fd5..0ba0621ddf 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs @@ -19,7 +19,7 @@ namespace Xamarin.iOS.Tasks { { if (Platform == "iPhoneSimulator" && Environment.OSVersion.Version.Major < 19) // Environment.OSVersion = 19.* in macOS Catalina. Assert.Ignore ("Metal support is not available in the simulator until macOS 10.15."); - this.BuildExtension ("MyMetalGame", "MyKeyboardExtension", Platform, "Debug"); + this.BuildExtension ("MyMetalGame", "MyKeyboardExtension"); this.TestStoryboardC (AppBundlePath); } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs index 490749dfdd..5c54f2f7aa 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs @@ -13,7 +13,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - this.BuildExtension ("MyWebViewApp", "MyDocumentPickerExtension", Platform, "Debug"); + this.BuildExtension ("MyWebViewApp", "MyDocumentPickerExtension"); this.TestStoryboardC (AppBundlePath); } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs index b831d64595..117ce578f3 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs @@ -8,13 +8,11 @@ using Microsoft.Build.Evaluation; namespace Xamarin.iOS.Tasks { public class ExtensionTestBase : TestBase { - public string Platform; - public ExtensionTestBase () { } public ExtensionTestBase (string platform) + : base (platform) { - Platform = platform; } public Project BuildExtension (string hostAppName, string extensionName, string platform, string config, int expectedErrorCount = 0, System.Action additionalAsserts = null) @@ -53,15 +51,15 @@ namespace Xamarin.iOS.Tasks var basedirs = new List (); if (IsWatchOS) { basedirs.Add (extensionPath); - coreFiles = GetCoreAppFiles (platform, config, extensionName + ".dll", Path.GetFileNameWithoutExtension (extensionPath)); + coreFiles = GetCoreAppFiles (extensionName + ".dll", Path.GetFileNameWithoutExtension (extensionPath)); } else { basedirs.Add (AppBundlePath); - if (platform == "iPhone") { + if (Platform == "iPhone") { basedirs.Add (Path.Combine (AppBundlePath, ".monotouch-32")); basedirs.Add (Path.Combine (AppBundlePath, "Frameworks", "Xamarin.Sdk.framework", "MonoBundle")); basedirs.Add (Path.Combine (AppBundlePath, "Frameworks", "Xamarin.Sdk.framework", "MonoBundle", ".monotouch-32")); } - coreFiles = GetCoreAppFiles (platform, config, hostAppName + ".exe", hostAppName); + coreFiles = GetCoreAppFiles (hostAppName + ".exe", hostAppName); } TestFilesExists (basedirs.ToArray (), coreFiles); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/PhotoEditing.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/PhotoEditing.cs index a1fe77bdc1..16fde47573 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/PhotoEditing.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/PhotoEditing.cs @@ -12,7 +12,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - this.BuildExtension ("MySpriteKitGame", "MyPhotoEditingExtension", Platform, "Debug"); + this.BuildExtension ("MySpriteKitGame", "MyPhotoEditingExtension"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Share.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Share.cs index 2c8abf3f2d..3a72f35cf7 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Share.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Share.cs @@ -12,7 +12,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - this.BuildExtension ("MyMasterDetailApp", "MyShareExtension", Platform, "Debug"); + this.BuildExtension ("MyMasterDetailApp", "MyShareExtension"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Today.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Today.cs index 20ad33a113..bea30cdfb2 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Today.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Today.cs @@ -12,7 +12,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - this.BuildExtension ("MyOpenGLApp", "MyTodayExtension", Platform, "Debug"); + this.BuildExtension ("MyOpenGLApp", "MyTodayExtension"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs index e27ea3d7c7..81316238c6 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs @@ -12,7 +12,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - BuildExtension ("MyWatchApp", "MyWatchKitExtension", Platform, "Debug", expectedErrorCount: 1); + BuildExtension ("MyWatchApp", "MyWatchKitExtension", expectedErrorCount: 1); Assert.AreEqual ("Xamarin.iOS 14+ does not support watchOS 1 apps. Please migrate your project to watchOS 2+.", Engine.Logger.ErrorEvents[0].Message, "WK 1 error message"); } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs index 12771cc5dd..f662269ec9 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs @@ -18,7 +18,7 @@ namespace Xamarin.iOS.Tasks { if (!Xamarin.Tests.Configuration.include_watchos) Assert.Ignore ("WatchOS is not enabled"); - BuildExtension ("MyWatchApp2", "MyWatchKit2Extension", Platform, "Debug"); + BuildExtension ("MyWatchApp2", "MyWatchKit2Extension"); if (Platform == "iPhone") { // make sure the dSYMs exist diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs index de85167788..ac59cb9033 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs @@ -13,7 +13,7 @@ namespace Xamarin.iOS.Tasks [Test] public void BuildTest () { - BuildProject ("MyIBToolLinkTest", Platform, "Debug"); + BuildProject ("MyIBToolLinkTest"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs index f31920cc22..53d3335b9e 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs @@ -17,7 +17,7 @@ namespace Xamarin.iOS.Tasks [Test] public void BuildTest () { - BuildProject ("MyLinkedAssets", Platform, "Debug"); + BuildProject ("MyLinkedAssets"); foreach (var name in IconNames) { var path = Path.Combine (AppBundlePath, name); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs index 1327e26815..9cb03d27a1 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs @@ -8,17 +8,16 @@ namespace Xamarin.iOS.Tasks { public class ProjectTest : TestBase { public string BundlePath; - public string Platform; public ProjectTest (string platform) + : base (platform) { - Platform = platform; } public ProjectTest (string bundlePath, string platform) + : base (platform) { BundlePath = bundlePath; - Platform = platform; } @@ -52,8 +51,8 @@ namespace Xamarin.iOS.Tasks Assert.IsFalse (Directory.Exists (AppBundlePath + ".mSYM"), "App bundle .mSYM exists after cleanup: {0} ", AppBundlePath + ".mSYM"); var baseDir = Path.GetDirectoryName (csproj); - var objDir = Path.Combine (baseDir, "obj", platform, config); - var binDir = Path.Combine (baseDir, "bin", platform, config); + var objDir = Path.Combine (baseDir, "obj", Platform, Config); + var binDir = Path.Combine (baseDir, "bin", Platform, Config); if (Directory.Exists (objDir)) { var paths = Directory.EnumerateFiles (objDir, "*.*", SearchOption.AllDirectories) @@ -82,7 +81,7 @@ namespace Xamarin.iOS.Tasks TestFilesDoNotExist (AppBundlePath, UnexpectedAppFiles); if (executionMode != ExecutionMode.DotNet) { - var coreFiles = GetCoreAppFiles (platform, config, appName.Replace (" ", "") + ".exe", appName.Replace (" ", "")); + var coreFiles = GetCoreAppFiles (appName.Replace (" ", "") + ".exe", appName.Replace (" ", "")); var baseDirs = new string [] { Path.Combine (AppBundlePath, ".monotouch-32"), Path.Combine (AppBundlePath, ".monotouch-64"), @@ -94,7 +93,7 @@ namespace Xamarin.iOS.Tasks TestFilesExists (baseDirs, coreFiles); } - if (platform == "iPhone") { + if (Platform == "iPhone") { var dSYMInfoPlist = Path.Combine (AppBundlePath + ".dSYM", "Contents", "Info.plist"); var nativeExecutable = Path.Combine (AppBundlePath, appName); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs index 6f8410998e..4ef4bef3b1 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs @@ -13,7 +13,7 @@ namespace Xamarin.iOS.Tasks { [Test] public void BasicTest () { - this.BuildExtension ("MyMasterDetailApp", "MyShareExtension", Platform, "Debug"); + this.BuildExtension ("MyMasterDetailApp", "MyShareExtension"); // Verify that Mono.frameworks is in the app Assert.That (Directory.Exists (Path.Combine (AppBundlePath, "Frameworks")), "Frameworks exists"); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs index 6b9d36d35c..ccb8b82c48 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs @@ -15,7 +15,7 @@ namespace Xamarin.iOS.Tasks [Test] public void BasicTest () { - this.BuildProject ("My Spaced App", Platform, "Debug", clean: false); + this.BuildProject ("My Spaced App", clean: false); // Message of the form: // Property reassignment: $(AssemblySearchPaths)="..." (previous value: "...") at Xamarin.iOS.Common.props (106,3) diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs index ef4a3d9f42..943af47475 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs @@ -11,14 +11,15 @@ namespace Xamarin.iOS.Tasks [TestFixture ("iPhone")] public class ReleaseBuild : ProjectTest { - public ReleaseBuild (string platform) : base (platform) + public ReleaseBuild (string platform) + : base (platform, "Release") { } [Test] public void BuildTest () { - BuildProject ("MyReleaseBuild", Platform, "Release"); + BuildProject ("MyReleaseBuild"); var args = new List { "-r", "UIWebView", AppBundlePath }; ExecutionHelper.Execute ("grep", args, out var output); @@ -29,7 +30,7 @@ namespace Xamarin.iOS.Tasks [Test] public void RebuildTest () { - var csproj = BuildProject ("MyReleaseBuild", Platform, "Release", clean: true); + var csproj = BuildProject ("MyReleaseBuild").ProjectCSProjPath; var bak = Path.Combine (Path.GetDirectoryName (csproj), "MyReleaseBuild.csproj.bak"); var llvm = Path.Combine (Path.GetDirectoryName (csproj), "MyReleaseBuildLlvm.csproj"); @@ -41,7 +42,7 @@ namespace Xamarin.iOS.Tasks EnsureFilestampChange (); // Rebuild w/ no changes - BuildProject ("MyReleaseBuild", Platform, "Release", clean: false); + BuildProject ("MyReleaseBuild", clean: false); var newTimestamps = Directory.EnumerateFiles (AppBundlePath, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file)); var newDSymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file)); @@ -60,7 +61,7 @@ namespace Xamarin.iOS.Tasks File.Copy (llvm, csproj, true); File.SetLastWriteTimeUtc (csproj, DateTime.UtcNow); - BuildProject ("MyReleaseBuild", Platform, "Release", clean: false); + BuildProject ("MyReleaseBuild", clean: false); } finally { File.Copy (bak, csproj, true); File.Delete (bak); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs index ab898a892e..084d7a5d42 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs @@ -14,7 +14,7 @@ namespace Xamarin.iOS.Tasks [Test] public void ProjectWithExtraArgment_CorrectlyOverridesLinkingParam () { - BuildProject ("AppWithExtraArgumentThatOverrides", Platform, "Debug", clean: true); + BuildProject ("AppWithExtraArgumentThatOverrides"); Assert.True (Engine.Logger.MessageEvents.Any (x => x.Message.Contains ("using mode 'SDKOnly'"))); } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs index 286e8b990e..52a833744f 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs @@ -17,7 +17,7 @@ namespace Xamarin.iOS.Tasks { if (Platform == "iPhoneSimulator" && Environment.OSVersion.Version.Major < 19) // Environment.OSVersion = 19.* in macOS Catalina. Assert.Ignore ("Metal support is not available in the simulator until macOS 10.15."); - BuildExtension ("MyTVApp", "MyTVServicesExtension", Platform, "Debug"); + BuildExtension ("MyTVApp", "MyTVServicesExtension"); } public override string TargetFrameworkIdentifier { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVMetalGameTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVMetalGameTests.cs index 7ad2e384d1..6a8a463556 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVMetalGameTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVMetalGameTests.cs @@ -15,7 +15,7 @@ namespace Xamarin.iOS.Tasks { { if (Platform == "iPhoneSimulator" && Environment.OSVersion.Version.Major < 19) // Environment.OSVersion = 19.* in macOS Catalina. Assert.Ignore ("Metal support is not available in the simulator until macOS 10.15."); - BuildProject ("MyTVMetalGame", Platform, "Debug"); + BuildProject ("MyTVMetalGame"); } public override string TargetFrameworkIdentifier { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs index e38dd12a98..3ddb9b58f2 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs @@ -19,18 +19,16 @@ namespace Xamarin.iOS.Tasks NugetRestore (Path.Combine (testdir, "MyXamarinFormsApp", "MyXamarinFormsAppNS", "MyXamarinFormsAppNS.csproj")); // First build - BuildProject ("MyXamarinFormsApp", Platform, "Debug"); + BuildProject ("MyXamarinFormsApp"); Assert.IsFalse (IsTargetSkipped ("_CompileToNative"), "_CompileToNative should *not* be skipped on first build."); // Build with no changes - Engine.Logger.Clear (); - BuildProject ("MyXamarinFormsApp", Platform, "Debug", clean: false); + BuildProject ("MyXamarinFormsApp", clean: false); Assert.IsTrue (IsTargetSkipped ("_CompileToNative"), "_CompileToNative should be skipped on a build with no changes."); // Build with XAML change Touch (Path.Combine (testdir, "MyXamarinFormsApp", "MyXamarinFormsAppNS", "App.xaml")); - Engine.Logger.Clear (); - BuildProject ("MyXamarinFormsApp", Platform, "Debug", clean: false); + BuildProject ("MyXamarinFormsApp", clean: false); Assert.IsFalse (IsTargetSkipped ("_CompileToNative"), "_CompileToNative should *not* be skipped on a build with a XAML change."); } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs index a92bd624f3..d76581106d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs @@ -13,6 +13,11 @@ namespace Xamarin.iOS.Tasks [TestFixture] public class TargetTests : TestBase { + public TargetTests () + : base ("iPhoneSimulator") + { + } + string[] ExpectedExecutableBundleResources { get { var files = new [] { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs index 1178382c80..1af8f5c58a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs @@ -25,6 +25,24 @@ namespace Xamarin.iOS.Tasks public abstract class TestBase { + public string Platform; + public string Config = "Debug"; + + public TestBase () + { + } + + public TestBase (string platform) + { + Platform = platform; + } + + public TestBase (string platform, string config) + { + Platform = platform; + Config = config; + } + protected static class TargetName { public static string Build = "Build"; @@ -62,30 +80,30 @@ namespace Xamarin.iOS.Tasks public string [] ExpectedAppFiles = { }; public string [] UnexpectedAppFiles = { "monotouch.dll" }; - public string[] GetCoreAppFiles (string platform, string config, string managedExe, string nativeExe) + public string[] GetCoreAppFiles (string managedExe, string nativeExe) { var coreFiles = new List (); if (TargetFrameworkIdentifier == "Xamarin.WatchOS") { coreFiles.Add ("Xamarin.WatchOS.dll"); - if (config == "Debug") + if (Config == "Debug") coreFiles.Add ("Xamarin.WatchOS.pdb"); } else if (TargetFrameworkIdentifier == "Xamarin.TVOS") { coreFiles.Add ("Xamarin.TVOS.dll"); - if (config == "Debug") + if (Config == "Debug") coreFiles.Add ("Xamarin.TVOS.pdb"); } else { coreFiles.Add ("Xamarin.iOS.dll"); - if (config == "Debug") + if (Config == "Debug") coreFiles.Add ("Xamarin.iOS.pdb"); } coreFiles.Add ("mscorlib.dll"); - if (config == "Debug") + if (Config == "Debug") coreFiles.Add ("mscorlib.pdb"); coreFiles.Add (managedExe); - if (config == "Debug") + if (Config == "Debug") coreFiles.Add (Path.ChangeExtension (managedExe, ".pdb")); coreFiles.Add (nativeExe);