diff --git a/msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs b/msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs index c0854551bcf1..305e5d5dbb99 100644 --- a/msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs +++ b/msbuild/Xamarin.Mac.Tasks.Core/Tasks/MmpTaskBase.cs @@ -72,8 +72,8 @@ protected override string ToolName { public string I18n { get; set; } public string ExtraArguments { get; set; } - public string AotScope { get; set; } - public bool HybridAotOption { get; set; } + public string AotMode { get; set; } + public bool HybridAOT { get; set; } public string ExplicitAotAssemblies { get; set; } public ITaskItem [] ExplicitReferences { get; set; } @@ -176,9 +176,9 @@ protected override string GenerateCommandLineCommands () break; } - if (!string.IsNullOrEmpty (AotScope) && AotScope != "None") { - var aot = $"--aot:{AotScope.ToLower ()}"; - if (HybridAotOption) + if (!string.IsNullOrEmpty (AotMode) && AotMode != "None") { + var aot = $"--aot:{AotMode.ToLower ()}"; + if (HybridAOT) aot += "|hybrid"; if (!string.IsNullOrEmpty (ExplicitAotAssemblies)) diff --git a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets index dd5549d90028..b21131d55262 100644 --- a/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets +++ b/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets @@ -556,8 +556,8 @@ Copyright (C) 2014 Xamarin. All rights reserved. SdkVersion="$(MacOSXSdkVersion)" IsAppExtension="$(IsAppExtension)" EnableSGenConc="$(EnableSGenConc)" - AotScope="$(AotScope)" - HybridAotOption="$(HybridAotOption)" + AotMode="$(AOTMode)" + HybridAOT="$(HybridAOT)" ExplicitAotAssemblies="$(ExplicitAotAssemblies)"> diff --git a/tests/mmptest/src/AOTTests.cs b/tests/mmptest/src/AOTTests.cs index 21980b60bb7f..17af0f3a1936 100644 --- a/tests/mmptest/src/AOTTests.cs +++ b/tests/mmptest/src/AOTTests.cs @@ -21,22 +21,42 @@ void ValidateAOTStatus (string tmpDir, Func shouldAOT, string bu } } - const string AOTTestBaseConfig = "--aot=core,-Xamarin.Mac.dll"; - const string AOTTestHybridConfig = "--aot=all|hybrid"; + enum TestType { Base, Hybrid } + + string GetTestConfig (TestType type, bool useProjectTags) + { + if (useProjectTags) { + switch (type) { + case TestType.Base: + return "Core"; + case TestType.Hybrid: + return "Alltrue"; + } + } else { + switch (type) { + case TestType.Base: + return "--aot=core"; + case TestType.Hybrid: + return "--aot=all|hybrid"; + } + } + throw new NotImplementedException (); + } DirectoryInfo GetOutputDirInfo (string tmpDir) => new DirectoryInfo (Path.Combine (tmpDir, GetOutputBundlePath (tmpDir))); string GetOutputAppPath (string tmpDir) => Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MacOS/UnifiedExample"); string GetOutputBundlePath (string tmpDir) => Path.Combine (tmpDir, "bin/Debug/UnifiedExample.app/Contents/MonoBundle"); bool IsFileManagedCode (FileInfo file) => file.Extension.ToLowerInvariant () == ".exe" || file.Extension.ToLowerInvariant () == ".dll"; - bool ShouldBaseFilesBeAOT (FileInfo file) => file.Name == "System.dll" || file.Name == "mscorlib.dll"; + bool ShouldBaseFilesBeAOT (FileInfo file) => file.Name == "Xamarin.Mac.dll" || file.Name == "System.dll" || file.Name == "mscorlib.dll"; // AOT unit tests can be found in tools/mmp/tests - [Test] - public void AOT_SmokeTest () { + [TestCase (false)] + [TestCase (true)] + public void AOT_SmokeTest (bool useProjectTags) { RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { - CSProjConfig = AOTTestBaseConfig + CSProjConfig = GetTestConfig (TestType.Base, useProjectTags) }; string buildResults = TI.TestUnifiedExecutable (test).BuildOutput; @@ -44,12 +64,13 @@ public void AOT_SmokeTest () { }); } - [Test] - public void AOT_32Bit_SmokeTest () + [TestCase (false)] + [TestCase (true)] + public void AOT_32Bit_SmokeTest (bool useProjectTags) { RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { - CSProjConfig = "i386" + AOTTestBaseConfig + CSProjConfig = "i386" + GetTestConfig (TestType.Base, useProjectTags) }; string buildResults = TI.TestUnifiedExecutable (test).BuildOutput; @@ -57,12 +78,13 @@ public void AOT_32Bit_SmokeTest () }); } - [Test] - public void HybridAOT_WithManualStrippingOfAllLibs_SmokeTest () + [TestCase (false)] + [TestCase (true)] + public void HybridAOT_WithManualStrippingOfAllLibs_SmokeTest (bool useProjectTags) { RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { - CSProjConfig = AOTTestHybridConfig + CSProjConfig = GetTestConfig (TestType.Hybrid, useProjectTags) }; string buildResults = TI.TestUnifiedExecutable (test).BuildOutput; @@ -78,12 +100,13 @@ public void HybridAOT_WithManualStrippingOfAllLibs_SmokeTest () }); } - [Test] - public void HybridAOT_WithManualStrippingOfJustMainExe () + [TestCase (false)] + [TestCase (true)] + public void HybridAOT_WithManualStrippingOfJustMainExe (bool useProjectTags) { RunMMPTest (tmpDir => { TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) { - CSProjConfig = AOTTestHybridConfig + CSProjConfig = GetTestConfig (TestType.Hybrid, useProjectTags) }; string buildResults = TI.TestUnifiedExecutable (test).BuildOutput;