diff --git a/Make.config b/Make.config index c379d2c841..b5f0608937 100644 --- a/Make.config +++ b/Make.config @@ -20,19 +20,7 @@ NUGET_VERSION_STABLE_COMMIT_DISTANCE_START=0 -include $(TOP)/Make.config.inc $(TOP)/Make.config.inc: $(TOP)/Make.config $(TOP)/mk/mono.mk - @rm -f $@ - @printf "IOS_COMMIT_DISTANCE:=$(shell LANG=C; export LANG && git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep IOS_PACKAGE_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@ - @printf "MAC_COMMIT_DISTANCE:=$(shell LANG=C; export LANG && git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MAC_PACKAGE_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed 's/ //g')\n" >> $@ - @# - @printf "IOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep IOS_NUGET_OS_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @printf "TVOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep TVOS_NUGET_OS_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @printf "WATCHOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep WATCHOS_NUGET_OS_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @printf "MACOS_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MACOS_NUGET_OS_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @printf "MACCATALYST_NUGET_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -- ./Make.versions HEAD | grep MACCATALYST_NUGET_OS_VERSION= | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @printf "NUGET_STABLE_COMMIT_DISTANCE:=$(shell LANG=C; export LANG; git --git-dir $(TOP)/.git log `git --git-dir $(TOP)/.git blame -L '/^[#[:blank:]]*NUGET_RELEASE_BRANCH=/,+1' -- ./Make.config HEAD | sed 's/ .*//' `..HEAD --oneline | wc -l | sed -e 's/ //g' -e "s/^/$(NUGET_VERSION_STABLE_COMMIT_DISTANCE_START)+/" | bc)\\n" >> $@ - @# - @if which ccache > /dev/null 2>&1; then printf "ENABLE_CCACHE=1\nexport CCACHE_BASEDIR=$(abspath $(TOP)/..)\n" >> $@; echo "Found ccache on the system, enabling it"; fi - @if test -d $(TOP)/../maccore; then printf "ENABLE_XAMARIN=1\n" >> $@; echo "Detected the maccore repository, automatically enabled the Xamarin build"; fi + $(Q) cd $(TOP) && ALL_DOTNET_PLATFORMS="$(ALL_DOTNET_PLATFORMS)" ./create-make-config.sh include $(TOP)/Make.versions diff --git a/create-make-config.sh b/create-make-config.sh new file mode 100755 index 0000000000..940b9fcf58 --- /dev/null +++ b/create-make-config.sh @@ -0,0 +1,49 @@ +#!/bin/bash -eu + +set -o pipefail +IFS=$'\n\t ' + +OUTPUT=Make.config.inc +OUTPUT_FILE=Make.config.inc.tmp + +rm -f "$OUTPUT_FILE" "$OUTPUT" + +LANG=C +export LANG + +# Support for hardcoding a commit distance start offset. +NUGET_VERSION_COMMIT_DISTANCE_START=0 +NUGET_VERSION_STABLE_COMMIT_DISTANCE_START=0 + +# Compute commit distances +printf "IOS_COMMIT_DISTANCE:=$(git log $(git blame -- ./Make.versions HEAD | grep IOS_PACKAGE_VERSION= | sed 's/ .*//' )..HEAD --oneline | wc -l | sed 's/ //g')\n" >> "$OUTPUT_FILE" +printf "MAC_COMMIT_DISTANCE:=$(git log $(git blame -- ./Make.versions HEAD | grep MAC_PACKAGE_VERSION= | sed 's/ .*//' )..HEAD --oneline | wc -l | sed 's/ //g')\n" >> "$OUTPUT_FILE" + +for platform in $ALL_DOTNET_PLATFORMS; do + PLATFORM=$(echo "$platform" | tr '[:lower:]' '[:upper:]') + COMMIT=$(git blame -- ./Make.versions HEAD | grep "${PLATFORM}_NUGET_OS_VERSION=" | sed 's/ .*//') + COMMIT_DISTANCE=$(git log "$COMMIT..HEAD" --oneline | wc -l | sed -e 's/ //g') + TOTAL_DISTANCE=$((NUGET_VERSION_COMMIT_DISTANCE_START+COMMIT_DISTANCE)) + printf "${PLATFORM}_NUGET_COMMIT_DISTANCE:=$TOTAL_DISTANCE\\n" >> "$OUTPUT_FILE" +done + +STABLE_COMMIT=$(git blame -L '/^[#[:blank:]]*NUGET_RELEASE_BRANCH=/,+1' -- ./Make.config HEAD | sed 's/ .*//') +STABLE_COMMIT_DISTANCE=$(git log "$STABLE_COMMIT..HEAD" --oneline | wc -l | sed -e 's/ //g') +STABLE_TOTAL_DISTANCE=$((STABLE_COMMIT_DISTANCE+NUGET_VERSION_STABLE_COMMIT_DISTANCE_START)) + +printf "NUGET_STABLE_COMMIT_DISTANCE:=$STABLE_TOTAL_DISTANCE\\n" >> "$OUTPUT_FILE" + +# Detect ccache +if which ccache > /dev/null 2>&1; then + printf "ENABLE_CCACHE=1\n" >> "$OUTPUT_FILE" + printf "export CCACHE_BASEDIR=$(cd .. && pwd)\n" >> "$OUTPUT_FILE" + echo "Found ccache on the system, enabling it" +fi + +# Detect maccore / xamarin +if test -d ../maccore; then + printf "ENABLE_XAMARIN=1\n" >> "$OUTPUT_FILE" + echo "Detected the maccore repository, automatically enabled the Xamarin build" +fi + +mv "$OUTPUT_FILE" "$OUTPUT" diff --git a/tests/api-shared/CoreFoundation/CFNotificationCenterTest.cs b/tests/api-shared/CoreFoundation/CFNotificationCenterTest.cs index 02770371ed..c30243bb0a 100644 --- a/tests/api-shared/CoreFoundation/CFNotificationCenterTest.cs +++ b/tests/api-shared/CoreFoundation/CFNotificationCenterTest.cs @@ -8,6 +8,7 @@ // using System; +using System.Threading; using Foundation; using CoreFoundation; @@ -77,16 +78,19 @@ namespace MonoTouchFixtures.CoreFoundation { public void TestNullNameAndObserver () { var d = CFNotificationCenter.Local; - bool mornNotification = false; + var mornNotification = new ManualResetEvent (false); - var token = d.AddObserver (null, null, (n, i) => mornNotification = n == "MornNotification"); + var token = d.AddObserver (null, null, (n, i) => { + if (n == "MornNotification") + mornNotification.Set (); + }); // When not listening for a specific name nor observing an specific object // we will get all notifications posted to NSNotificationCenter/Local CFNotificationCenter NSNotificationCenter.DefaultCenter.PostNotificationName ("MornNotification", null); d.RemoveObserver (token); - Assert.IsTrue (mornNotification); + Assert.IsTrue (mornNotification.WaitOne (TimeSpan.FromSeconds (10)), "Didn't get a notification after waiting 10 seconds."); } [Test] diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs index a9f31498ec..72a9937969 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/FrameworkListTest.cs @@ -8,11 +8,9 @@ using NUnit.Framework; using Xamarin.Tests; using System.Linq; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class FrameworkListTests - { + public class FrameworkListTests { [TestCase ("Xamarin.iOS-FrameworkList.xml.in")] [TestCase ("Xamarin.TVOS-FrameworkList.xml.in")] [TestCase ("Xamarin.WatchOS-FrameworkList.xml.in")] @@ -23,7 +21,7 @@ namespace Xamarin.MacDev.Tasks Configuration.AssertLegacyXamarinAvailable (); var fameworkListFileParts = frameworkListFile.Split ('-'); - string frameworkName = fameworkListFileParts[0]; + string frameworkName = fameworkListFileParts [0]; switch (frameworkName) { case "Xamarin.iOS": if (!Configuration.include_ios) @@ -43,7 +41,7 @@ namespace Xamarin.MacDev.Tasks break; } var isMac = frameworkName == "Xamarin.Mac"; - var isFull = fameworkListFileParts[1] == "Full"; + var isFull = fameworkListFileParts [1] == "Full"; var frameworkListAssemblies = ScanFrameworkListXml (frameworkListFile, isMac); var installedAssemblies = ScanAssemblyDirectory (frameworkName, isMac, isFull); @@ -149,8 +147,7 @@ namespace Xamarin.MacDev.Tasks } } - class AssemblyInfo - { + class AssemblyInfo { public string Name; public string Version; @@ -181,7 +178,8 @@ namespace Xamarin.MacDev.Tasks PublicKeyToken = fn.Substring (i, j - i); } - public bool Equals (AssemblyInfo other) { + public bool Equals (AssemblyInfo other) + { // ignore Culture and InGac for equality since those are not mentioned in the FrameworkList.xml return other.Name == this.Name && other.Version == this.Version && diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/BTouchTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/BTouchTaskTest.cs index b702ccf655..28eb438fdc 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/BTouchTaskTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/BTouchTaskTest.cs @@ -7,10 +7,8 @@ using NUnit.Framework; using Xamarin.iOS.Tasks; -namespace Xamarin.MacDev.Tasks -{ - class CustomBTouchTask : BTouch - { +namespace Xamarin.MacDev.Tasks { + class CustomBTouchTask : BTouch { public string GetCommandLineCommands () { return base.GenerateCommandLineCommands (); @@ -18,15 +16,14 @@ namespace Xamarin.MacDev.Tasks } [TestFixture] - public class BTouchTaskTests : TestBase - { + public class BTouchTaskTests : TestBase { [Test] public void StandardCommandline () { var task = CreateTask (); - task.ApiDefinitions = new[] { new TaskItem ("apidefinition.cs") }; - task.References = new[] { new TaskItem ("a.dll"), new TaskItem ("b.dll"), new TaskItem ("c.dll") }; + task.ApiDefinitions = new [] { new TaskItem ("apidefinition.cs") }; + task.References = new [] { new TaskItem ("a.dll"), new TaskItem ("b.dll"), new TaskItem ("c.dll") }; task.ResponseFilePath = Path.Combine (Cache.CreateTemporaryDirectory (), "response-file.txt"); var args = task.GetCommandLineCommands () + " " + File.ReadAllText (task.ResponseFilePath); @@ -40,8 +37,8 @@ namespace Xamarin.MacDev.Tasks { var task = CreateTask (); - task.ApiDefinitions = new[] { new TaskItem ("apidefinition.cs") }; - task.References = new[] { new TaskItem ("a.dll"), new TaskItem ("b.dll"), new TaskItem ("c.dll") }; + task.ApiDefinitions = new [] { new TaskItem ("apidefinition.cs") }; + task.References = new [] { new TaskItem ("a.dll"), new TaskItem ("b.dll"), new TaskItem ("c.dll") }; task.ProjectDir = "~/"; // not important, but required (so can't be null) task.ResponseFilePath = Path.Combine (Cache.CreateTemporaryDirectory (), "response-file.txt"); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs index 88767eae0d..5c40a75459 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CompileEntitlementsTaskTests.cs @@ -10,10 +10,8 @@ using Xamarin.MacDev; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - class CustomCompileEntitlements : CompileEntitlements - { +namespace Xamarin.MacDev.Tasks { + class CustomCompileEntitlements : CompileEntitlements { protected override MobileProvision? GetMobileProvision (MobileProvisionPlatform platform, string uuid) { if (File.Exists (ProvisioningProfile)) @@ -24,8 +22,7 @@ namespace Xamarin.MacDev.Tasks } [TestFixture] - public class CompileEntitlementsTaskTests : TestBase - { + public class CompileEntitlementsTaskTests : TestBase { CustomCompileEntitlements CreateEntitlementsTask (out string compiledEntitlements) { var task = CreateTask (); @@ -73,7 +70,7 @@ namespace Xamarin.MacDev.Tasks if (value is not null) dict ["Value"] = value; - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.xamarin.custom.entitlement", dict) }; var task = CreateEntitlementsTask (out var compiledEntitlements); @@ -93,7 +90,7 @@ namespace Xamarin.MacDev.Tasks { "Type", "String" }, { "Value", value }, }; - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.xamarin.custom.entitlement", dict) }; var task = CreateEntitlementsTask (out var compiledEntitlements); @@ -134,14 +131,14 @@ namespace Xamarin.MacDev.Tasks { "Value", $"A;B;C{separator}D{separator}E" }, { "ArraySeparator", separator }, }; - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.xamarin.custom.entitlement", dict) }; - var task = CreateEntitlementsTask(out var compiledEntitlements); + var task = CreateEntitlementsTask (out var compiledEntitlements); task.TargetFrameworkMoniker = ".NETCoreApp,Version=v6.0,Profile=maccatalyst"; task.CustomEntitlements = customEntitlements; - ExecuteTask(task); - var compiled = PDictionary.FromFile(compiledEntitlements); + ExecuteTask (task); + var compiled = PDictionary.FromFile (compiledEntitlements); var array = compiled.GetArray ("com.xamarin.custom.entitlement"); Assert.NotNull (array, "array"); Assert.AreEqual (new string [] { "A;B;C", "D", "E" }, array.ToStringArray (), "array contents"); @@ -160,28 +157,28 @@ namespace Xamarin.MacDev.Tasks [Test] public void AllowJit_True () { - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.apple.security.cs.allow-jit", new Dictionary { { "Type", "Boolean" }, { "Value", "true" } }), }; var task = CreateEntitlementsTask (out var compiledEntitlements); task.TargetFrameworkMoniker = ".NETCoreApp,Version=v6.0,Profile=maccatalyst"; task.CustomEntitlements = customEntitlements; ExecuteTask (task); - var compiled = PDictionary.FromFile(compiledEntitlements); + var compiled = PDictionary.FromFile (compiledEntitlements); Assert.IsTrue (compiled.ContainsKey (EntitlementKeys.AllowExecutionOfJitCode), "#1"); - Assert.IsTrue (compiled.Get(EntitlementKeys.AllowExecutionOfJitCode).Value, "#2"); + Assert.IsTrue (compiled.Get (EntitlementKeys.AllowExecutionOfJitCode).Value, "#2"); } [Test] public void AllowJit_False () { - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.apple.security.cs.allow-jit", new Dictionary { { "Type", "Boolean" }, { "Value", "false" } }), }; - var task = CreateEntitlementsTask(out var compiledEntitlements); + var task = CreateEntitlementsTask (out var compiledEntitlements); task.TargetFrameworkMoniker = ".NETCoreApp,Version=v6.0,Profile=maccatalyst"; task.CustomEntitlements = customEntitlements; - ExecuteTask(task); + ExecuteTask (task); var compiled = PDictionary.FromFile (compiledEntitlements); Assert.IsTrue (compiled.ContainsKey (EntitlementKeys.AllowExecutionOfJitCode), "#1"); Assert.IsFalse (compiled.Get (EntitlementKeys.AllowExecutionOfJitCode).Value, "#2"); @@ -190,14 +187,14 @@ namespace Xamarin.MacDev.Tasks [Test] public void AllowJit_None () { - var customEntitlements = new TaskItem[] { + var customEntitlements = new TaskItem [] { new TaskItem ("com.apple.security.cs.allow-jit", new Dictionary { { "Type", "Remove" } }), }; - var task = CreateEntitlementsTask(out var compiledEntitlements); + var task = CreateEntitlementsTask (out var compiledEntitlements); task.TargetFrameworkMoniker = ".NETCoreApp,Version=v6.0,Profile=maccatalyst"; task.CustomEntitlements = customEntitlements; - ExecuteTask(task); - var compiled = PDictionary.FromFile(compiledEntitlements); + ExecuteTask (task); + var compiled = PDictionary.FromFile (compiledEntitlements); Assert.IsFalse (compiled.ContainsKey (EntitlementKeys.AllowExecutionOfJitCode), "#1"); } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs index 8a9324f67f..9f2ba5e36d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ComputeCodesignItemsTaskTests.cs @@ -510,7 +510,7 @@ namespace Xamarin.MacDev.Tasks { Environment.CurrentDirectory = currentDir; } } - void VerifyCodesigningResults (CodesignInfo [] infos, ITaskItem[] outputCodesignItems, ApplePlatform platform) + void VerifyCodesigningResults (CodesignInfo [] infos, ITaskItem [] outputCodesignItems, ApplePlatform platform) { Assert.That (outputCodesignItems.Select (v => v.ItemSpec), Is.Unique, "Uniqueness"); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs index 436422c185..001129ce78 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/CreateBindingResourceTaskTests.cs @@ -150,7 +150,7 @@ namespace Xamarin.MacDev.Tasks { Assert.AreEqual (manifest, File.ReadAllText (Path.Combine (directory, "manifest")), "Manifest"); } - ITaskItem[] CreateNativeReferences (string tmpdir, bool symlinks) + ITaskItem [] CreateNativeReferences (string tmpdir, bool symlinks) { var rv = new List (); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSdkLocationsTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSdkLocationsTaskTests.cs index ecda61a4b6..cdf95684df 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSdkLocationsTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSdkLocationsTaskTests.cs @@ -7,11 +7,9 @@ using Xamarin.iOS.Tasks; using Xamarin.Tests; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class DetectSdkLocationsTaskTests : TestBase - { + public class DetectSdkLocationsTaskTests : TestBase { [Test] public void InvalidXamarinSdkRoot () { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSigningIdentityTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSigningIdentityTaskTests.cs index c2c1a6fc80..2273f2be8c 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSigningIdentityTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/DetectSigningIdentityTaskTests.cs @@ -76,8 +76,7 @@ namespace Xamarin.MacDev.Tasks { "; - public class EntitlementTestCase - { + public class EntitlementTestCase { public string Name = string.Empty; public string Entitlements = string.Empty; public bool Required; @@ -90,9 +89,9 @@ namespace Xamarin.MacDev.Tasks { } } - static EntitlementTestCase[] GetEntitlementsTestCases () + static EntitlementTestCase [] GetEntitlementsTestCases () { - return new EntitlementTestCase[] + return new EntitlementTestCase [] { new EntitlementTestCase { Name = nameof (EmptyEntitlements1), Entitlements = EmptyEntitlements1, Required = false, IsSimulator = true }, new EntitlementTestCase { Name = nameof (EmptyEntitlements2), Entitlements = EmptyEntitlements2, Required = false, IsSimulator = true }, diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs index b6f983390a..609008bc53 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs @@ -11,11 +11,9 @@ using Xamarin.MacDev.Tasks; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public abstract class GeneratePlistTaskTests_Core : TestBase - { + public abstract class GeneratePlistTaskTests_Core : TestBase { protected const string appBundleName = "BundleName"; protected const string assemblyName = "AssemblyName"; protected const string bundleIdentifier = "DefaultIdentifier"; diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS.cs index 4912f652c7..39b860b7ca 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS.cs @@ -5,12 +5,10 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public class GeneratePlistTaskTests_iOS : GeneratePlistTaskTests_Core - { + public class GeneratePlistTaskTests_iOS : GeneratePlistTaskTests_Core { protected override ApplePlatform Platform => ApplePlatform.iOS; public GeneratePlistTaskTests_iOS (bool isDotNet) diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS_AppExtension.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS_AppExtension.cs index 780ba7a178..7e35d4fdea 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS_AppExtension.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_iOS_AppExtension.cs @@ -1,12 +1,10 @@ using NUnit.Framework; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public class GeneratePlistTaskTests_iOS_AppExtension : GeneratePlistTaskTests_iOS - { + public class GeneratePlistTaskTests_iOS_AppExtension : GeneratePlistTaskTests_iOS { public GeneratePlistTaskTests_iOS_AppExtension (bool isDotNet) : base (isDotNet) { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_tvOS.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_tvOS.cs index 58f946effb..620eac5639 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_tvOS.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_tvOS.cs @@ -4,12 +4,10 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public class GeneratePlistTaskTests_tvOS : GeneratePlistTaskTests_Core - { + public class GeneratePlistTaskTests_tvOS : GeneratePlistTaskTests_Core { protected override ApplePlatform Platform => ApplePlatform.TVOS; public GeneratePlistTaskTests_tvOS (bool isDotNet) @@ -23,7 +21,7 @@ namespace Xamarin.MacDev.Tasks base.ConfigureTask (isDotNet); Task.DefaultSdkVersion = Sdks.TVOS.GetClosestInstalledSdk (AppleSdkVersion.V9_0, true).ToString (); - Task.TargetFrameworkMoniker = isDotNet ? TargetFramework.DotNet_tvOS_String : TargetFramework.Xamarin_TVOS_1_0.ToString (); + Task.TargetFrameworkMoniker = isDotNet ? TargetFramework.DotNet_tvOS_String : TargetFramework.Xamarin_TVOS_1_0.ToString (); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS.cs index 3ff3c882b6..07e9b19ec5 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS.cs @@ -4,12 +4,10 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public abstract class GeneratePlistTaskTests_watchOS: GeneratePlistTaskTests_Core - { + public abstract class GeneratePlistTaskTests_watchOS : GeneratePlistTaskTests_Core { protected override ApplePlatform Platform => ApplePlatform.WatchOS; public GeneratePlistTaskTests_watchOS (bool isDotNet) diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs index 31277bf360..fa183b3df0 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitApp.cs @@ -1,11 +1,9 @@ using NUnit.Framework; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public class GeneratePlistTaskTests_watchOS_WatchKitApp : GeneratePlistTaskTests_watchOS - { + public class GeneratePlistTaskTests_watchOS_WatchKitApp : GeneratePlistTaskTests_watchOS { public GeneratePlistTaskTests_watchOS_WatchKitApp (bool isDotNet) : base (isDotNet) { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs index 995c2dc0dc..b5c580dff1 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_watchOS_WatchKitExtension.cs @@ -2,12 +2,10 @@ using System.Linq; using NUnit.Framework; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture (true)] [TestFixture (false)] - public class GeneratePlistTaskTests_watchOS_WatchKitExtension : GeneratePlistTaskTests_watchOS - { + public class GeneratePlistTaskTests_watchOS_WatchKitExtension : GeneratePlistTaskTests_watchOS { public GeneratePlistTaskTests_watchOS_WatchKitExtension (bool isDotNet) : base (isDotNet) { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetBundleNameTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetBundleNameTaskTests.cs index cd184bda93..b8fe5c790a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetBundleNameTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/GetBundleNameTaskTests.cs @@ -4,11 +4,9 @@ using NUnit.Framework; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class GetBundleNameTaskTests : TestBase - { + public class GetBundleNameTaskTests : TestBase { [Test] public void GetBundleName_MissingName () { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs index a90a5f3b48..f6a07a5d17 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/IBToolTaskTests.cs @@ -13,11 +13,9 @@ using Xamarin.MacDev.Tasks; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class IBToolTaskTests : TestBase - { + public class IBToolTaskTests : TestBase { IBTool CreateIBToolTask (ApplePlatform framework, string projectDir, string intermediateOutputPath) { var interfaceDefinitions = new List (); @@ -158,7 +156,7 @@ namespace Xamarin.MacDev.Tasks Assert.That (unexpectedResource, Is.Empty, "No extra resources"); } - IBTool CreateIBToolTask (ApplePlatform framework, string projectDir, string intermediateOutputPath, params string[] fileNames) + IBTool CreateIBToolTask (ApplePlatform framework, string projectDir, string intermediateOutputPath, params string [] fileNames) { var ibtool = CreateIBToolTask (framework, projectDir, intermediateOutputPath); var interfaceDefinitions = new List (); @@ -171,7 +169,7 @@ namespace Xamarin.MacDev.Tasks return ibtool; } - void TestGenericAndDeviceSpecificXibsGeneric (params string[] fileNames) + void TestGenericAndDeviceSpecificXibsGeneric (params string [] fileNames) { var tmp = Cache.CreateTemporaryDirectory ("advanced-ibtool"); IBTool ibtool; diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs index 86c3e7cec5..6fc32cf720 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs @@ -44,8 +44,8 @@ namespace Xamarin.MacDev.Tasks { Assert.IsFalse (task.Execute (), "Execute failure"); Assert.AreEqual (1, Engine.Logger.ErrorEvents.Count, "ErrorCount"); - bool isTranslated = Engine.Logger.ErrorEvents[0].Message.Contains (errorMessage); - Assert.IsTrue (isTranslated, $"Should contain \"{errorMessage}\", but instead has value: \"{Engine.Logger.ErrorEvents[0].Message}\""); + bool isTranslated = Engine.Logger.ErrorEvents [0].Message.Contains (errorMessage); + Assert.IsTrue (isTranslated, $"Should contain \"{errorMessage}\", but instead has value: \"{Engine.Logger.ErrorEvents [0].Message}\""); } finally { Thread.CurrentThread.CurrentUICulture = originalUICulture; Thread.CurrentThread.CurrentCulture = originalCulture; @@ -78,7 +78,7 @@ namespace Xamarin.MacDev.Tasks { string newCultureError = TranslateError (culture, errorCode); Assert.AreNotEqual (englishError, newCultureError, $"\"{errorCode}\" is not translated in {culture}."); - } catch (NullReferenceException){ + } catch (NullReferenceException) { Assert.Fail ($"Error code \"{errorCode}\" was not found"); } finally { Thread.CurrentThread.CurrentUICulture = originalUICulture; diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs index ac63145625..6d789bbd66 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MTouchTaskTests.cs @@ -10,10 +10,8 @@ using NUnit.Framework; using Xamarin.iOS.Tasks; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ - class CustomMTouchTask : MTouch - { +namespace Xamarin.MacDev.Tasks { + class CustomMTouchTask : MTouch { public CustomMTouchTask () { Architectures = "Default"; @@ -26,7 +24,7 @@ namespace Xamarin.MacDev.Tasks SdkIsSimulator = true; UseLlvm = false; UseThumb = false; - AppExtensionReferences = new Microsoft.Build.Framework.ITaskItem[] { }; + AppExtensionReferences = new Microsoft.Build.Framework.ITaskItem [] { }; } public string ResponseFile = ""; @@ -47,8 +45,7 @@ namespace Xamarin.MacDev.Tasks } [TestFixture] - public class MTouchTaskTests : TestBase - { + public class MTouchTaskTests : TestBase { CustomMTouchTask Task { get; set; } @@ -141,7 +138,7 @@ namespace Xamarin.MacDev.Tasks [Test] public void StandardCommandline_WithBitcodeEnabled_iOS () { - MTouchEnableBitcode("Xamarin.iOS"); + MTouchEnableBitcode ("Xamarin.iOS"); var ex = Assert.Throws (() => Task.GenerateCommandLineCommands (), "Exception"); Assert.AreEqual ("Bitcode is currently not supported on iOS.", ex.Message, "Message"); @@ -150,7 +147,7 @@ namespace Xamarin.MacDev.Tasks [Test] public void StandardCommandline_WithBitcodeEnabled_watchOS () { - MTouchEnableBitcode("Xamarin.WatchOS"); + MTouchEnableBitcode ("Xamarin.WatchOS"); var args = Task.GenerateCommandLineCommands (); Assert.IsTrue (Task.ResponseFile.Contains ("--bitcode=full")); @@ -159,7 +156,7 @@ namespace Xamarin.MacDev.Tasks [Test] public void StandardCommandline_WithBitcodeEnabled_tvOS () { - MTouchEnableBitcode("Xamarin.TVOS"); + MTouchEnableBitcode ("Xamarin.TVOS"); var args = Task.GenerateCommandLineCommands (); Assert.IsTrue (Task.ResponseFile.Contains ("--bitcode=asmonly")); @@ -211,14 +208,14 @@ namespace Xamarin.MacDev.Tasks } [Test] - public void ReferenceFrameworkFileResolution_WhenReceivedReferencePathExists() + public void ReferenceFrameworkFileResolution_WhenReceivedReferencePathExists () { - using (var sdk = new TempSdk()) { + using (var sdk = new TempSdk ()) { Task.TargetFrameworkMoniker = "MonoTouch,v1.0"; var expectedPath = Path.Combine (Cache.CreateTemporaryDirectory (), "tmpfile"); - Task.References = new[] { new TaskItem (expectedPath, new Dictionary { { "FrameworkFile", "true" } }) }; + Task.References = new [] { new TaskItem (expectedPath, new Dictionary { { "FrameworkFile", "true" } }) }; var args = Task.GenerateCommandLineCommands (); @@ -237,16 +234,16 @@ namespace Xamarin.MacDev.Tasks Assert.IsTrue (args.Contains ($"@{Task.ResponseFilePath}"), "#@response-file"); } - [TestCase("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenFacadeFileExists(string targetFrameworkMoniker, string frameworkDir) + [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] + public void ReferenceFrameworkFileResolution_WhenFacadeFileExists (string targetFrameworkMoniker, string frameworkDir) { - using (var sdk = new TempSdk()) { + using (var sdk = new TempSdk ()) { Task.TargetFrameworkMoniker = targetFrameworkMoniker; var expectedPath = Path.Combine (Sdks.XamIOS.LibDir, "mono", frameworkDir, "Facades", "System.Collections.dll"); Directory.CreateDirectory (Path.GetDirectoryName (expectedPath)); File.WriteAllText (expectedPath, ""); - Task.References = new[] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; + Task.References = new [] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; var args = Task.GenerateCommandLineCommands (); @@ -254,7 +251,7 @@ namespace Xamarin.MacDev.Tasks // In Windows, the path slashes are escaped. expectedPath = expectedPath.Replace ("\\", "\\\\"); - Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format( + Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format ( @"Failed to resolve facade assembly to the Sdk path. Expected path:{0} @@ -262,16 +259,16 @@ namespace Xamarin.MacDev.Tasks } } - [TestCase("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenFrameworkFileExists(string targetFrameworkMoniker, string frameworkDir) + [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] + public void ReferenceFrameworkFileResolution_WhenFrameworkFileExists (string targetFrameworkMoniker, string frameworkDir) { - using (var sdk = new TempSdk()) { + using (var sdk = new TempSdk ()) { Task.TargetFrameworkMoniker = targetFrameworkMoniker; var expectedPath = Path.Combine (Sdks.XamIOS.LibDir, "mono", frameworkDir, "System.Collections.dll"); Directory.CreateDirectory (Path.GetDirectoryName (expectedPath)); File.WriteAllText (expectedPath, ""); - Task.References = new[] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; + Task.References = new [] { new TaskItem ("System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; var args = Task.GenerateCommandLineCommands (); @@ -279,7 +276,7 @@ namespace Xamarin.MacDev.Tasks // In Windows, the path slashes are escaped. expectedPath = expectedPath.Replace ("\\", "\\\\"); - Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format( + Assert.IsTrue (Task.ResponseFile.Contains (expectedPath), string.Format ( @"Failed to resolve facade assembly to the Sdk path. Expected path:{0} @@ -287,13 +284,13 @@ namespace Xamarin.MacDev.Tasks } } - [TestCase("Xamarin.iOS,v1.0", "Xamarin.iOS")] - public void ReferenceFrameworkFileResolution_WhenResolutionFails(string targetFrameworkMoniker, string frameworkDir) + [TestCase ("Xamarin.iOS,v1.0", "Xamarin.iOS")] + public void ReferenceFrameworkFileResolution_WhenResolutionFails (string targetFrameworkMoniker, string frameworkDir) { - using (var sdk = new TempSdk()) { + using (var sdk = new TempSdk ()) { Task.TargetFrameworkMoniker = targetFrameworkMoniker; - Task.References = new[] { new TaskItem ("/usr/foo/System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; + Task.References = new [] { new TaskItem ("/usr/foo/System.Collections.dll", new Dictionary { { "FrameworkFile", "true" } }) }; var args = Task.GenerateCommandLineCommands (); @@ -349,8 +346,7 @@ namespace Xamarin.MacDev.Tasks Assert.That (items.Count (), Is.EqualTo (3), "framework files"); } - class TempSdk : IDisposable - { + class TempSdk : IDisposable { MonoTouchSdk sdk; public TempSdk () diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs index 8b1329543d..7d77abaeb9 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/MergeAppBundleTaskTest.cs @@ -27,7 +27,7 @@ namespace Xamarin.MacDev.Tasks { RunMake (Path.Combine (Configuration.RootPath, "tests", "common", "TestProjects", "ComplexAssembly"), environment: env); } - static void RunMake (string directory, Dictionary environment = null) + static void RunMake (string directory, Dictionary environment = null) { var arguments = new List { "-C", @@ -51,7 +51,7 @@ namespace Xamarin.MacDev.Tasks { } } - MergeAppBundles CreateTask (string outputBundle, params string[] inputBundles) + MergeAppBundles CreateTask (string outputBundle, params string [] inputBundles) { var inputItems = new List (); for (var i = 0; i < inputBundles.Length; i++) { @@ -66,7 +66,7 @@ namespace Xamarin.MacDev.Tasks { } // Create two app bundles, one with fileA, and one with fileB, in the root directory - string[] CreateAppBundles (string fileA, string fileB, string fileName = null) + string [] CreateAppBundles (string fileA, string fileB, string fileName = null) { var appBundleA = Path.Combine (Cache.CreateTemporaryDirectory (), "MergeMe.app"); var appBundleB = Path.Combine (Cache.CreateTemporaryDirectory (), "MergeMe.app"); @@ -77,7 +77,7 @@ namespace Xamarin.MacDev.Tasks { return new string [] { appBundleA, appBundleB }; } - string CreateAppBundle (string directory, params string[] files) + string CreateAppBundle (string directory, params string [] files) { var appBundle = Path.Combine (Cache.CreateTemporaryDirectory (), "MergeMe.app"); Directory.CreateDirectory (appBundle); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ParseBundlerArgumentsTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ParseBundlerArgumentsTests.cs index 907693e23a..7c74bb6b6f 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ParseBundlerArgumentsTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ParseBundlerArgumentsTests.cs @@ -6,12 +6,10 @@ using NUnit.Framework; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class ParseBundlerArgumentsTests : TestBase - { - class CustomParseBundlerArguments : ParseBundlerArgumentsTaskBase {} + public class ParseBundlerArgumentsTests : TestBase { + class CustomParseBundlerArguments : ParseBundlerArgumentsTaskBase { } [Test] public void NoExtraArgs () diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/PropertyListEditorTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/PropertyListEditorTaskTests.cs index 7090a9f45d..49f0cf65a0 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/PropertyListEditorTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/PropertyListEditorTaskTests.cs @@ -5,18 +5,16 @@ using NUnit.Framework; using Xamarin.MacDev; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class PropertyListEditorTaskTests : TestBase - { + public class PropertyListEditorTaskTests : TestBase { static void CheckArray (PArray array, PArray expected) { Assert.AreEqual (expected.Count, array.Count, "Unexpected number of array elements"); for (int i = 0; i < expected.Count; i++) { - Assert.AreEqual (expected[i].Type, array[i].Type, "Type-mismatch for array element {0}", i); - CheckValue (array[i], expected[i]); + Assert.AreEqual (expected [i].Type, array [i].Type, "Type-mismatch for array element {0}", i); + CheckValue (array [i], expected [i]); } } @@ -215,7 +213,7 @@ namespace Xamarin.MacDev.Tasks files.Add ("icon2"); var expected = (PDictionary) plist.Clone (); - files[0] = new PString ("icon"); + files [0] = new PString ("icon"); TestExecuteTask (plist, PropertyListEditorAction.Set, ":CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles:0", "string", "icon0", expected); @@ -239,7 +237,7 @@ namespace Xamarin.MacDev.Tasks TestExecuteTask (plist, PropertyListEditorAction.Clear, null, "integer", null, new PNumber (0)); TestExecuteTask (plist, PropertyListEditorAction.Clear, null, "real", null, new PReal (0)); TestExecuteTask (plist, PropertyListEditorAction.Clear, null, "string", null, new PString (string.Empty)); - TestExecuteTask (plist, PropertyListEditorAction.Clear, null, "data", null, new PData (new byte[0])); + TestExecuteTask (plist, PropertyListEditorAction.Clear, null, "data", null, new PData (new byte [0])); } [Test] diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ReadAppManifestTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ReadAppManifestTaskTests.cs index 8bdf1d6b78..c9d8ffa5bf 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ReadAppManifestTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ReadAppManifestTaskTests.cs @@ -12,7 +12,7 @@ using Xamarin.Utils; namespace Xamarin.MacDev.Tasks { [TestFixture] public class ReadAppManifestTaskTests : TestBase { - ReadAppManifest CreateTask (ApplePlatform platform = ApplePlatform.iOS, Action? createDictionary = null) + ReadAppManifest CreateTask (ApplePlatform platform = ApplePlatform.iOS, Action? createDictionary = null) { var tmpdir = Cache.CreateTemporaryDirectory (); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs index 339e6b1b4e..0c6c2390df 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ResolveNativeReferencesTaskTest.cs @@ -17,11 +17,11 @@ namespace Xamarin.MacDev.Tasks.Tests { [TestCase ("watchOS", null, "arm64_32", "watchos-arm64_32_armv7k/Universal.framework/Universal")] [TestCase ("watchOS", "simulator", "x86_64", "watchos-arm64_x86_64-simulator/Universal.framework/Universal")] // subset [TestCase ("macOS", null, "x86_64", "macos-arm64_x86_64/Universal.framework/Universal")] // subset - // multiple arch request (all must be present) + // multiple arch request (all must be present) [TestCase ("macOS", null, "x86_64, arm64", "macos-arm64_x86_64/Universal.framework/Universal")] // failure to resolve requested architecture [TestCase ("iOS", "simulator", "i386, x86_64", "")] // i386 not available - // failure to resolve mismatched variant + // failure to resolve mismatched variant [TestCase ("macOS", "maccatalyst", "x86_64", "")] // maccatalyst not available on macOS (it's on iOS) public void Xcode12_x (string platform, string variant, string architecture, string expected) { diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs index c458b11f38..1417c28fbd 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/ToolTasksBinPathTest.cs @@ -55,7 +55,7 @@ namespace Xamarin.MacDev.Tasks { RedirectStandardOutput = true, RedirectStandardError = true, }; - psi.EnvironmentVariables ["DEVELOPER_DIR"] =Configuration.xcode_root; + psi.EnvironmentVariables ["DEVELOPER_DIR"] = Configuration.xcode_root; psi.EnvironmentVariables.Remove ("XCODE_DEVELOPER_DIR_PATH"); // VSfM sets XCODE_DEVELOPER_DIR_PATH, which confuses the command-line tools if it doesn't match xcode-select, so just unset it. var proc = Process.Start (psi); diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs index 6b2615b50a..bb131d1b7a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/Logger.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using Microsoft.Build.Framework; -namespace Xamarin.MacDev.Tasks -{ - public class Logger : ILogger - { +namespace Xamarin.MacDev.Tasks { + public class Logger : ILogger { public List CustomEvents { get; set; } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs index 100570f52b..a72706be2b 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs @@ -7,10 +7,8 @@ using NUnit.Framework; using Xamarin.Tests; -namespace Xamarin.MacDev.Tasks -{ - public abstract class TestBase - { +namespace Xamarin.MacDev.Tasks { + public abstract class TestBase { TestEngine engine; public TestEngine Engine { get { @@ -80,7 +78,7 @@ namespace Xamarin.MacDev.Tasks protected string CreateTempFile (string path) { path = Path.Combine (Cache.CreateTemporaryDirectory ("msbuild-tests"), path); - using (new FileStream (path, FileMode.CreateNew)) {} + using (new FileStream (path, FileMode.CreateNew)) { } return path; } } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestEngine.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestEngine.cs index 1fbcaebb75..13514f0ba9 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestEngine.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestEngine.cs @@ -6,11 +6,9 @@ using Microsoft.Build.Framework; using Microsoft.Build.Evaluation; using Microsoft.Build.Logging; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { - public class TestEngine : IBuildEngine, IBuildEngine2, IBuildEngine3, IBuildEngine4 - { + public class TestEngine : IBuildEngine, IBuildEngine2, IBuildEngine3, IBuildEngine4 { public Logger Logger { get; set; } @@ -61,7 +59,7 @@ namespace Xamarin.MacDev.Tasks get { return true; } } public int LineNumberOfTaskNode { - get {return 0;} + get { return 0; } } public string ProjectFileOfTaskNode { get { return ""; } diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/UtilityTests.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/UtilityTests.cs index 5a99716c14..f057607731 100644 --- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/UtilityTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/UtilityTests.cs @@ -10,11 +10,9 @@ using Xamarin.MacDev; using Xamarin.MacDev.Tasks; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class UtilityTests - { + public class UtilityTests { [Test] public void TestAbsoluteToRelativePath () { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/MSBuild-Smoke.cs b/tests/msbuild/Xamarin.MacDev.Tests/MSBuild-Smoke.cs index 764f11c3e8..69e946a70c 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/MSBuild-Smoke.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/MSBuild-Smoke.cs @@ -11,12 +11,10 @@ using Xamarin; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MMP.Tests -{ +namespace Xamarin.MMP.Tests { [TestFixture] - public partial class MMPTests - { - void RunMSBuildTest (Action test, string directory_name = null) + public partial class MMPTests { + void RunMSBuildTest (Action test, string directory_name = null) { test (Cache.CreateTemporaryDirectory (directory_name ?? "msbuild-tests")); } @@ -150,7 +148,7 @@ namespace Xamarin.MMP.Tests } [Test] - public void BuildUnifiedProject_WithJustNativeRefNoLinkWith_Builds() + public void BuildUnifiedProject_WithJustNativeRefNoLinkWith_Builds () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.MacOSX); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs index 2b4dac30a8..3799a4dc90 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/BindingProject.cs @@ -4,12 +4,10 @@ using System.IO; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class BindingProject : TestBase - { + public class BindingProject : TestBase { public BindingProject (string platform) : base (platform) { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs index 2b8dcc697a..f835432568 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Bug60536.cs @@ -10,11 +10,9 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class Bug60536 : ProjectTest - { + public class Bug60536 : ProjectTest { public Bug60536 () : base ("iPhoneSimulator", "Debug") { @@ -55,12 +53,12 @@ namespace Xamarin.MacDev.Tasks RunTarget (MonoTouchProject, "Build", expectedErrorCount: 1); 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"); - Assert.AreEqual (197, Engine.Logger.ErrorEvents[0].EndLineNumber, "EndLineNumber"); - Assert.AreEqual (4, Engine.Logger.ErrorEvents[0].EndColumnNumber, "EndColumnNumber"); - Assert.AreEqual ("']' is invalid without a matching open. LineNumber: 196 | BytePositionInLine: 3.", Engine.Logger.ErrorEvents[0].Message, "Message"); + 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"); + Assert.AreEqual (197, Engine.Logger.ErrorEvents [0].EndLineNumber, "EndLineNumber"); + Assert.AreEqual (4, Engine.Logger.ErrorEvents [0].EndColumnNumber, "EndColumnNumber"); + Assert.AreEqual ("']' is invalid without a matching open. LineNumber: 196 | BytePositionInLine: 3.", Engine.Logger.ErrorEvents [0].Message, "Message"); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs index 1c77d25c2b..0699ebb458 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CodesignAppBundle.cs @@ -11,15 +11,13 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone", "Debug")] [TestFixture ("iPhone", "Release")] // Note: Disabled because Simulator builds aren't consistently signed or not-signed, while device builds are. //[TestFixture ("iPhoneSimulator", "Debug")] //[TestFixture ("iPhoneSimulator", "Release")] - public class CodesignAppBundle : ProjectTest - { + public class CodesignAppBundle : ProjectTest { public CodesignAppBundle (string platform, string configuration) : base (platform, configuration) { @@ -93,7 +91,7 @@ namespace Xamarin.MacDev.Tasks if (Path.GetFileName (file) == "MyTabbedApplication" || Path.GetExtension (file) == ".dylib") continue; - Assert.AreEqual (timestamps[file], newTimestamps[file], "App Bundle timestamp changed: " + file); + Assert.AreEqual (timestamps [file], newTimestamps [file], "App Bundle timestamp changed: " + file); } if (Platform != "iPhoneSimulator") { @@ -103,9 +101,9 @@ namespace Xamarin.MacDev.Tasks foreach (var file in dsymTimestamps.Keys) { // The Info.plist should be newer because it gets touched if (Path.GetFileName (file) == "Info.plist") { - Assert.IsTrue (dsymTimestamps[file] < newDsymTimestamps[file], "App Bundle dSYMs Info.plist not touched: " + file); + Assert.IsTrue (dsymTimestamps [file] < newDsymTimestamps [file], "App Bundle dSYMs Info.plist not touched: " + file); } else { - Assert.AreEqual (dsymTimestamps[file], newDsymTimestamps[file], "App Bundle dSYMs changed: " + file); + Assert.AreEqual (dsymTimestamps [file], newDsymTimestamps [file], "App Bundle dSYMs changed: " + file); } } @@ -115,7 +113,7 @@ namespace Xamarin.MacDev.Tasks // Note: we could fix this by not using `ditto` and instead implementing this ourselves to only overwrite files if they've changed // and then setting some [Output] params that specify whether or not we need to re-codesign and/or strip debug symbols. foreach (var file in appexDsymTimestamps.Keys) - Assert.IsTrue (appexDsymTimestamps[file] < newAppexDsymTimestamps[file], "App Extension dSYMs should be newer: " + file); + Assert.IsTrue (appexDsymTimestamps [file] < newAppexDsymTimestamps [file], "App Extension dSYMs should be newer: " + file); } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs index 57c75c3764..de004acd7d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs @@ -10,12 +10,10 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { // [TestFixture ("iPhone")] // Skip this to speed things up a bit. [TestFixture ("iPhoneSimulator")] - public class CompileSceneKitAssetsTest : ProjectTest - { + public class CompileSceneKitAssetsTest : ProjectTest { public CompileSceneKitAssetsTest (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs index 5727742263..d649c37d88 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/CoreMLCompiler.cs @@ -9,19 +9,17 @@ using Xamarin.Utils; using NUnit.Framework; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class CoreMLCompiler : ProjectTest - { + public class CoreMLCompiler : ProjectTest { public CoreMLCompiler (string platform) : base (platform) { } void AssertCompiledModelExists (string modelName) { - var expected = new string[] { "coremldata.bin", "model.espresso.net", "model.espresso.shape", "model.espresso.weights", "model/coremldata.bin", "neural_network_optionals/coremldata.bin" }; + var expected = new string [] { "coremldata.bin", "model.espresso.net", "model.espresso.shape", "model.espresso.weights", "model/coremldata.bin", "neural_network_optionals/coremldata.bin" }; var mlmodelc = Path.Combine (AppBundlePath, modelName + ".mlmodelc"); Assert.IsTrue (Directory.Exists (mlmodelc)); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/EmbeddedExtension.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/EmbeddedExtension.cs index 1191d114d2..da2d8c884d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/EmbeddedExtension.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/EmbeddedExtension.cs @@ -25,7 +25,7 @@ namespace Xamarin.MacDev.Tasks { var proj = SetupProjectPaths ("NativeExtensionEmbedding/managed/ManagedContainer"); MonoTouchProject = proj; - var xcodeProjectFolder = Path.Combine (proj.ProjectPath , "..", "..", "native"); + var xcodeProjectFolder = Path.Combine (proj.ProjectPath, "..", "..", "native"); string [] xcodeBuildArgs = new [] { "-configuration", "Debug", "-target", "NativeTodayExtension", "-sdk", Platform == "iPhoneSimulator" ? "iphonesimulator" : "iphoneos" }; var env = new System.Collections.Generic.Dictionary { { "DEVELOPER_DIR", Configuration.XcodeLocation } }; Assert.AreEqual (0, ExecutionHelper.Execute ("/usr/bin/xcodebuild", xcodeBuildArgs.Concat (new [] { "clean" }).ToList (), xcodeProjectFolder, Console.WriteLine, Console.Error.WriteLine)); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs index d1efe8de40..4081692ca3 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/Action.cs @@ -6,9 +6,8 @@ using Xamarin.Utils; namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class ActionTests : ExtensionTestBase - { - public ActionTests (string platform) : base (platform) + public class ActionTests : ExtensionTestBase { + public ActionTests (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs index b9cabf70cd..b8aefdfff2 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/CustomKeyboard.cs @@ -9,16 +9,17 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] public class CustomKeyboardTests : ExtensionTestBase { - public CustomKeyboardTests(string platform) : base(platform) { - ExpectedAppFiles = new string [] { - "MainStoryboard_iPad.storyboardc", - "MainStoryboard_iPhone.storyboardc", + public CustomKeyboardTests (string platform) : base (platform) + { + ExpectedAppFiles = new string [] { + "MainStoryboard_iPad.storyboardc", + "MainStoryboard_iPhone.storyboardc", "default.metallib" }; } [Test] - public void BasicTest () + public void BasicTest () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs index 381582c706..ec7fe8b0fe 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/DocumentPicker.cs @@ -9,12 +9,12 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhoneSimulator")] public class DocumentPickerTests : ExtensionTestBase { - public DocumentPickerTests (string platform) : base(platform) + public DocumentPickerTests (string platform) : base (platform) { } [Test] - public void BasicTest () + public void BasicTest () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs index 2ec8aaf3f9..0aec0b1a0e 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/ExtensionTestBase.cs @@ -5,8 +5,7 @@ using NUnit.Framework; using Xamarin.Tests; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public class ExtensionTestBase : TestBase { public ExtensionTestBase () { } @@ -30,7 +29,7 @@ namespace Xamarin.MacDev.Tasks RunTarget (mtouchPaths, "Clean"); Assert.IsFalse (Directory.Exists (AppBundlePath), "App bundle exists after cleanup: {0} ", AppBundlePath); - + RunTarget (mtouchPaths, "Build", expectedErrorCount: expectedErrorCount); if (expectedErrorCount > 0) @@ -38,11 +37,11 @@ namespace Xamarin.MacDev.Tasks Assert.IsTrue (Directory.Exists (AppBundlePath), "App Bundle does not exist: {0} ", AppBundlePath); - TestPList (AppBundlePath, new string[] {"CFBundleExecutable", "CFBundleVersion"}); + TestPList (AppBundlePath, new string [] { "CFBundleExecutable", "CFBundleVersion" }); Assert.IsTrue (Directory.Exists (extensionPath), "Appex directory does not exist: {0} ", extensionPath); - TestPList (extensionPath, new string[] {"CFBundleExecutable", "CFBundleVersion"}); + TestPList (extensionPath, new string [] { "CFBundleExecutable", "CFBundleVersion" }); TestFilesExists (AppBundlePath, ExpectedAppFiles); TestFilesDoNotExist (AppBundlePath, UnexpectedAppFiles); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs index 30c8e59420..26a5f8e188 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit.cs @@ -8,18 +8,18 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhoneSimulator")] public class WatchKit : ExtensionTestBase { - public WatchKit (string platform) : base(platform) + public WatchKit (string platform) : base (platform) { } [Test] - public void BasicTest () + public void BasicTest () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); Configuration.AssertLegacyXamarinAvailable (); 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"); + 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 e146f67a30..4e0af66c6d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/Extensions/WatchKit2.cs @@ -11,12 +11,12 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhoneSimulator")] public class WatchKit2 : ExtensionTestBase { - public WatchKit2 (string platform) : base(platform) + public WatchKit2 (string platform) : base (platform) { } [Test] - public void BasicTest () + public void BasicTest () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.WatchOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs index b964b9f614..4727abc86d 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/IBToolLinking.cs @@ -3,12 +3,10 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class IBToolLinking : ProjectTest - { + public class IBToolLinking : ProjectTest { public IBToolLinking (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs index e7851edc8b..3e8a9a914c 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/LinkedAssets.cs @@ -5,13 +5,11 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class LinkedAssets : ProjectTest - { - static readonly string[] IconNames = { "AppIcon29x29.png", "AppIcon29x29@2x.png", "AppIcon40x40@2x.png", "AppIcon57x57.png", "AppIcon57x57@2x.png", "AppIcon60x60@2x.png" }; + public class LinkedAssets : ProjectTest { + static readonly string [] IconNames = { "AppIcon29x29.png", "AppIcon29x29@2x.png", "AppIcon40x40@2x.png", "AppIcon57x57.png", "AppIcon57x57@2x.png", "AppIcon60x60@2x.png" }; public LinkedAssets (string platform) : base (platform) { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferences.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferences.cs index 05c834eb67..8652811778 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferences.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferences.cs @@ -12,8 +12,8 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] public class NativeReferencesTests : ProjectTest { - - public NativeReferencesTests (string platform) : base (platform) + + public NativeReferencesTests (string platform) : base (platform) { } @@ -49,7 +49,7 @@ namespace Xamarin.MacDev.Tasks { { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET - + if (Platform.Contains ("Simulator")) return; // incremental builds on the simulator doesn't make much sense. diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferencesNoEmbedding.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferencesNoEmbedding.cs index 5d22ba037b..2f22ab304b 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferencesNoEmbedding.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/NativeReferencesNoEmbedding.cs @@ -6,8 +6,7 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] public class NativeReferencesNoEmbedding : ProjectTest { @@ -80,7 +79,7 @@ namespace Xamarin.MacDev.Tasks ClearMessages (); // No change build should not - BuildProjectNoEmbedding (bindingLib, clean : false); + BuildProjectNoEmbedding (bindingLib, clean: false); Assert.False (GetMessages ().Contains (CreatePackageString), "Rebuild build did create package?"); ClearMessages (); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs index ca6e1a33ea..0f9bef6e93 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectReference.cs @@ -6,12 +6,10 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class ProjectReferenceTests : ProjectTest - { + public class ProjectReferenceTests : ProjectTest { public ProjectReferenceTests (string platform) : base (platform) { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs index d73f12c55a..eb4b7c7b9a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectTest.cs @@ -6,8 +6,7 @@ using NUnit.Framework; using Xamarin.Tests; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public class ProjectTest : TestBase { public ProjectTest (string platform) : base (platform) diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs index 0cd11209f3..63a93394c0 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithFrameworks.cs @@ -9,7 +9,7 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] public class ProjectWithFrameworksTests : ExtensionTestBase { - public ProjectWithFrameworksTests (string platform) : base (platform) + public ProjectWithFrameworksTests (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs index 1c3916bb81..1deb58f4d0 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ProjectWithSpaces.cs @@ -5,12 +5,10 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class ProjectWithSpacesTests : ProjectTest - { + public class ProjectWithSpacesTests : ProjectTest { public ProjectWithSpacesTests (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs index d7175ee648..d896b198fe 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ReleaseBuild.cs @@ -7,11 +7,9 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] - public class ReleaseBuild : ProjectTest - { + public class ReleaseBuild : ProjectTest { public ReleaseBuild (string platform) : base (platform, "Release") { @@ -52,10 +50,10 @@ namespace Xamarin.MacDev.Tasks var newDSymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file)); foreach (var file in timestamps.Keys) - Assert.AreEqual (timestamps[file], newTimestamps[file], "#1: " + file); + Assert.AreEqual (timestamps [file], newTimestamps [file], "#1: " + file); foreach (var file in dsymTimestamps.Keys) - Assert.AreEqual (dsymTimestamps[file], newDSymTimestamps[file], "#2: " + file); + Assert.AreEqual (dsymTimestamps [file], newDSymTimestamps [file], "#2: " + file); EnsureFilestampChange (); @@ -78,7 +76,7 @@ namespace Xamarin.MacDev.Tasks } else if (fileName == "MyReleaseBuild") { // the executable must of course be modified isModificationExpected = true; - } else if (fileName == "CodeResources") { + } else if (fileName == "CodeResources") { // the signature has of course changed too isModificationExpected = true; } else if (fileName.EndsWith (".dll", StringComparison.Ordinal) || fileName.EndsWith (".exe", StringComparison.Ordinal)) { @@ -87,13 +85,13 @@ namespace Xamarin.MacDev.Tasks } if (isModificationExpected) - Assert.AreNotEqual (timestamps[file], newTimestamps[file], "#3: " + file); + Assert.AreNotEqual (timestamps [file], newTimestamps [file], "#3: " + file); else - Assert.AreEqual (timestamps[file], newTimestamps[file], "#3: " + file); + Assert.AreEqual (timestamps [file], newTimestamps [file], "#3: " + file); } foreach (var file in dsymTimestamps.Keys) - Assert.AreNotEqual (dsymTimestamps[file], newDSymTimestamps[file], "#4: " + file); + Assert.AreNotEqual (dsymTimestamps [file], newDSymTimestamps [file], "#4: " + file); } } } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs index 0bdac0b530..12db23844a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/ResponseFileArguments.cs @@ -6,10 +6,8 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public class ResponseFileArguments : ProjectTest - { +namespace Xamarin.MacDev.Tasks { + public class ResponseFileArguments : ProjectTest { public ResponseFileArguments () : base ("iPhoneSimulator") { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/SystemMemoryReference.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/SystemMemoryReference.cs index efa41d657d..0ca5a35dbd 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/SystemMemoryReference.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/SystemMemoryReference.cs @@ -12,8 +12,8 @@ namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] public class SystemMemoryReferenceTests : ProjectTest { - - public SystemMemoryReferenceTests (string platform) : base (platform) + + public SystemMemoryReferenceTests (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs index e5821f71e9..b954a18c6a 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/TVOS/TVApp.cs @@ -5,18 +5,16 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class TVAppTests : ExtensionTestBase - { + public class TVAppTests : ExtensionTestBase { public TVAppTests (string platform) : base (platform) { } [Test] - public void BasicTest() + public void BasicTest () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.TVOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET diff --git a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs index b83647953e..2fb149ecba 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/ProjectsTests/XamarinForms.cs @@ -4,12 +4,10 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture ("iPhone")] [TestFixture ("iPhoneSimulator")] - public class XamarinForms : ProjectTest - { + public class XamarinForms : ProjectTest { public XamarinForms (string platform) : base (platform) { } diff --git a/tests/msbuild/Xamarin.MacDev.Tests/RoslynSmokeTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/RoslynSmokeTests.cs index fc52142847..fd9c007234 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/RoslynSmokeTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/RoslynSmokeTests.cs @@ -6,11 +6,9 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MMP.Tests -{ +namespace Xamarin.MMP.Tests { [TestFixture] - public partial class MMPTests - { + public partial class MMPTests { public string RoslynTestProjectRoot => Path.Combine (Configuration.TestProjectsDirectory, "RoslynTestApp"); [Test] diff --git a/tests/msbuild/Xamarin.MacDev.Tests/RuntimeTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/RuntimeTests.cs index 1752e570da..daf5aed8ea 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/RuntimeTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/RuntimeTests.cs @@ -7,11 +7,9 @@ using NUnit.Framework; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MMP.Tests -{ +namespace Xamarin.MMP.Tests { [TestFixture] - public class RuntimeTests - { + public class RuntimeTests { [Test] public void AssemblyRegistration () { diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs index 135389552e..bd2c680c8b 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/TargetTests.cs @@ -9,17 +9,15 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class TargetTests : TestBase - { + public class TargetTests : TestBase { public TargetTests () : base ("iPhoneSimulator") { } - string[] ExpectedExecutableBundleResources { + string [] ExpectedExecutableBundleResources { get { var files = new [] { Path.Combine ("Folder", "BundleResource.txt"), @@ -50,7 +48,7 @@ namespace Xamarin.MacDev.Tasks } } - string[] ExpectedLibraryBundleResources { + string [] ExpectedLibraryBundleResources { get { var files = new [] { Path.Combine ("LibrarySecondStoryboard.storyboardc", "43-view-49.nib"), @@ -69,7 +67,7 @@ namespace Xamarin.MacDev.Tasks } } - string[] ExpectedExecutableFiles { + string [] ExpectedExecutableFiles { get { var files = new [] { "MonoTouchDebugConfiguration.txt", @@ -101,8 +99,8 @@ namespace Xamarin.MacDev.Tasks return expected.ToArray (); } } - - static string[] ExpectedLibraryEmbeddedResources { + + static string [] ExpectedLibraryEmbeddedResources { get { return new [] { "MyLibrary.MyLibraryFolder.LibraryLinkedEmbeddedResource.txt", @@ -149,7 +147,7 @@ namespace Xamarin.MacDev.Tasks RunTarget (MonoTouchProject, TargetName.ResolveReferences); var references = MonoTouchProjectInstance.GetItems ("ReferencePath").ToArray (); - var expected_references = new string[] { + var expected_references = new string [] { "MyLibrary.dll", "System.dll", "System.Xml.dll", @@ -172,7 +170,7 @@ namespace Xamarin.MacDev.Tasks RunTarget (LibraryProject, TargetName.ResolveReferences); var references = LibraryProjectInstance.GetItems ("ReferencePath").ToArray (); - var expected_references = new string[] { + var expected_references = new string [] { "System.dll", "System.Xml.dll", "System.Core.dll", @@ -208,13 +206,13 @@ namespace Xamarin.MacDev.Tasks // Verify that we have not bundled BundleResource or Content items as embedded resources var assemblyDef = AssemblyDefinition.ReadAssembly (Path.Combine (AppBundlePath, "MySingleView.exe")); - Assert.AreEqual (2, assemblyDef.MainModule.Resources.OfType ().Count (), "#3"); - + Assert.AreEqual (2, assemblyDef.MainModule.Resources.OfType ().Count (), "#3"); + var plist = PDictionary.FromFile (Path.Combine (AppBundlePath, "Info.plist")); Assert.IsTrue (plist.ContainsKey ("CFBundleExecutable")); Assert.IsTrue (plist.ContainsKey ("CFBundleVersion")); - Assert.IsNotEmpty (((PString)plist["CFBundleExecutable"]).Value); - Assert.IsNotEmpty (((PString)plist["CFBundleVersion"]).Value); + Assert.IsNotEmpty (((PString) plist ["CFBundleExecutable"]).Value); + Assert.IsNotEmpty (((PString) plist ["CFBundleVersion"]).Value); } [Test] @@ -403,10 +401,10 @@ namespace Xamarin.MacDev.Tasks Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET var libraryPath = Path.Combine (LibraryProjectBinPath, "MyLibrary.dll"); - + RunTarget (LibraryProject, TargetName.Build); var timestamp = GetLastModified (libraryPath); - + Touch (Path.Combine (LibraryProjectPath, "LibraryStoryboard.storyboard")); RunTarget (LibraryProject, TargetName.Build); Assert.AreNotEqual (timestamp, GetLastModified (libraryPath)); @@ -428,30 +426,30 @@ namespace Xamarin.MacDev.Tasks Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET LibraryProjectInstance.RemoveItems ("InterfaceDefinition"); - + BuildLibraryCore (ExpectedLibraryEmbeddedResources.Where (s => !s.Contains ("storyboardc")).ToArray ()); } - void BuildLibraryCore (string[] expectedResources) + void BuildLibraryCore (string [] expectedResources) { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET var library = Path.Combine (LibraryProjectBinPath, "MyLibrary.dll"); RunTarget (LibraryProject, TargetName.Build); - + 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"); Assert.IsTrue (File.Exists (Path.ChangeExtension (library, ".pdb")), "#3"); - + var assemblyDef = AssemblyDefinition.ReadAssembly (library); var actualResources = assemblyDef.MainModule.Resources.Select (n => n.Name).ToList (); - + foreach (var resource in expectedResources) Assert.IsTrue (actualResources.Contains (resource), "#1. " + resource); - Assert.AreEqual (expectedResources.Length, assemblyDef.MainModule.Resources.OfType ().Count (), "#2"); + Assert.AreEqual (expectedResources.Length, assemblyDef.MainModule.Resources.OfType ().Count (), "#2"); } [Test] @@ -481,8 +479,8 @@ namespace Xamarin.MacDev.Tasks RunTarget (MonoTouchProject, TargetName.PackLibraryResources); var embeddedResources = MonoTouchProjectInstance.GetItems ("EmbeddedResource").ToArray (); Assert.AreEqual (2, embeddedResources.Length, "#1"); - Assert.IsTrue (embeddedResources.Any (i => i.EvaluatedInclude == "LinkedEmbeddedResource.txt"), "#1"); - Assert.IsTrue (embeddedResources.Any (i => i.EvaluatedInclude == 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] @@ -566,7 +564,7 @@ namespace Xamarin.MacDev.Tasks } [Test (Description = "Xambug #39137")] - public void AddAppIcon_NoClean() + public void AddAppIcon_NoClean () { Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS); Configuration.AssertLegacyXamarinAvailable (); // Investigate whether this test should be ported to .NET @@ -577,7 +575,7 @@ namespace Xamarin.MacDev.Tasks var plistCopy = PDictionary.FromFile (path); // Start without app icon. - plist.Remove("XSAppIconAssets"); + plist.Remove ("XSAppIconAssets"); plist.SetMinimumOSVersion ("7.0"); plist.Save (path, true); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/ValidateAppBundleTaskTests.cs b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/ValidateAppBundleTaskTests.cs index 69d36a400b..531699aea6 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/ValidateAppBundleTaskTests.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TargetTests/ValidateAppBundleTaskTests.cs @@ -9,11 +9,9 @@ using Xamarin.MacDev; using Xamarin.Tests; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [TestFixture] - public class ValidateAppBundleTaskTests : ExtensionTestBase - { + public class ValidateAppBundleTaskTests : ExtensionTestBase { string extensionBundlePath; string mainAppPlistPath; string extensionPlistPath; @@ -55,7 +53,7 @@ namespace Xamarin.MacDev.Tasks void MissingPlist_Extension () { var contents = File.ReadAllBytes (extensionPlistPath); - try { + try { File.Delete (extensionPlistPath); RunTarget (MonoTouchProject, "_ValidateAppBundle", 1); Assert.IsTrue (Engine.Logger.ErrorEvents.Count > 0, "#2"); diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs index 67f9d447ec..3a564b45fa 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/BuildEngine.cs @@ -5,15 +5,14 @@ using System.Linq; using System.Text; using Xamarin.Utils; - + using Microsoft.Build.Framework; using Microsoft.Build.Logging.StructuredLogger; #nullable enable namespace Xamarin.Tests { - public class BuildEngine - { + public class BuildEngine { public Dictionary Properties { get; private set; } = new Dictionary (); public void SetGlobalProperty (string name, string value) @@ -108,7 +107,7 @@ namespace Xamarin.Tests { if (parent?.Name != name) return false; - if (!(parent is Parameter || parent is AddItem)) + if (!(parent is Parameter || parent is AddItem)) return false; parent = parent.Parent as NamedNode; diff --git a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs index 2ea5a04c2c..f8a2c3db00 100644 --- a/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs +++ b/tests/msbuild/Xamarin.MacDev.Tests/TestHelpers/TestBase.cs @@ -9,10 +9,8 @@ using Xamarin.MacDev; using Xamarin.Utils; -namespace Xamarin.Tests -{ - public abstract class TestBase - { +namespace Xamarin.Tests { + public abstract class TestBase { public ExecutionMode Mode = ExecutionMode.MSBuild; public string Platform; public string Config = "Debug"; @@ -32,8 +30,7 @@ namespace Xamarin.Tests Config = config; } - protected static class TargetName - { + protected static class TargetName { public static string Build = "Build"; public static string Clean = "Clean"; public static string CollectBundleResources = "_CollectBundleResources"; @@ -74,7 +71,7 @@ namespace Xamarin.Tests public string [] ExpectedAppFiles = { }; public string [] UnexpectedAppFiles = { "monotouch.dll" }; - public string[] GetCoreAppFiles (string managedExe, string nativeExe) + public string [] GetCoreAppFiles (string managedExe, string nativeExe) { var coreFiles = new List (); @@ -238,13 +235,13 @@ namespace Xamarin.Tests get { return TargetFrameworkIdentifier == "Xamarin.TVOS"; } } - public void TestFilesDoNotExist(string baseDir, IEnumerable files) + public void TestFilesDoNotExist (string baseDir, IEnumerable files) { foreach (var v in files.Select (s => Path.Combine (baseDir, s))) Assert.IsFalse (File.Exists (v) || Directory.Exists (v), "Unexpected file: {0} exists", v); } - public void TestFilesExists (string baseDir, string[] files) + public void TestFilesExists (string baseDir, string [] files) { foreach (var v in files.Select (s => Path.Combine (baseDir, s))) Assert.IsTrue (File.Exists (v) || Directory.Exists (v), "Expected file: {0} does not exist", v); @@ -260,19 +257,19 @@ namespace Xamarin.Tests } } - public void TestStoryboardC (string path) + public void TestStoryboardC (string path) { Assert.IsTrue (Directory.Exists (path), "Storyboard {0} does not exist", path); Assert.IsTrue (File.Exists (Path.Combine (path, "Info.plist"))); - TestPList (path, new string [] {"CFBundleVersion", "CFBundleExecutable"}); + TestPList (path, new string [] { "CFBundleVersion", "CFBundleExecutable" }); } - public void TestPList (string path, string[] keys) + public void TestPList (string path, string [] keys) { var plist = PDictionary.FromFile (Path.Combine (path, "Info.plist")); foreach (var x in keys) { Assert.IsTrue (plist.ContainsKey (x), "Key {0} is not present in {1} Info.plist", x, path); - Assert.IsNotEmpty (((PString)plist[x]).Value, "Key {0} is empty in {1} Info.plist", x, path); + Assert.IsNotEmpty (((PString) plist [x]).Value, "Key {0} is empty in {1} Info.plist", x, path); } } @@ -280,7 +277,7 @@ namespace Xamarin.Tests { var dir = Cache.CreateTemporaryDirectory (); path = Path.Combine (dir, path); - using (new FileStream (path, FileMode.CreateNew)) {} + using (new FileStream (path, FileMode.CreateNew)) { } return path; } @@ -308,7 +305,7 @@ namespace Xamarin.Tests public static bool IsAPFS { get { if (!is_apfs.HasValue) { - var exit_code = ExecutionHelper.Execute ("/bin/df", new string[] { "-t", "apfs", "/" }, out var output, TimeSpan.FromSeconds (10)); + var exit_code = ExecutionHelper.Execute ("/bin/df", new string [] { "-t", "apfs", "/" }, out var output, TimeSpan.FromSeconds (10)); is_apfs = exit_code == 0 && output.Trim ().Split ('\n').Length >= 2; } return is_apfs.Value; @@ -350,7 +347,7 @@ namespace Xamarin.Tests public static void NugetRestore (string project) { - var rv = ExecutionHelper.Execute ("nuget", new string[] { "restore", project }, out var output); + var rv = ExecutionHelper.Execute ("nuget", new string [] { "restore", project }, out var output); if (rv != 0) { Console.WriteLine ("nuget restore failed:"); Console.WriteLine (output); diff --git a/tools/apidiff/Makefile b/tools/apidiff/Makefile index bd9075e5e7..6e6820f8ad 100644 --- a/tools/apidiff/Makefile +++ b/tools/apidiff/Makefile @@ -44,11 +44,10 @@ export HTML_NO_BREAKING_CHANGES_MESSAGE=No breaking changes export MARKDOWN_BREAKING_CHANGES_MESSAGE=:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark: export MARKDOWN_NO_BREAKING_CHANGES_MESSAGE=No breaking changes +ifeq ($(DOTNET_TFM_REFERENCE),) # Change the below to net7.0 once we have reference assemblies from net7.0 (i.e. once net7.0 goes stable). -DOTNET_TFM_REFERENCE_iOS=net6.0 -DOTNET_TFM_REFERENCE_tvOS=net6.0 -DOTNET_TFM_REFERENCE_macOS=net6.0 -DOTNET_TFM_REFERENCE_MacCatalyst=net6.0 +DOTNET_TFM_REFERENCE=net6.0 +endif # I18N are excluded - but otherwise if should be like ../../builds/Makefile + what XI adds # in the order to the api-diff.html merged file @@ -130,9 +129,9 @@ $(APIDIFF_DIR)/temp/dotnet/%.xml: $(DOTNET_DESTDIR)/%.dll $(MONO_API_INFO) # dependencies changed) define DotNetComputeDiff -$(OUTPUT_DIR)/diff/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%html $(OUTPUT_DIR)/diff/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%md: $(APIDIFF_DIR)/temp/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%xml $(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE_$(1))/Microsoft.$(1).xml $(MONO_API_HTML) +$(OUTPUT_DIR)/diff/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%html $(OUTPUT_DIR)/diff/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%md: $(APIDIFF_DIR)/temp/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1)%xml $(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE)/Microsoft.$(1).xml $(MONO_API_HTML) $$(Q) mkdir -p $$(dir $$@) - $$(QF_GEN) $(MONO_API_HTML_EXEC) $(NEW_REGEX) $(ADD_REGEX) $$(abspath $(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE_$(1))/Microsoft.$(1).xml) $$(abspath $(APIDIFF_DIR)/temp/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1).xml) $(APIDIFF_IGNORE) --html "$$(abspath $$(basename $$@).html)" --markdown "$$(abspath $$(basename $$@).md)" + $$(QF_GEN) $(MONO_API_HTML_EXEC) $(NEW_REGEX) $(ADD_REGEX) $$(abspath $(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE)/Microsoft.$(1).xml) $$(abspath $(APIDIFF_DIR)/temp/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM)/Microsoft.$(1).xml) $(APIDIFF_IGNORE) --html "$$(abspath $$(basename $$@).html)" --markdown "$$(abspath $$(basename $$@).md)" $$(Q) touch $$@ endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call DotNetComputeDiff,$(platform)))) @@ -413,7 +412,7 @@ APIDIFF_UNIQUE_HASHES=$(foreach url,$(APIDIFF_UNIQUE_URLS),$(word 5,$(subst /, , AUTH_TOKEN_GITHUB_COM_FILE=$(HOME)/.config/AUTH_TOKEN_GITHUB_COM ifeq ($(AUTH_TOKEN_GITHUB_COM),) -ifeq ($(AUTH_TOKEN_GITHUB_COM_FILE),$(shell ls -1 $(AUTH_TOKEN_GITHUB_COM_FILE 2>/dev/null))) +ifeq ($(AUTH_TOKEN_GITHUB_COM_FILE),$(shell ls -1 $(AUTH_TOKEN_GITHUB_COM_FILE) 2>/dev/null)) AUTH_TOKEN_GITHUB_COM:=$(shell cat $(AUTH_TOKEN_GITHUB_COM_FILE)) endif endif @@ -510,7 +509,7 @@ $(APIDIFF_DIR)/updated-references/xm/%.xml: $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURREN $(QF_GEN) $(MONO_API_INFO_EXEC) -d $(dir $<) $(abspath $<) -o $(abspath $(APIDIFF_DIR)/references/xm/$*.xml) define DotNetGenerateReferenceXml -$(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE_$(1))/Microsoft.$(1).xml: $(UNZIP_DIR_DOTNET_$(1))/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE_$(1))/Microsoft.$(1).dll $(MONO_API_INFO) +$(APIDIFF_DIR)/references/dotnet/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE)/Microsoft.$(1).xml: $(UNZIP_DIR_DOTNET_$(1))/Microsoft.$(1).Ref/ref/$(DOTNET_TFM_REFERENCE)/Microsoft.$(1).dll $(MONO_API_INFO) $$(Q) mkdir -p $$(dir $$@) $$(QF_GEN) $(MONO_API_INFO_EXEC) $$(abspath $$<) -o $$(abspath $$@) endef diff --git a/tools/autoformat.sh b/tools/autoformat.sh index e2884ce83e..6d62918d67 100755 --- a/tools/autoformat.sh +++ b/tools/autoformat.sh @@ -39,6 +39,7 @@ dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/u2todo/u2todo.csproj" dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-report/xtro-report.csproj" dotnet format whitespace "$SRC_DIR/tests/xtro-sharpie/xtro-sanity/xtro-sanity.csproj" dotnet format whitespace --folder "$SRC_DIR/tests/monotouch-test" +dotnet format whitespace --folder "$SRC_DIR/tests/msbuild" dotnet format whitespace --folder "$SRC_DIR/tests/xtro-sharpie" dotnet format whitespace --folder "$SRC_DIR/src/Accelerate" diff --git a/tools/compare-commits.sh b/tools/compare-commits.sh index 4830dbd2f8..1ec0658dab 100755 --- a/tools/compare-commits.sh +++ b/tools/compare-commits.sh @@ -361,10 +361,14 @@ if test -n "$ENABLE_API_DIFF"; then # echo "💪 ${BLUE}Computing API diff vs ${WHITE}${BASE_HASH}${BLUE}${CLEAR} 💪" + # Compute the TFM of the previous hash + PREVIOUS_DOTNET_TFM=$(make -C "$OUTPUT_SRC_DIR/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET_TFM) + PREVIOUS_DOTNET_TFM=${PREVIOUS_DOTNET_TFM#*=} + # Calculate apidiff references according to the temporary build echo " ${BLUE}Updating apidiff references...${CLEAR}" rm -rf "$APIDIFF_RESULTS_DIR" "$APIDIFF_TMP_DIR" - if ! make update-refs -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" IOS_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_ios-build" MAC_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_mac-build" DOTNET_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_build" 2>&1 | sed 's/^/ /'; then + if ! make update-refs -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" IOS_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_ios-build" MAC_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_mac-build" DOTNET_DESTDIR="$OUTPUT_SRC_DIR/xamarin-macios/_build" DOTNET_TFM_REFERENCE="$PREVIOUS_DOTNET_TFM" 2>&1 | sed 's/^/ /'; then EC=${PIPESTATUS[0]} report_error_line "${RED}Failed to update apidiff references${CLEAR}" exit "$EC" @@ -373,7 +377,7 @@ if test -n "$ENABLE_API_DIFF"; then # Now compare the current build against those references echo " ${BLUE}Running apidiff...${CLEAR}" APIDIFF_FILE=$APIDIFF_RESULTS_DIR/api-diff.html - if ! make all-local -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" SKIP_XAMARIN_VS_DOTNET=1 SKIP_IOS_VS_MACCATALYST=1 2>&1 | sed 's/^/ /'; then + if ! make all-local -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" SKIP_XAMARIN_VS_DOTNET=1 SKIP_IOS_VS_MACCATALYST=1 DOTNET_TFM_REFERENCE="$PREVIOUS_DOTNET_TFM" 2>&1 | sed 's/^/ /'; then EC=${PIPESTATUS[0]} report_error_line "${RED}Failed to run apidiff${CLEAR}" exit "$EC" @@ -381,7 +385,7 @@ if test -n "$ENABLE_API_DIFF"; then # Now create the markdowns with these references echo " ${BLUE}Creating markdowns...${CLEAR}" - if ! make all-markdowns -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" 2>&1 | sed 's/^/ /'; then + if ! make all-markdowns -C "$ROOT_DIR/tools/apidiff" -j8 APIDIFF_DIR="$APIDIFF_TMP_DIR" OUTPUT_DIR="$APIDIFF_RESULTS_DIR" DOTNET_TFM_REFERENCE="$PREVIOUS_DOTNET_TFM" 2>&1 | sed 's/^/ /'; then EC=${PIPESTATUS[0]} report_error_line "${RED}Failed to create markdowns${CLEAR}" exit "$EC" diff --git a/tools/devops/automation/scripts/bash/install-workloads.sh b/tools/devops/automation/scripts/bash/install-workloads.sh index 187e313cd6..7ddea1b7fc 100755 --- a/tools/devops/automation/scripts/bash/install-workloads.sh +++ b/tools/devops/automation/scripts/bash/install-workloads.sh @@ -5,6 +5,39 @@ IFS=$'\n\t ' env | sort +# This script can be executed locally by downloading the 'WorkloadRollback' +# and 'not-signed-package' artifacts from an Azure DevOps build, and then +# extracting the files into the xamarin-macios/../artifacts directory. + +# If BUILD_SOURCESDIRECTORY is not set, it's likely we're executing locally. +# In which case we can figure out where we are from the current git checkout +# (and also set BUILD_SOURCESDIRECTORY accordingly, since the rest of the +# script needs it). +if test -z "${BUILD_SOURCESDIRECTORY:-}"; then + BUILD_SOURCESDIRECTORY="$(git rev-parse --show-toplevel)/.." +fi +# Don't assume we're in the right directory (makes it easier to run the script +# locally). +cd "$BUILD_SOURCESDIRECTORY/xamarin-macios" + +# Validate a few things +ARTIFACTS_PATH=$BUILD_SOURCESDIRECTORY/artifacts +if ! test -d "$ARTIFACTS_PATH"; then + echo "The path to the artifects ($ARTIFACTS_PATH) does not exist!" + exit 1 +elif [[ $(find "$ARTIFACTS_PATH/not-signed-package" -type f -name '*.nupkg' -or -name '*.pkg' -or -name '*.zip' | wc -l) -lt 1 ]]; then + echo "No artifacts found in $ARTIFACTS_PATH/not-signed-package" + echo "If you're running this locally, download the 'not-signed-package' artifact and extract it into $ARTIFACTS_PATH/not-signed-package" + exit 1 +fi + +ROLLBACK_PATH="$ARTIFACTS_PATH/WorkloadRollback/WorkloadRollback.json" +if ! test -f "$ROLLBACK_PATH"; then + echo "The rollback file $ROLLBACK_PATH does not exist!" + exit 1 +fi + +# Start working make global.json make -C builds dotnet CUSTOM_DOTNET_RUNTIME_INSTALL=1 @@ -20,16 +53,14 @@ var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-abspat DOTNET_NUPKG_DIR=${var#*=} echo "Using nuget dir $DOTNET_NUPKG_DIR" -ROLLBACK_PATH="$BUILD_SOURCESDIRECTORY/artifacts/WorkloadRollback/WorkloadRollback.json" - echo "Rollback file contents:" cat "$ROLLBACK_PATH" mkdir -p "$DOTNET_NUPKG_DIR" -ls -R "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package" -cp "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package/"*.nupkg "$DOTNET_NUPKG_DIR" -cp "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package/"*.pkg "$DOTNET_NUPKG_DIR" -cp "$BUILD_SOURCESDIRECTORY/artifacts/not-signed-package/"*.zip "$DOTNET_NUPKG_DIR" +ls -R "$ARTIFACTS_PATH/not-signed-package" +cp "$ARTIFACTS_PATH/not-signed-package/"*.nupkg "$DOTNET_NUPKG_DIR" +cp "$ARTIFACTS_PATH/not-signed-package/"*.pkg "$DOTNET_NUPKG_DIR" +cp "$ARTIFACTS_PATH/not-signed-package/"*.zip "$DOTNET_NUPKG_DIR" ls -R "$DOTNET_NUPKG_DIR" NUGET_SOURCES=$(grep https://pkgs.dev.azure.com ./NuGet.config | sed -e 's/.*value="//' -e 's/".*//') diff --git a/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml b/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml index 097da93906..c902bde9d6 100644 --- a/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml +++ b/tools/devops/automation/templates/sign-and-notarized/upload-azure.yml @@ -32,6 +32,11 @@ steps: persistCredentials: true path: s/xamarin-macios +# checkout an extra repo to ensure that we have the same tree structure in the working directory in all pipelines. +# if you delete this checkout the unified pipeline will have issues. +- checkout: yaml-templates + clean: true + # Download the Html Report that was added by the tests job. - task: DownloadPipelineArtifact@2 displayName: Download packages @@ -112,7 +117,7 @@ steps: Write-Host "Build task not found at $execPath!" } - $maciosPath="$Env:BUILD_SOURCESDIRECTORY" + $maciosPath="$Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios" Write-Host "Exect path is $execPath" Write-Host "Macios path is $maciosPath" @@ -138,7 +143,7 @@ steps: continueOnError: true - pwsh: | - Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\tools\devops\automation\scripts\MaciosCI.psd1 + Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 $statuses = New-GitHubStatusesObjectFromUrl -Url "$(Build.Repository.Uri)" -Token $(GitHub.Token) Dir "$(Build.SourcesDirectory)\\artifacts\\package"