diff --git a/.github/workflows/autoformat.yml b/.github/workflows/autoformat.yml index cedcebe770..5726ce427d 100644 --- a/.github/workflows/autoformat.yml +++ b/.github/workflows/autoformat.yml @@ -44,6 +44,12 @@ jobs: cd .. dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj" dotnet format whitespace "$SRC_DIR/tests/cecil-tests/cecil-tests.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj" + dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj" # dotnet format "$SRC_DIR/[...]" # add more projects here... cd "$SRC_DIR" diff --git a/Makefile b/Makefile index 67f2a96d07..9442b23116 100644 --- a/Makefile +++ b/Makefile @@ -105,13 +105,16 @@ else endif endif -package: - mkdir -p ../package - $(MAKE) -C $(MACCORE_PATH) package +.PHONY: package release +package release: + $(Q) $(MAKE) -C $(TOP)/release release # copy .pkg, .zip and *updateinfo to the packages directory to be uploaded to storage - $(CP) $(MACCORE_PATH)/release/*.pkg ../package - $(CP) $(MACCORE_PATH)/release/*.zip ../package - $(CP) $(MACCORE_PATH)/release/*updateinfo ../package + $(Q) mkdir -p ../package + $(Q) $(CP) $(TOP)/release/*.pkg ../package + $(Q) $(CP) $(TOP)/release/*.zip ../package + $(Q) $(CP) $(TOP)/release/*updateinfo ../package + $(Q) echo "Packages:" + $(Q) ls -la ../package | sed 's/^/ /' dotnet-install-system: $(Q) $(MAKE) -C dotnet install-system diff --git a/builds/.gitignore b/builds/.gitignore index 22f0056dc6..dad605eee0 100644 --- a/builds/.gitignore +++ b/builds/.gitignore @@ -1,3 +1,4 @@ +all-package-references.csproj dotnet-install.sh BundledNETCorePlatformsPackageVersion.txt downloads diff --git a/builds/Makefile b/builds/Makefile index d8a2e4bf38..ddcd2b8e99 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -131,10 +131,14 @@ DOWNLOAD_DOTNET_VERSION=$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION) endif endif -.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(DOTNET_INSTALL_NAME) +package-download/all-package-references.csproj: $(TOP)/.git/HEAD $(TOP)/.git/index ./create-csproj-for-all-packagereferences.sh + $(Q_GEN) ./create-csproj-for-all-packagereferences.sh --output "$(abspath $@.tmp)" $(if $(V),-v,) + $(Q) mv "$@.tmp" "$@" + +.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(DOTNET_INSTALL_NAME) package-download/all-package-references.csproj $(Q_GEN) cd package-download && $(DOTNET) \ build \ - download-packages.proj \ + download-packages.csproj \ /t:WriteBundledNETCorePlatformsPackageVersion \ /p:WriteFilePath=$(CURDIR)/BundledNETCorePlatformsPackageVersion.txt \ /p:PackageRuntimeIdentifiers="$(DOTNET_RUNTIME_IDENTIFIERS)" \ diff --git a/builds/create-csproj-for-all-packagereferences.sh b/builds/create-csproj-for-all-packagereferences.sh new file mode 100755 index 0000000000..0245af9afe --- /dev/null +++ b/builds/create-csproj-for-all-packagereferences.sh @@ -0,0 +1,68 @@ +#!/bin/bash -eu + +WHITE=$(tput setaf 7 || true) +RED=$(tput setaf 9 || true) +CLEAR=$(tput sgr0 || true) + +OUTPUTPATH= +while [[ $# -gt 0 ]]; do + case $1 in + --help | -\? | -h) + echo "$(basename "$0"): --output=" + echo " Find all the 'PackageReference' items in the repository and creates a project listing them all as 'PackageDownload' items." + echo " Options:" + echo " -h --help: Show this help" + echo " -v --verbose: Enable verbose script" + echo " --output=: The output file" + exit 0 + ;; + --verbose | -v) + set -x + shift + ;; + --output) + OUTPUTPATH="$2" + shift 2 + ;; + --output=*) + OUTPUTPATH="${1#*=}" + shift + ;; + *) + echo "${RED}$(basename "$0"): Unknown option: ${WHITE}$1${RED}. Pass --help to view the available options.${CLEAR}" + exit 1 + ;; + esac +done + +TMPPATH=$(PWD)/packagereferences.tmp.csproj + +# Go to the root directory +cd "$(git rev-parse --show-toplevel)" + +# Find all items that has an Include="..." and a Version="..." +git grep -e '' -h > "$TMPPATH" + +# Replace double double quotes with a single double quote. This happens in source code that generates project files (for tests). +sed -i '' 's/""/"/g' "$TMPPATH" + +# Remove packages that we build locally +sed -i '' '/Xamarin.Tests.FrameworksInRuntimesNativeDirectory/d' "$TMPPATH" + +# Get only the name and version of each package, and write that back in a PackageDownload item +sed -i '' 's@.*.*@\t\t@g' "$TMPPATH" + +# Sort the references and only list each once. +sort -u -o "$TMPPATH" "$TMPPATH" + +# Create the complete/valid csproj +{ + echo $'' + echo $'\t' + cat "$TMPPATH" + echo $'\t' + echo $'' +} > "$TMPPATH.2" +mv "$TMPPATH.2" "$TMPPATH" + +mv "$TMPPATH" "$OUTPUTPATH" diff --git a/builds/package-download/download-packages.proj b/builds/package-download/download-packages.csproj similarity index 89% rename from builds/package-download/download-packages.proj rename to builds/package-download/download-packages.csproj index e02f7d3ccf..2e3268f135 100644 --- a/builds/package-download/download-packages.proj +++ b/builds/package-download/download-packages.csproj @@ -3,6 +3,7 @@ net6.0 $(CustomDotNetVersion) $(BundledNETCorePlatformsPackageVersion) + $(NoWarn);NU1505 @@ -29,6 +30,8 @@ + + diff --git a/docs/website/Makefile b/docs/website/Makefile index 2e3fc19662..a4e3acaa9a 100644 --- a/docs/website/Makefile +++ b/docs/website/Makefile @@ -1,14 +1,11 @@ TOP=../../.. WEBSITE_DOCS ?= $(TOP)/xamarin-docs-pr -XAMARIN_ANALYSIS ?=$(TOP)/xamarin-analysis/shared/Xamarin.Analysis -XAMARIN_ANALYSIS_DOC = xamarin-analysis-doc-tool/bin/Debug -all: xamarin-analysis-doc +all: cp mtouch-errors.md $(WEBSITE_DOCS)/docs/ios/troubleshooting/mtouch-errors.md cp mmp-errors.md $(WEBSITE_DOCS)/docs/mac/troubleshooting/mmp-errors.md cp binding_objc_libs.md $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/objective-c-libraries.md cp binding_types_reference_guide.md $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/binding-types-reference.md - cp xamarin-ios-analysis.md $(WEBSITE_DOCS)/ios/troubleshooting/xamarin-ios-analysis.md cp optimizations.md $(WEBSITE_DOCS)/docs/cross-platform/macios/optimizations.md diff: @@ -16,9 +13,4 @@ diff: -diff -u $(WEBSITE_DOCS)/docs/mac/troubleshooting/mmp-errors.md mmp-errors.md -diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/objective-c-libraries.md binding_objc_libs.md -diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/binding-types-reference.md binding_types_reference_guide.md - -diff -u $(WEBSITE_DOCS)/docs/ios/troubleshooting/xamarin-ios-analysis.md xamarin-ios-analysis.md -diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/optimizations.md optimizations.md - -xamarin-analysis-doc: - msbuild xamarin-analysis-doc-tool/xamarin-analysis-doc.sln - mono $(XAMARIN_ANALYSIS_DOC)/xamarin-analysis-doc.exe $(XAMARIN_ANALYSIS)/Xamarin.iOS.Analysis.targets diff --git a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.cs b/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.cs deleted file mode 100644 index 9e74630337..0000000000 --- a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Xml.Linq; -using System.IO; - -namespace XamarinAnalysisDoc -{ - class MainClass - { - static string analysis_path; - - public static int Main (string [] args) - { - if (args.Length < 1) { - Console.WriteLine ("Usage: mono xamarin-analysis-doc.exe /path/to/Xamarin.iOS.Analysis.targets"); - return 1; - } - - analysis_path = args [0]; - - if (!File.Exists (analysis_path)) { - Console.WriteLine ($"Cannot find {analysis_path}"); - return 1; - } - - GenerateAnalysisDoc (analysis_path); - - return 0; - } - - static void GenerateAnalysisDoc (string path) - { - var section = "---\n"; - section += "id: c29b69f5-08e4-4dcc-831e-7fd692ab0886\n"; - section += "title: Xamarin.iOS Analysis Rules\n"; - section += "dateupdated: " + DateTime.Now.ToString("yyyy-MM-dd") + "\n"; - section += "---\n\n"; - section += "[//]: # (The original file resides under https://github.com/xamarin/xamarin-macios/tree/main/docs/website/)\n"; - section += "[//]: # (This allows all contributors (including external) to submit, using a PR, updates to the documentation that match the tools changes)\n"; - section += "[//]: # (Modifications outside of xamarin-macios/main will be lost on future updates)\n\n"; - section += "Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available.\n\n"; - section += "Run the analysis rules as often as possible to find possible improvements early on and save development time.\n\n"; - section += "To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**.\n\n"; - section += "> ⚠️ **NOTE:** Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations.\n\n"; - - var root = XDocument.Load (path); - - XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003"; - - foreach (XElement target in root.Descendants (ns + "Target")) { - var nameAttr = target.Attribute ("Name").Value; - var rule = nameAttr.Split ('_'); - var ruleID = rule [0]; - var ruleName = rule [1]; - - section += $"### {ruleID}: {ruleName}\n\n"; - - foreach (var xpaResult in target.Descendants (ns + "XamarinProjectAnalysisResult").Elements ()) { - if (xpaResult.Name.LocalName != "Category") { - section += "- **" + xpaResult.Name.LocalName + ":** "; - section += xpaResult.Value + "\n"; - } - } - section += "\n"; - } - - File.WriteAllText ("xamarin-ios-analysis.md", section); - } - } -} diff --git a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.csproj b/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.csproj deleted file mode 100644 index 13ba38cad1..0000000000 --- a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - Debug - x86 - {D2502AC9-4265-481A-B9A1-57F42EF9CF58} - Exe - XamarinAnalysisDoc - xamarin-analysis-doc - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - true - x86 - - - true - bin\Release - prompt - 4 - true - x86 - - - - - - - - - - - \ No newline at end of file diff --git a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.sln b/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.sln deleted file mode 100644 index 9042bf913e..0000000000 --- a/docs/website/xamarin-analysis-doc-tool/xamarin-analysis-doc.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xamarin-analysis-doc", "xamarin-analysis-doc.csproj", "{D2502AC9-4265-481A-B9A1-57F42EF9CF58}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Debug|x86.ActiveCfg = Debug|x86 - {D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Debug|x86.Build.0 = Debug|x86 - {D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Release|x86.ActiveCfg = Release|x86 - {D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Release|x86.Build.0 = Release|x86 - EndGlobalSection -EndGlobal diff --git a/docs/website/xamarin-ios-analysis.md b/docs/website/xamarin-ios-analysis.md deleted file mode 100644 index 4bea98af91..0000000000 --- a/docs/website/xamarin-ios-analysis.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "Xamarin.iOS Analysis Rules" -ms.topic: troubleshooting -ms.prod: xamarin -ms.assetid: C29B69F5-08E4-4DCC-831E-7FD692AB0886 -ms.technology: xamarin-ios -author: bradumbaugh -ms.author: brumbaug -ms.date: 03/06/2018 ---- - -# Xamarin.iOS analysis rules - -Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available. - -Run the analysis rules as often as possible to find possible improvements early on and save development time. - -To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**. - -> [!NOTE] -> Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations. - - - -## XIA0001: DisabledLinkerRule - -- **Problem:** The linker is disabled on device for the debug mode. -- **Fix:** You should try to run your code with the linker to avoid any surprises. -To set it up, go to Project > iOS Build > Linker Behavior. - - - -## XIA0002: TestCloudAgentReleaseRule - -- **Problem:** App builds that initialize the Test Cloud agent will be rejected by Apple when submitted, as they use private API. -- **Fix:** Add or fix the necessary #if and defines in code. - - - -## XIA0003: IPADebugBuildsRule - -- **Problem:** Debug configuration that uses developer signing keys should not generate an IPA as it is only needed for distribution, which now uses the Publishing Wizard. -- **Fix:** Disable IPA build in Project Options for the Debug configuration. - - - -## XIA0004: Missing64BitSupportRule - -- **Problem:** The supported architecture for "release | device" isn't 64 bit compatible, missing ARM64. This is a problem as Apple does not accept 32 bits only iOS apps in the AppStore. -- **Fix:** Double click on your iOS project, go to Build > iOS Build and change the supported architectures so it has ARM64. - - - -## XIA0005: Float32Rule - -- **Problem:** Not using the float32 option (--aot-options=-O=float32) leads to hefty performance cost, especially on mobile, where double precision math is measurably slower. Note that .NET uses double precision internally, even for float, so enabling this option affects precision and, possibly, compatibility. -- **Fix:** Double click on your iOS project, go to Build > iOS Build and uncheck the "Perform all 32-bit float operations as 64-bit float". - - - -## XIA0006: HttpClientAvoidManaged - -- **Problem:** We recommend using the native HttpClient handler instead of the managed one for better performance, smaller executable size, and to easily support the newer standards. -- **Fix:** Double click on your iOS project, go to Build > iOS Build and change the HttpClient implementation to either NSUrlSession (iOS 7+) or CFNetwork to support version preceding iOS 7. - - - -## XIA0007: UseLLVMRule - -- **Problem:** For Release|iPhone configuration we recommend enabling the LLVM compiler which generates code that is faster to execute at the expense of build time. -- **Fix:** Double click on your iOS project, go to Build > iOS Build and for Release|iPhone, check the LLVM optimizing compiler option. \ No newline at end of file diff --git a/dotnet/Workloads/SignList.targets b/dotnet/Workloads/SignList.targets index a63f1eeecc..6ff501c925 100644 --- a/dotnet/Workloads/SignList.targets +++ b/dotnet/Workloads/SignList.targets @@ -16,20 +16,23 @@ - + - + - + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 90c12ca990..c76adc5602 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -751,7 +751,11 @@ <_AssemblyDirsToCreate Include="@(_AssembliesToBeStripped->'%(OutputPath)%(Directory)'->Distinct())"/> - + @@ -1304,7 +1308,7 @@ diff --git a/msbuild/Xamarin.Mac.Tasks/Tasks/Mmp.cs b/msbuild/Xamarin.Mac.Tasks/Tasks/Mmp.cs index acec772526..ed9b693749 100644 --- a/msbuild/Xamarin.Mac.Tasks/Tasks/Mmp.cs +++ b/msbuild/Xamarin.Mac.Tasks/Tasks/Mmp.cs @@ -1,6 +1,4 @@ -namespace Xamarin.Mac.Tasks -{ - public class Mmp : MmpTaskBase - { +namespace Xamarin.Mac.Tasks { + public class Mmp : MmpTaskBase { } } diff --git a/msbuild/Xamarin.Mac.Tasks/Tasks/MmpTaskBase.cs b/msbuild/Xamarin.Mac.Tasks/Tasks/MmpTaskBase.cs index b979582d0a..845bc7f1b2 100644 --- a/msbuild/Xamarin.Mac.Tasks/Tasks/MmpTaskBase.cs +++ b/msbuild/Xamarin.Mac.Tasks/Tasks/MmpTaskBase.cs @@ -18,10 +18,8 @@ using Xamarin.MacDev; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.Mac.Tasks -{ - public abstract class MmpTaskBase : BundlerToolTaskBase - { +namespace Xamarin.Mac.Tasks { + public abstract class MmpTaskBase : BundlerToolTaskBase { protected override string ToolName { get { return "mmp"; } } @@ -62,7 +60,7 @@ namespace Xamarin.Mac.Tasks if (arch == XamMacArch.Default) arch = XamMacArch.x86_64; - List allSupportedArchs = new List (); + List allSupportedArchs = new List (); if (arch.HasFlag (XamMacArch.i386)) allSupportedArchs.Add ("i386"); @@ -108,7 +106,7 @@ namespace Xamarin.Mac.Tasks foreach (var nr in NativeReferences) args.AddQuotedLine ("/native-reference:" + Path.GetFullPath (nr.ItemSpec)); } - + if (IsAppExtension) args.AddQuotedLine ("/extension"); if (IsXPCService) @@ -129,8 +127,7 @@ namespace Xamarin.Mac.Tasks { try { // We first try to use the base logic, which shows up nicely in XS. base.LogEventsFromTextOutput (singleLine, messageImportance); - } - catch { // But when that fails, just output the message to the command line and XS will output it raw + } catch { // But when that fails, just output the message to the command line and XS will output it raw Log.LogMessage (messageImportance, "{0}", singleLine); } } diff --git a/msbuild/Xamarin.Mac.Tasks/Tasks/XamMacArch.cs b/msbuild/Xamarin.Mac.Tasks/Tasks/XamMacArch.cs index d57d289763..04c44a0e29 100644 --- a/msbuild/Xamarin.Mac.Tasks/Tasks/XamMacArch.cs +++ b/msbuild/Xamarin.Mac.Tasks/Tasks/XamMacArch.cs @@ -8,11 +8,9 @@ using System; -namespace Xamarin.Mac.Tasks -{ +namespace Xamarin.Mac.Tasks { [Flags] - public enum XamMacArch - { + public enum XamMacArch { Default = 0, i386 = 1, x86_64 = 2, diff --git a/msbuild/Xamarin.MacDev.Tasks/AssetPackUtils.cs b/msbuild/Xamarin.MacDev.Tasks/AssetPackUtils.cs index b26c836322..d342941498 100644 --- a/msbuild/Xamarin.MacDev.Tasks/AssetPackUtils.cs +++ b/msbuild/Xamarin.MacDev.Tasks/AssetPackUtils.cs @@ -5,43 +5,41 @@ using System.Collections.Generic; using Microsoft.Build.Framework; -namespace Xamarin.MacDev.Tasks -{ - public static class AssetPackUtils - { +namespace Xamarin.MacDev.Tasks { + public static class AssetPackUtils { const string Base36Alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const int HashEverythingLimit = 96; static unsafe ulong ComputeHash (string tags) { var value = (ulong) tags.Length; - char[] buffer; + char [] buffer; if (tags.Length > HashEverythingLimit) { - buffer = new char[HashEverythingLimit]; + buffer = new char [HashEverythingLimit]; int index = 0; while (index < 32) { - buffer[index] = tags[index]; + buffer [index] = tags [index]; index++; } for (int i = (tags.Length >> 1) - 16; i < 32; i++) - buffer[index++] = tags[i]; + buffer [index++] = tags [i]; for (int i = tags.Length - 32; i < tags.Length; i++) - buffer[index++] = tags[i]; + buffer [index++] = tags [i]; } else { buffer = tags.ToCharArray (); } fixed (char* bufptr = buffer) { - ushort* end4 = ((ushort *) bufptr) + (tags.Length & ~3); - ushort* end = ((ushort *) bufptr) + tags.Length; - ushort* cur = (ushort *) bufptr; + ushort* end4 = ((ushort*) bufptr) + (tags.Length & ~3); + ushort* end = ((ushort*) bufptr) + tags.Length; + ushort* cur = (ushort*) bufptr; while (cur < end4) { - value = (value * 67503105) + (ulong) (cur[0] * 16974593) + (ulong) (cur[1] * 66049) + (ulong) (cur[2] * 257) + (ulong) cur[3]; + value = (value * 67503105) + (ulong) (cur [0] * 16974593) + (ulong) (cur [1] * 66049) + (ulong) (cur [2] * 257) + (ulong) cur [3]; cur += 4; } @@ -56,24 +54,24 @@ namespace Xamarin.MacDev.Tasks static string Base36Encode (ulong value) { - var encoded = new char[13]; + var encoded = new char [13]; int index = 12; do { - encoded[index--] = Base36Alphabet[(int) (value % 36)]; + encoded [index--] = Base36Alphabet [(int) (value % 36)]; value /= 36; } while (value != 0); while (index >= 0) - encoded[index--] = '0'; + encoded [index--] = '0'; return new string (encoded, 0, 13); } - public static string[] ParseTags (string value) + public static string [] ParseTags (string value) { if (string.IsNullOrEmpty (value)) - return new string[0]; + return new string [0]; return value.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select (tag => tag.Trim ()).ToArray (); } @@ -96,7 +94,7 @@ namespace Xamarin.MacDev.Tasks string id; for (int i = 0; i < tags.Count; i++) { - if (tags[i].IndexOf ('+') != -1) { + if (tags [i].IndexOf ('+') != -1) { addHash = true; break; } diff --git a/msbuild/Xamarin.MacDev.Tasks/BundleResource.cs b/msbuild/Xamarin.MacDev.Tasks/BundleResource.cs index d5a27ed508..b7d82fc521 100644 --- a/msbuild/Xamarin.MacDev.Tasks/BundleResource.cs +++ b/msbuild/Xamarin.MacDev.Tasks/BundleResource.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Framework; using Xamarin.Utils; -namespace Xamarin.MacDev -{ - public static class BundleResource - { +namespace Xamarin.MacDev { + public static class BundleResource { static readonly HashSet illegalDirectoryNames = new HashSet (new [] { "Resources", "_CodeSignature", @@ -71,10 +69,9 @@ namespace Xamarin.MacDev // HACK: This is for Visual Studio iOS projects if (isVSBuild) { - if (item.GetMetadata("DefiningProjectFullPath") != item.GetMetadata("MSBuildProjectFullPath")) { - return item.GetMetadata("FullPath").Replace(item.GetMetadata ("DefiningProjectDirectory"), string.Empty); - } - else { + if (item.GetMetadata ("DefiningProjectFullPath") != item.GetMetadata ("MSBuildProjectFullPath")) { + return item.GetMetadata ("FullPath").Replace (item.GetMetadata ("DefiningProjectDirectory"), string.Empty); + } else { return item.ItemSpec; } } @@ -92,7 +89,7 @@ namespace Xamarin.MacDev baseDir = PathUtils.ResolveSymbolicLinks (baseDir); path = PathUtils.ResolveSymbolicLinks (path); - + return PathUtils.AbsoluteToRelative (baseDir, path); } diff --git a/msbuild/Xamarin.MacDev.Tasks/CommandLineArgumentBuilder.cs b/msbuild/Xamarin.MacDev.Tasks/CommandLineArgumentBuilder.cs index 52a5747bd6..e58684eadc 100644 --- a/msbuild/Xamarin.MacDev.Tasks/CommandLineArgumentBuilder.cs +++ b/msbuild/Xamarin.MacDev.Tasks/CommandLineArgumentBuilder.cs @@ -6,14 +6,12 @@ using System.Collections.Generic; using Microsoft.Build.Utilities; using Xamarin.Utils; -namespace Xamarin.MacDev -{ +namespace Xamarin.MacDev { /// /// Builds a process argument string. /// - public class CommandLineArgumentBuilder - { - static readonly char[] QuoteSpecials = new char[] { ' ', '\\', '\'', '"', ',', ';' }; + public class CommandLineArgumentBuilder { + static readonly char [] QuoteSpecials = new char [] { ' ', '\\', '\'', '"', ',', ';' }; readonly HashSet hash = new HashSet (); readonly StringBuilder builder = new StringBuilder (); @@ -69,7 +67,7 @@ namespace Xamarin.MacDev /// /// Adds multiple arguments without escaping or quoting. /// - public void Add (params string[] args) + public void Add (params string [] args) { foreach (var a in args) Add (a); @@ -78,7 +76,7 @@ namespace Xamarin.MacDev /// /// Adds a formatted argument, quoting and escaping as necessary. /// - public void AddQuotedFormat (string argumentFormat, params object[] values) + public void AddQuotedFormat (string argumentFormat, params object [] values) { AddQuoted (string.Format (argumentFormat, values)); } @@ -94,9 +92,9 @@ namespace Xamarin.MacDev quoted.Append ("\""); for (int i = 0; i < text.Length; i++) { - if (text[i] == '\\' || text[i] == '"') + if (text [i] == '\\' || text [i] == '"') quoted.Append ('\\'); - quoted.Append (text[i]); + quoted.Append (text [i]); } quoted.Append ("\""); @@ -134,7 +132,7 @@ namespace Xamarin.MacDev /// /// Adds multiple arguments, quoting and escaping each as necessary. /// - public void AddQuoted (params string[] args) + public void AddQuoted (params string [] args) { foreach (var a in args) AddQuoted (a); @@ -166,12 +164,12 @@ namespace Xamarin.MacDev return builder.ToString (); } - static bool TryParse (string commandline, out string[] argv, out Exception ex) + static bool TryParse (string commandline, out string [] argv, out Exception ex) { return StringUtils.TryParseArguments (commandline, out argv, out ex); } - public static bool TryParse (string commandline, out string[] argv) + public static bool TryParse (string commandline, out string [] argv) { Exception ex; @@ -183,9 +181,9 @@ namespace Xamarin.MacDev return Parse (ToString ()); } - public static string[] Parse (string commandline) + public static string [] Parse (string commandline) { - string[] argv; + string [] argv; Exception ex; if (!TryParse (commandline, out argv, out ex)) diff --git a/msbuild/Xamarin.MacDev.Tasks/DataConverter.cs b/msbuild/Xamarin.MacDev.Tasks/DataConverter.cs index 9eb20435e3..1d1b2622d7 100644 --- a/msbuild/Xamarin.MacDev.Tasks/DataConverter.cs +++ b/msbuild/Xamarin.MacDev.Tasks/DataConverter.cs @@ -51,101 +51,101 @@ namespace Mono { #else unsafe internal abstract class DataConverter { -// Disables the warning: CLS compliance checking will not be performed on -// `XXXX' because it is not visible from outside this assembly -#pragma warning disable 3019 + // Disables the warning: CLS compliance checking will not be performed on + // `XXXX' because it is not visible from outside this assembly +#pragma warning disable 3019 #endif static DataConverter SwapConv = new SwapConverter (); static DataConverter CopyConv = new CopyConverter (); public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian; - + public abstract double GetDouble (byte [] data, int index); - public abstract float GetFloat (byte [] data, int index); - public abstract long GetInt64 (byte [] data, int index); - public abstract int GetInt32 (byte [] data, int index); + public abstract float GetFloat (byte [] data, int index); + public abstract long GetInt64 (byte [] data, int index); + public abstract int GetInt32 (byte [] data, int index); - public abstract short GetInt16 (byte [] data, int index); + public abstract short GetInt16 (byte [] data, int index); - [CLSCompliant (false)] - public abstract uint GetUInt32 (byte [] data, int index); - [CLSCompliant (false)] + [CLSCompliant (false)] + public abstract uint GetUInt32 (byte [] data, int index); + [CLSCompliant (false)] public abstract ushort GetUInt16 (byte [] data, int index); - [CLSCompliant (false)] - public abstract ulong GetUInt64 (byte [] data, int index); - + [CLSCompliant (false)] + public abstract ulong GetUInt64 (byte [] data, int index); + public abstract void PutBytes (byte [] dest, int destIdx, double value); public abstract void PutBytes (byte [] dest, int destIdx, float value); public abstract void PutBytes (byte [] dest, int destIdx, int value); public abstract void PutBytes (byte [] dest, int destIdx, long value); public abstract void PutBytes (byte [] dest, int destIdx, short value); - [CLSCompliant (false)] + [CLSCompliant (false)] public abstract void PutBytes (byte [] dest, int destIdx, ushort value); - [CLSCompliant (false)] + [CLSCompliant (false)] public abstract void PutBytes (byte [] dest, int destIdx, uint value); - [CLSCompliant (false)] + [CLSCompliant (false)] public abstract void PutBytes (byte [] dest, int destIdx, ulong value); - public byte[] GetBytes (double value) + public byte [] GetBytes (double value) { byte [] ret = new byte [8]; PutBytes (ret, 0, value); return ret; } - - public byte[] GetBytes (float value) + + public byte [] GetBytes (float value) { byte [] ret = new byte [4]; PutBytes (ret, 0, value); return ret; } - - public byte[] GetBytes (int value) + + public byte [] GetBytes (int value) { byte [] ret = new byte [4]; PutBytes (ret, 0, value); return ret; } - - public byte[] GetBytes (long value) + + public byte [] GetBytes (long value) { byte [] ret = new byte [8]; PutBytes (ret, 0, value); return ret; } - - public byte[] GetBytes (short value) + + public byte [] GetBytes (short value) { byte [] ret = new byte [2]; PutBytes (ret, 0, value); return ret; } - [CLSCompliant (false)] - public byte[] GetBytes (ushort value) + [CLSCompliant (false)] + public byte [] GetBytes (ushort value) { byte [] ret = new byte [2]; PutBytes (ret, 0, value); return ret; } - - [CLSCompliant (false)] - public byte[] GetBytes (uint value) + + [CLSCompliant (false)] + public byte [] GetBytes (uint value) { byte [] ret = new byte [4]; PutBytes (ret, 0, value); return ret; } - - [CLSCompliant (false)] - public byte[] GetBytes (ulong value) + + [CLSCompliant (false)] + public byte [] GetBytes (ulong value) { byte [] ret = new byte [8]; PutBytes (ret, 0, value); return ret; } - + static public DataConverter LittleEndian { get { return BitConverter.IsLittleEndian ? CopyConv : SwapConv; @@ -168,7 +168,7 @@ namespace Mono { { return ((current + align - 1) / align) * align; } - + class PackContext { // Buffer public byte [] buffer; @@ -178,7 +178,7 @@ namespace Mono { public int i; // position in the description public DataConverter conv; public int repeat; - + // // if align == -1, auto align to the size of the byte array // if align == 0, do not do alignment @@ -190,13 +190,13 @@ namespace Mono { { //Console.WriteLine ("Adding {0} bytes to {1} (next={2}", group.Length, // buffer == null ? "null" : buffer.Length.ToString (), next); - - if (buffer == null){ + + if (buffer == null) { buffer = group; next = group.Length; return; } - if (align != 0){ + if (align != 0) { if (align == -1) next = Align (next, group.Length); else @@ -204,7 +204,7 @@ namespace Mono { align = 0; } - if (next + group.Length > buffer.Length){ + if (next + group.Length > buffer.Length) { byte [] nb = new byte [System.Math.Max (next, 16) * 2 + group.Length]; Array.Copy (buffer, nb, buffer.Length); Array.Copy (group, 0, nb, next, group.Length); @@ -220,8 +220,8 @@ namespace Mono { { if (buffer == null) return new byte [0]; - - if (buffer.Length != next){ + + if (buffer.Length != next) { byte [] b = new byte [next]; Array.Copy (buffer, b, next); return b; @@ -248,8 +248,8 @@ namespace Mono { // f float // d double // b byte - // c 1-byte signed character - // C 1-byte unsigned character + // c 1-byte signed character + // C 1-byte unsigned character // z8 string encoded as UTF8 with 1-byte null terminator // z6 string encoded as UTF16 with 2-byte null terminator // z7 string encoded as UTF7 with 1-byte null terminator @@ -277,7 +277,7 @@ namespace Mono { b.conv = CopyConv; b.description = description; - for (b.i = 0; b.i < description.Length; ){ + for (b.i = 0; b.i < description.Length;) { object oarg; if (argn < args.Length) @@ -285,15 +285,15 @@ namespace Mono { else { if (b.repeat != 0) break; - + oarg = null; } int save = b.i; - - if (PackOne (b, oarg)){ + + if (PackOne (b, oarg)) { argn++; - if (b.repeat > 0){ + if (b.repeat > 0) { if (--b.repeat > 0) b.i = save; else @@ -311,11 +311,11 @@ namespace Mono { PackContext b = new PackContext (); b.conv = CopyConv; b.description = description; - + IEnumerator enumerator = args.GetEnumerator (); bool ok = enumerator.MoveNext (); - for (b.i = 0; b.i < description.Length; ){ + for (b.i = 0; b.i < description.Length;) { object oarg; if (ok) @@ -325,12 +325,12 @@ namespace Mono { break; oarg = null; } - + int save = b.i; - - if (PackOne (b, oarg)){ + + if (PackOne (b, oarg)) { ok = enumerator.MoveNext (); - if (b.repeat > 0){ + if (b.repeat > 0) { if (--b.repeat > 0) b.i = save; else @@ -342,7 +342,7 @@ namespace Mono { } return b.Get (); } - + // // Packs one datum `oarg' into the buffer `b', using the string format // in `description' at position `i' @@ -352,8 +352,8 @@ namespace Mono { static bool PackOne (PackContext b, object oarg) { int n; - - switch (b.description [b.i]){ + + switch (b.description [b.i]) { case '^': b.conv = BigEndian; return false; @@ -367,44 +367,44 @@ namespace Mono { case '!': b.align = -1; return false; - + case 'x': b.Add (new byte [] { 0 }); return false; - - // Type Conversions + + // Type Conversions case 'i': b.Add (b.conv.GetBytes (Convert.ToInt32 (oarg))); break; - + case 'I': b.Add (b.conv.GetBytes (Convert.ToUInt32 (oarg))); break; - + case 's': b.Add (b.conv.GetBytes (Convert.ToInt16 (oarg))); break; - + case 'S': b.Add (b.conv.GetBytes (Convert.ToUInt16 (oarg))); break; - + case 'l': b.Add (b.conv.GetBytes (Convert.ToInt64 (oarg))); break; - + case 'L': b.Add (b.conv.GetBytes (Convert.ToUInt64 (oarg))); break; - + case 'f': b.Add (b.conv.GetBytes (Convert.ToSingle (oarg))); break; - + case 'd': b.Add (b.conv.GetBytes (Convert.ToDouble (oarg))); break; - + case 'b': b.Add (new byte [] { Convert.ToByte (oarg) }); break; @@ -417,24 +417,31 @@ namespace Mono { b.Add (new byte [] { Convert.ToByte (oarg) }); break; - // Repeat acount; - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': + // Repeat acount; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': b.repeat = ((short) b.description [b.i]) - ((short) '0'); return false; case '*': b.repeat = Int32.MaxValue; return false; - + case '[': int count = -1, j; - - for (j = b.i+1; j < b.description.Length; j++){ + + for (j = b.i + 1; j < b.description.Length; j++) { if (b.description [j] == ']') break; n = ((short) b.description [j]) - ((short) '0'); - if (n >= 0 && n <= 9){ + if (n >= 0 && n <= 9) { if (count == -1) count = n; else @@ -446,16 +453,17 @@ namespace Mono { b.i = j; b.repeat = count; return false; - - case '$': case 'z': + + case '$': + case 'z': bool add_null = b.description [b.i] == 'z'; b.i++; if (b.i >= b.description.Length) throw new ArgumentException ("$ description needs a type specified", "description"); char d = b.description [b.i]; Encoding e; - - switch (d){ + + switch (d) { case '8': e = Encoding.UTF8; n = 1; @@ -480,7 +488,7 @@ namespace Mono { e = Encoding.GetEncoding (12001); n = 4; break; - + default: throw new ArgumentException ("Invalid format for $ specifier", "description"); } @@ -492,24 +500,24 @@ namespace Mono { break; default: throw new ArgumentException (String.Format ("invalid format specified `{0}'", - b.description [b.i])); + b.description [b.i])); } return true; } static bool Prepare (byte [] buffer, ref int idx, int size, ref bool align) { - if (align){ + if (align) { idx = Align (idx, size); align = false; } - if (idx + size > buffer.Length){ + if (idx + size > buffer.Length) { idx = buffer.Length; return false; } return true; } - + static public IList Unpack (string description, byte [] buffer, int startIndex) { DataConverter conv = CopyConv; @@ -517,11 +525,11 @@ namespace Mono { int idx = startIndex; bool align = false; int repeat = 0, n; - - for (int i = 0; i < description.Length && idx < buffer.Length; ){ + + for (int i = 0; i < description.Length && idx < buffer.Length;) { int save = i; - - switch (description [i]){ + + switch (description [i]) { case '^': conv = BigEndian; break; @@ -539,87 +547,95 @@ namespace Mono { align = true; break; - // Type Conversions + // Type Conversions case 'i': - if (Prepare (buffer, ref idx, 4, ref align)){ + if (Prepare (buffer, ref idx, 4, ref align)) { result.Add (conv.GetInt32 (buffer, idx)); idx += 4; - } + } break; - + case 'I': - if (Prepare (buffer, ref idx, 4, ref align)){ + if (Prepare (buffer, ref idx, 4, ref align)) { result.Add (conv.GetUInt32 (buffer, idx)); idx += 4; } break; - + case 's': - if (Prepare (buffer, ref idx, 2, ref align)){ + if (Prepare (buffer, ref idx, 2, ref align)) { result.Add (conv.GetInt16 (buffer, idx)); idx += 2; } break; - + case 'S': - if (Prepare (buffer, ref idx, 2, ref align)){ + if (Prepare (buffer, ref idx, 2, ref align)) { result.Add (conv.GetUInt16 (buffer, idx)); idx += 2; } break; - + case 'l': - if (Prepare (buffer, ref idx, 8, ref align)){ + if (Prepare (buffer, ref idx, 8, ref align)) { result.Add (conv.GetInt64 (buffer, idx)); idx += 8; } break; - + case 'L': - if (Prepare (buffer, ref idx, 8, ref align)){ + if (Prepare (buffer, ref idx, 8, ref align)) { result.Add (conv.GetUInt64 (buffer, idx)); idx += 8; } break; - + case 'f': - if (Prepare (buffer, ref idx, 4, ref align)){ + if (Prepare (buffer, ref idx, 4, ref align)) { result.Add (conv.GetDouble (buffer, idx)); idx += 4; } break; - + case 'd': - if (Prepare (buffer, ref idx, 8, ref align)){ + if (Prepare (buffer, ref idx, 8, ref align)) { result.Add (conv.GetDouble (buffer, idx)); idx += 8; } break; - + case 'b': - if (Prepare (buffer, ref idx, 1, ref align)){ + if (Prepare (buffer, ref idx, 1, ref align)) { result.Add (buffer [idx]); idx++; } break; - case 'c': case 'C': - if (Prepare (buffer, ref idx, 1, ref align)){ + case 'c': + case 'C': + if (Prepare (buffer, ref idx, 1, ref align)) { char c; - + if (description [i] == 'c') - c = ((char) ((sbyte)buffer [idx])); + c = ((char) ((sbyte) buffer [idx])); else - c = ((char) ((byte)buffer [idx])); - + c = ((char) ((byte) buffer [idx])); + result.Add (c); idx++; } break; - - // Repeat acount; - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': + + // Repeat acount; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': repeat = ((short) description [i]) - ((short) '0'); save = i + 1; break; @@ -627,15 +643,15 @@ namespace Mono { case '*': repeat = Int32.MaxValue; break; - + case '[': int count = -1, j; - - for (j = i+1; j < description.Length; j++){ + + for (j = i + 1; j < description.Length; j++) { if (description [j] == ']') break; n = ((short) description [j]) - ((short) '0'); - if (n >= 0 && n <= 9){ + if (n >= 0 && n <= 9) { if (count == -1) count = n; else @@ -647,22 +663,23 @@ namespace Mono { i = j; repeat = count; break; - - case '$': case 'z': + + case '$': + case 'z': // bool with_null = description [i] == 'z'; i++; if (i >= description.Length) throw new ArgumentException ("$ description needs a type specified", "description"); char d = description [i]; Encoding e; - if (align){ + if (align) { idx = Align (idx, 4); align = false; } if (idx >= buffer.Length) break; - - switch (d){ + + switch (d) { case '8': e = Encoding.UTF8; n = 1; @@ -687,61 +704,61 @@ namespace Mono { e = Encoding.GetEncoding (12001); n = 4; break; - + default: throw new ArgumentException ("Invalid format for $ specifier", "description"); } int k = idx; - switch (n){ + switch (n) { case 1: for (; k < buffer.Length && buffer [k] != 0; k++) ; - result.Add (e.GetChars (buffer, idx, k-idx)); + result.Add (e.GetChars (buffer, idx, k - idx)); if (k == buffer.Length) idx = k; else - idx = k+1; + idx = k + 1; break; - + case 2: - for (; k < buffer.Length; k++){ - if (k+1 == buffer.Length){ + for (; k < buffer.Length; k++) { + if (k + 1 == buffer.Length) { k++; break; } - if (buffer [k] == 0 && buffer [k+1] == 0) + if (buffer [k] == 0 && buffer [k + 1] == 0) break; } - result.Add (e.GetChars (buffer, idx, k-idx)); + result.Add (e.GetChars (buffer, idx, k - idx)); if (k == buffer.Length) idx = k; else - idx = k+2; + idx = k + 2; break; - + case 4: - for (; k < buffer.Length; k++){ - if (k+3 >= buffer.Length){ + for (; k < buffer.Length; k++) { + if (k + 3 >= buffer.Length) { k = buffer.Length; break; } - if (buffer[k]==0 && buffer[k+1] == 0 && buffer[k+2] == 0 && buffer[k+3]== 0) + if (buffer [k] == 0 && buffer [k + 1] == 0 && buffer [k + 2] == 0 && buffer [k + 3] == 0) break; } - result.Add (e.GetChars (buffer, idx, k-idx)); + result.Add (e.GetChars (buffer, idx, k - idx)); if (k == buffer.Length) idx = k; else - idx = k+4; + idx = k + 4; break; } break; default: throw new ArgumentException (String.Format ("invalid format specified `{0}'", - description [i])); + description [i])); } - if (repeat > 0){ + if (repeat > 0) { if (--repeat > 0) i = save; } else @@ -757,7 +774,7 @@ namespace Mono { if (destIdx < 0 || destIdx > dest.Length - size) throw new ArgumentException ("destIdx"); } - + class CopyConverter : DataConverter { public override double GetDouble (byte [] data, int index) { @@ -768,10 +785,10 @@ namespace Mono { if (index < 0) throw new ArgumentException ("index"); double ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } @@ -786,10 +803,10 @@ namespace Mono { throw new ArgumentException ("index"); ulong ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } @@ -804,15 +821,15 @@ namespace Mono { throw new ArgumentException ("index"); long ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - - public override float GetFloat (byte [] data, int index) + + public override float GetFloat (byte [] data, int index) { if (data == null) throw new ArgumentNullException ("data"); @@ -822,15 +839,15 @@ namespace Mono { throw new ArgumentException ("index"); float ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - - public override int GetInt32 (byte [] data, int index) + + public override int GetInt32 (byte [] data, int index) { if (data == null) throw new ArgumentNullException ("data"); @@ -840,14 +857,14 @@ namespace Mono { throw new ArgumentException ("index"); int ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - + public override uint GetUInt32 (byte [] data, int index) { if (data == null) @@ -858,14 +875,14 @@ namespace Mono { throw new ArgumentException ("index"); uint ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - + public override short GetInt16 (byte [] data, int index) { if (data == null) @@ -876,14 +893,14 @@ namespace Mono { throw new ArgumentException ("index"); short ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 2; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - + public override ushort GetUInt16 (byte [] data, int index) { if (data == null) @@ -894,91 +911,91 @@ namespace Mono { throw new ArgumentException ("index"); ushort ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 2; i++) - b [i] = data [index+i]; + b [i] = data [index + i]; return ret; } - + public override void PutBytes (byte [] dest, int destIdx, double value) { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - long *source = (long *) &value; + fixed (byte* target = &dest [destIdx]) { + long* source = (long*) &value; - *((long *)target) = *source; + *((long*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, float value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - uint *source = (uint *) &value; + fixed (byte* target = &dest [destIdx]) { + uint* source = (uint*) &value; - *((uint *)target) = *source; + *((uint*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, int value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - uint *source = (uint *) &value; + fixed (byte* target = &dest [destIdx]) { + uint* source = (uint*) &value; - *((uint *)target) = *source; + *((uint*) target) = *source; } } public override void PutBytes (byte [] dest, int destIdx, uint value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - uint *source = (uint *) &value; + fixed (byte* target = &dest [destIdx]) { + uint* source = (uint*) &value; - *((uint *)target) = *source; + *((uint*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, long value) { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - long *source = (long *) &value; + fixed (byte* target = &dest [destIdx]) { + long* source = (long*) &value; - *((long*)target) = *source; + *((long*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, ulong value) { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - ulong *source = (ulong *) &value; + fixed (byte* target = &dest [destIdx]) { + ulong* source = (ulong*) &value; - *((ulong *) target) = *source; + *((ulong*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, short value) { Check (dest, destIdx, 2); - fixed (byte *target = &dest [destIdx]){ - ushort *source = (ushort *) &value; + fixed (byte* target = &dest [destIdx]) { + ushort* source = (ushort*) &value; - *((ushort *)target) = *source; + *((ushort*) target) = *source; } } - + public override void PutBytes (byte [] dest, int destIdx, ushort value) { Check (dest, destIdx, 2); - fixed (byte *target = &dest [destIdx]){ - ushort *source = (ushort *) &value; + fixed (byte* target = &dest [destIdx]) { + ushort* source = (ushort*) &value; - *((ushort *)target) = *source; + *((ushort*) target) = *source; } } } @@ -994,10 +1011,10 @@ namespace Mono { throw new ArgumentException ("index"); double ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [7-i] = data [index+i]; + b [7 - i] = data [index + i]; return ret; } @@ -1012,10 +1029,10 @@ namespace Mono { throw new ArgumentException ("index"); ulong ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [7-i] = data [index+i]; + b [7 - i] = data [index + i]; return ret; } @@ -1030,15 +1047,15 @@ namespace Mono { throw new ArgumentException ("index"); long ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 8; i++) - b [7-i] = data [index+i]; + b [7 - i] = data [index + i]; return ret; } - - public override float GetFloat (byte [] data, int index) + + public override float GetFloat (byte [] data, int index) { if (data == null) throw new ArgumentNullException ("data"); @@ -1048,15 +1065,15 @@ namespace Mono { throw new ArgumentException ("index"); float ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [3-i] = data [index+i]; + b [3 - i] = data [index + i]; return ret; } - - public override int GetInt32 (byte [] data, int index) + + public override int GetInt32 (byte [] data, int index) { if (data == null) throw new ArgumentNullException ("data"); @@ -1066,14 +1083,14 @@ namespace Mono { throw new ArgumentException ("index"); int ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [3-i] = data [index+i]; + b [3 - i] = data [index + i]; return ret; } - + public override uint GetUInt32 (byte [] data, int index) { if (data == null) @@ -1084,14 +1101,14 @@ namespace Mono { throw new ArgumentException ("index"); uint ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 4; i++) - b [3-i] = data [index+i]; + b [3 - i] = data [index + i]; return ret; } - + public override short GetInt16 (byte [] data, int index) { if (data == null) @@ -1102,14 +1119,14 @@ namespace Mono { throw new ArgumentException ("index"); short ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 2; i++) - b [1-i] = data [index+i]; + b [1 - i] = data [index + i]; return ret; } - + public override ushort GetUInt16 (byte [] data, int index) { if (data == null) @@ -1120,10 +1137,10 @@ namespace Mono { throw new ArgumentException ("index"); ushort ret; - byte *b = (byte *)&ret; + byte* b = (byte*) &ret; for (int i = 0; i < 2; i++) - b [1-i] = data [index+i]; + b [1 - i] = data [index + i]; return ret; } @@ -1132,99 +1149,99 @@ namespace Mono { { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 8; i++) - target [i] = source [7-i]; + target [i] = source [7 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, float value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 4; i++) - target [i] = source [3-i]; + target [i] = source [3 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, int value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 4; i++) - target [i] = source [3-i]; + target [i] = source [3 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, uint value) { Check (dest, destIdx, 4); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 4; i++) - target [i] = source [3-i]; + target [i] = source [3 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, long value) { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 8; i++) - target [i] = source [7-i]; + target [i] = source [7 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, ulong value) { Check (dest, destIdx, 8); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 4; i++) - target [i] = source [7-i]; + target [i] = source [7 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, short value) { Check (dest, destIdx, 2); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 2; i++) - target [i] = source [1-i]; + target [i] = source [1 - i]; } } - + public override void PutBytes (byte [] dest, int destIdx, ushort value) { Check (dest, destIdx, 2); - fixed (byte *target = &dest [destIdx]){ - byte *source = (byte *) &value; + fixed (byte* target = &dest [destIdx]) { + byte* source = (byte*) &value; for (int i = 0; i < 2; i++) - target [i] = source [1-i]; + target [i] = source [1 - i]; } } } - + #if MONO_DATACONVERTER_STATIC_METHODS static unsafe void PutBytesLE (byte *dest, byte *src, int count) { @@ -1833,6 +1850,6 @@ namespace Mono { return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 8); } #endif - + } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Extensions/TaskExtensions.cs b/msbuild/Xamarin.MacDev.Tasks/Extensions/TaskExtensions.cs index cacc251ee0..9cf5682353 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Extensions/TaskExtensions.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Extensions/TaskExtensions.cs @@ -1,10 +1,8 @@ using System; using Microsoft.Build.Utilities; -namespace Microsoft.Build.Tasks -{ - public static class TaskExtensions - { +namespace Microsoft.Build.Tasks { + public static class TaskExtensions { public static bool ShouldExecuteRemotely (this Task task, string sessionId) => Environment.OSVersion.Platform == PlatformID.Win32NT && !string.IsNullOrEmpty (sessionId); } diff --git a/msbuild/Xamarin.MacDev.Tasks/LinkTarget.cs b/msbuild/Xamarin.MacDev.Tasks/LinkTarget.cs index 00705d26c9..9c96767408 100644 --- a/msbuild/Xamarin.MacDev.Tasks/LinkTarget.cs +++ b/msbuild/Xamarin.MacDev.Tasks/LinkTarget.cs @@ -1,17 +1,16 @@ using System; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { [Flags] enum LinkTarget { - Simulator = 1, + Simulator = 1, i386 = Simulator, - ArmV6 = 2, - ArmV7 = 4, - Thumb = 8, - ArmV7s = 16, - Arm64 = 32, - Simulator64 = 64, + ArmV6 = 2, + ArmV7 = 4, + Thumb = 8, + ArmV7s = 16, + Arm64 = 32, + Simulator64 = 64, x86_64 = Simulator64 } } diff --git a/msbuild/Xamarin.MacDev.Tasks/LinkerOptions.cs b/msbuild/Xamarin.MacDev.Tasks/LinkerOptions.cs index c48006ee8c..601170df34 100644 --- a/msbuild/Xamarin.MacDev.Tasks/LinkerOptions.cs +++ b/msbuild/Xamarin.MacDev.Tasks/LinkerOptions.cs @@ -21,7 +21,7 @@ namespace Xamarin.MacDev.Tasks { Frameworks = new HashSet (); } - public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem[] NativeReferences) + public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem [] NativeReferences) { if (NativeReferences == null) return; diff --git a/msbuild/Xamarin.MacDev.Tasks/LoggingExtensions.cs b/msbuild/Xamarin.MacDev.Tasks/LoggingExtensions.cs index bd59961e85..812bd19d38 100644 --- a/msbuild/Xamarin.MacDev.Tasks/LoggingExtensions.cs +++ b/msbuild/Xamarin.MacDev.Tasks/LoggingExtensions.cs @@ -4,10 +4,8 @@ using System.Collections.Generic; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -namespace Xamarin.MacDev.Tasks -{ - public static class LoggingExtensions - { +namespace Xamarin.MacDev.Tasks { + public static class LoggingExtensions { const MessageImportance TaskPropertyImportance = MessageImportance.Normal; internal static readonly string ErrorPrefix; @@ -25,7 +23,7 @@ namespace Xamarin.MacDev.Tasks } } - public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem[] items) + public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem [] items) { if (items == null) { log.LogMessage (TaskPropertyImportance, " {0}: ", propertyName); @@ -35,7 +33,7 @@ namespace Xamarin.MacDev.Tasks log.LogMessage (TaskPropertyImportance, " {0}:", propertyName); for (int i = 0; i < items.Length; i++) - log.LogMessage (TaskPropertyImportance, " {0}", items[i].ItemSpec); + log.LogMessage (TaskPropertyImportance, " {0}", items [i].ItemSpec); } public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem item) @@ -46,7 +44,7 @@ namespace Xamarin.MacDev.Tasks log.LogMessage (TaskPropertyImportance, " {0}: ", propertyName); } - public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string[] items) + public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string [] items) { if (items == null) { log.LogMessage (TaskPropertyImportance, " {0}: ", propertyName); @@ -56,7 +54,7 @@ namespace Xamarin.MacDev.Tasks log.LogMessage (TaskPropertyImportance, " {0}:", propertyName); for (int i = 0; i < items.Length; i++) - log.LogMessage (TaskPropertyImportance, " {0}", items[i]); + log.LogMessage (TaskPropertyImportance, " {0}", items [i]); } public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string value) @@ -81,12 +79,12 @@ namespace Xamarin.MacDev.Tasks /// In the 7xxx range for MSBuild error. /// The error's message to be displayed in the error pad. /// Path to the known guilty file or null. - public static void LogError (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object[] args) + public static void LogError (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object [] args) { log.LogError (null, $"{ErrorPrefix}{errorCode}", null, fileName ?? "MSBuild", 0, 0, 0, 0, message, args); } - public static void LogWarning (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object[] args) + public static void LogWarning (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object [] args) { log.LogWarning (null, $"{ErrorPrefix}{errorCode}", null, fileName ?? "MSBuild", 0, 0, 0, 0, message, args); } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Copy.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Copy.cs index b46ca5ccae..1fbe942281 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Copy.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Copy.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class Copy : CopyBase - { +namespace Microsoft.Build.Tasks { + public class Copy : CopyBase { public override bool Execute () { if (!this.ShouldExecuteRemotely (SessionId)) diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/CopyBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/CopyBase.cs index d933ad2513..d66c0a481d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/CopyBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/CopyBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class CopyBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Copy - { +namespace Microsoft.Build.Tasks { + public abstract class CopyBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Copy { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Delete.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Delete.cs index 2951a157ca..2c8131af4d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Delete.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Delete.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class Delete : DeleteBase - { +namespace Microsoft.Build.Tasks { + public class Delete : DeleteBase { public override bool Execute () { var result = base.Execute (); diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/DeleteBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/DeleteBase.cs index fcc38d961c..9626265aaa 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/DeleteBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/DeleteBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class DeleteBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Delete - { +namespace Microsoft.Build.Tasks { + public abstract class DeleteBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Delete { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Exec.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Exec.cs index f2c57c25c1..f46a337781 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Exec.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Exec.cs @@ -7,10 +7,8 @@ using Xamarin.Messaging.Build.Client; using System.Security; using System.Reactive.Linq; -namespace Microsoft.Build.Tasks -{ - public class Exec : ExecBase, ITaskCallback - { +namespace Microsoft.Build.Tasks { + public class Exec : ExecBase, ITaskCallback { public string ServerPassword { get; set; } public override bool Execute () diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/ExecBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/ExecBase.cs index bfbc72d3d7..913eef8e4c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/ExecBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/ExecBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class ExecBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Exec - { +namespace Microsoft.Build.Tasks { + public abstract class ExecBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Exec { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDir.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDir.cs index 11bc4a9dd8..7dfe0f1c5f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDir.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDir.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class MakeDir : MakeDirBase, ITaskCallback - { +namespace Microsoft.Build.Tasks { + public class MakeDir : MakeDirBase, ITaskCallback { public override bool Execute () { var result = base.Execute (); diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDirBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDirBase.cs index d297703280..3017051515 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDirBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MakeDirBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class MakeDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.MakeDir - { +namespace Microsoft.Build.Tasks { + public abstract class MakeDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.MakeDir { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Move.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Move.cs index 13fa3a2482..d0f9c615cf 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Move.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Move.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class Move : MoveTaskBase, ITaskCallback - { +namespace Microsoft.Build.Tasks { + public class Move : MoveTaskBase, ITaskCallback { public override bool Execute () { if (this.ShouldExecuteRemotely (SessionId)) diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MoveTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MoveTaskBase.cs index 8e15a96652..38143ab6af 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MoveTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/MoveTaskBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class MoveTaskBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Move - { +namespace Microsoft.Build.Tasks { + public abstract class MoveTaskBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Move { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDir.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDir.cs index 9cd8a303d1..4c08c459f5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDir.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDir.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class RemoveDir : RemoveDirBase - { +namespace Microsoft.Build.Tasks { + public class RemoveDir : RemoveDirBase { public bool RemoveAppDir { get; set; } public override bool Execute () diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDirBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDirBase.cs index c708719260..4390fdab15 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDirBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/RemoveDirBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class RemoveDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.RemoveDir - { +namespace Microsoft.Build.Tasks { + public abstract class RemoveDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.RemoveDir { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Touch.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Touch.cs index d94ffe7640..e9b9b2c168 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Touch.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/Touch.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class Touch : TouchBase, ITaskCallback - { +namespace Microsoft.Build.Tasks { + public class Touch : TouchBase, ITaskCallback { public override bool Execute () { bool result; diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/TouchBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/TouchBase.cs index 266f7ca28e..3cb8335b88 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/TouchBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/TouchBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class TouchBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Touch - { +namespace Microsoft.Build.Tasks { + public abstract class TouchBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Touch { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFile.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFile.cs index b4ee6190d4..0ff86f3de5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFile.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Microsoft.Build.Tasks -{ - public class WriteLinesToFile : WriteLinesToFileBase - { +namespace Microsoft.Build.Tasks { + public class WriteLinesToFile : WriteLinesToFileBase { public override bool Execute () { if (this.ShouldExecuteRemotely (SessionId)) diff --git a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFileBase.cs b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFileBase.cs index 0eb97c2b64..d01f6afb0b 100644 --- a/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFileBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFileBase.cs @@ -1,9 +1,7 @@ extern alias Microsoft_Build_Tasks_Core; -namespace Microsoft.Build.Tasks -{ - public abstract class WriteLinesToFileBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.WriteLinesToFile - { +namespace Microsoft.Build.Tasks { + public abstract class WriteLinesToFileBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.WriteLinesToFile { public string SessionId { get; set; } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/NativeReferenceKind.cs b/msbuild/Xamarin.MacDev.Tasks/NativeReferenceKind.cs index 9eea87a917..aeb03c57c2 100644 --- a/msbuild/Xamarin.MacDev.Tasks/NativeReferenceKind.cs +++ b/msbuild/Xamarin.MacDev.Tasks/NativeReferenceKind.cs @@ -1,5 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public enum NativeReferenceKind { Static, Dynamic, diff --git a/msbuild/Xamarin.MacDev.Tasks/PlatformFramework.cs b/msbuild/Xamarin.MacDev.Tasks/PlatformFramework.cs index f68e20ed40..655da7e943 100644 --- a/msbuild/Xamarin.MacDev.Tasks/PlatformFramework.cs +++ b/msbuild/Xamarin.MacDev.Tasks/PlatformFramework.cs @@ -29,10 +29,8 @@ using System.IO; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public static class PlatformFrameworkHelper - { +namespace Xamarin.MacDev.Tasks { + public static class PlatformFrameworkHelper { public static ApplePlatform GetFramework (string targetFrameworkMoniker) { return TargetFramework.Parse (targetFrameworkMoniker).Platform; diff --git a/msbuild/Xamarin.MacDev.Tasks/PlatformUtils.cs b/msbuild/Xamarin.MacDev.Tasks/PlatformUtils.cs index 618c616462..f9e70fa4d8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/PlatformUtils.cs +++ b/msbuild/Xamarin.MacDev.Tasks/PlatformUtils.cs @@ -1,7 +1,5 @@ -namespace Xamarin.MacDev.Tasks -{ - public static class PlatformUtils - { +namespace Xamarin.MacDev.Tasks { + public static class PlatformUtils { public static string GetTargetPlatform (string sdkPlatform, bool isWatchApp) { switch (sdkPlatform) { diff --git a/msbuild/Xamarin.MacDev.Tasks/StringParserService.cs b/msbuild/Xamarin.MacDev.Tasks/StringParserService.cs index 1c95af3858..345383043f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/StringParserService.cs +++ b/msbuild/Xamarin.MacDev.Tasks/StringParserService.cs @@ -2,31 +2,29 @@ using System; using System.Text; using System.Collections.Generic; -namespace Xamarin.MacDev -{ - public static class StringParserService - { +namespace Xamarin.MacDev { + public static class StringParserService { public static string Parse (string text, IDictionary tags) { var builder = new StringBuilder (); for (int i = 0; i < text.Length; i++) { - if (text[i] != '$' || i + 1 >= text.Length) { - builder.Append (text[i]); + if (text [i] != '$' || i + 1 >= text.Length) { + builder.Append (text [i]); continue; } i++; - if ((text[i] == '(' || text[i] == '{') && i + 2 < text.Length) { + if ((text [i] == '(' || text [i] == '{') && i + 2 < text.Length) { char open = text [i]; char close = open == '(' ? ')' : '}'; int startIndex = ++i; - while (i < text.Length && text[i] != close) + while (i < text.Length && text [i] != close) i++; - if (text[i] != close) { + if (text [i] != close) { builder.Append ('$').Append (open); i = startIndex - 1; continue; @@ -41,7 +39,7 @@ namespace Xamarin.MacDev builder.Append (value); } } else { - builder.Append ('$').Append (text[i]); + builder.Append ('$').Append (text [i]); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs index 483bd1df8c..bdd74b80b0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs @@ -3,8 +3,7 @@ using Xamarin.MacDev.Tasks; using Xamarin.Messaging.Build.Client; namespace Xamarin.MacDev.Tasks { - public class ACTool : ACToolTaskBase, ICancelableTask - { + public class ACTool : ACToolTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACToolTaskBase.cs index 74d6712151..1e0203ee9e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACToolTaskBase.cs @@ -10,10 +10,8 @@ using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ACToolTaskBase : XcodeCompilerToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ACToolTaskBase : XcodeCompilerToolTask { ITaskItem partialAppManifest; string outputSpecs; @@ -26,7 +24,7 @@ namespace Xamarin.MacDev.Tasks public bool EnableOnDemandResources { get; set; } [Required] - public ITaskItem[] ImageAssets { get; set; } + public ITaskItem [] ImageAssets { get; set; } public bool IsWatchApp { get; set; } @@ -59,7 +57,7 @@ namespace Xamarin.MacDev.Tasks } } - protected override void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem[] items) + protected override void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem [] items) { var assetDirs = new HashSet (items.Select (x => BundleResource.GetVirtualProjectPath (ProjectDir, x, !string.IsNullOrEmpty (SessionId)))); @@ -137,7 +135,7 @@ namespace Xamarin.MacDev.Tasks if (Platform == ApplePlatform.MacCatalyst) { args.Add ("--ui-framework-family"); args.Add ("uikit"); - } + } foreach (var targetDevice in GetTargetDevices ()) args.Add ("--target-device", targetDevice); @@ -203,7 +201,7 @@ namespace Xamarin.MacDev.Tasks var specs = new PArray (); for (int i = 0; i < ImageAssets.Length; i++) { - var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets[i], !string.IsNullOrEmpty (SessionId)); + var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets [i], !string.IsNullOrEmpty (SessionId)); // Ignore MacOS .DS_Store files... if (Path.GetFileName (vpath).Equals (".DS_Store", StringComparison.OrdinalIgnoreCase)) @@ -217,11 +215,11 @@ namespace Xamarin.MacDev.Tasks catalog = Path.GetDirectoryName (catalog); if (string.IsNullOrEmpty (catalog)) { - Log.LogWarning (null, null, null, ImageAssets[i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0090, ImageAssets[i].ItemSpec); + Log.LogWarning (null, null, null, ImageAssets [i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0090, ImageAssets [i].ItemSpec); continue; } - if (ImageAssets[i].GetMetadata ("Link") != null) { + if (ImageAssets [i].GetMetadata ("Link") != null) { // Note: if any of the files within a catalog are linked, we'll have to clone the *entire* catalog clones.Add (catalog); continue; @@ -231,7 +229,7 @@ namespace Xamarin.MacDev.Tasks if (Path.GetFileName (vpath) != "Contents.json") continue; - items.Add (ImageAssets[i]); + items.Add (ImageAssets [i]); } // clone any *.xcassets dirs that need cloning @@ -244,7 +242,7 @@ namespace Xamarin.MacDev.Tasks items.Clear (); for (int i = 0; i < ImageAssets.Length; i++) { - var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets[i], !string.IsNullOrEmpty (SessionId)); + var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets [i], !string.IsNullOrEmpty (SessionId)); var clone = false; ITaskItem item; @@ -253,14 +251,14 @@ namespace Xamarin.MacDev.Tasks continue; foreach (var catalog in clones) { - if (vpath.Length > catalog.Length && vpath[catalog.Length] == '/' && vpath.StartsWith (catalog, StringComparison.Ordinal)) { + if (vpath.Length > catalog.Length && vpath [catalog.Length] == '/' && vpath.StartsWith (catalog, StringComparison.Ordinal)) { clone = true; break; } } if (clone) { - var src = ImageAssets[i].GetMetadata ("FullPath"); + var src = ImageAssets [i].GetMetadata ("FullPath"); if (!File.Exists (src)) { Log.LogError (null, null, null, src, 0, 0, 0, 0, MSBStrings.E0091, src); @@ -279,14 +277,14 @@ namespace Xamarin.MacDev.Tasks continue; item = new TaskItem (dest); - ImageAssets[i].CopyMetadataTo (item); + ImageAssets [i].CopyMetadataTo (item); item.SetMetadata ("Link", vpath); } else { // filter out everything except paths containing a Contents.json file since our main processing loop only cares about these if (Path.GetFileName (vpath) != "Contents.json") continue; - item = ImageAssets[i]; + item = ImageAssets [i]; } items.Add (item); @@ -295,8 +293,8 @@ namespace Xamarin.MacDev.Tasks // Note: `items` contains only the Contents.json files at this point for (int i = 0; i < items.Count; i++) { - var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, items[i], !string.IsNullOrEmpty (SessionId)); - var path = items[i].GetMetadata ("FullPath"); + var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, items [i], !string.IsNullOrEmpty (SessionId)); + var path = items [i].GetMetadata ("FullPath"); // get the parent (which will typically be .appiconset, .launchimage, .imageset, .iconset, etc) var catalog = Path.GetDirectoryName (vpath); @@ -316,7 +314,7 @@ namespace Xamarin.MacDev.Tasks } if (AppleSdkSettings.XcodeVersion.Major >= 7 && SdkPlatform != "WatchSimulator") { - var text = File.ReadAllText (items[i].ItemSpec); + var text = File.ReadAllText (items [i].ItemSpec); if (string.IsNullOrEmpty (text)) continue; @@ -335,7 +333,7 @@ namespace Xamarin.MacDev.Tasks Log.LogError (null, null, null, items [i].ItemSpec, line, col, line, col, "{0}", je.Message); return false; } catch (Exception e) { - Log.LogError (null, null, null, items[i].ItemSpec, 0, 0, 0, 0, MSBStrings.E0092, e.Message); + Log.LogError (null, null, null, items [i].ItemSpec, 0, 0, 0, 0, MSBStrings.E0092, e.Message); return false; } @@ -369,7 +367,7 @@ namespace Xamarin.MacDev.Tasks Directory.CreateDirectory (assetDir); for (int j = 0; j < tagList.Count; j++) - ptags.Add (new PString (tagList[j])); + ptags.Add (new PString (tagList [j])); assetpack.Add ("bundle-id", new PString (string.Format ("{0}.asset-pack-{1}", BundleIdentifier, hash))); assetpack.Add ("bundle-path", new PString (Path.GetFullPath (assetDir))); @@ -403,7 +401,7 @@ namespace Xamarin.MacDev.Tasks try { var manifestOutput = PDictionary.FromFile (manifest.ItemSpec); - LogWarningsAndErrors (manifestOutput, catalogs[0]); + LogWarningsAndErrors (manifestOutput, catalogs [0]); bundleResources.AddRange (GetCompiledBundleResources (manifestOutput, intermediateBundleDir)); outputManifests.Add (manifest); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolUpload.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolUpload.cs index e47f8f79e2..2f9de0f088 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolUpload.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolUpload.cs @@ -1,15 +1,13 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ALToolUpload : ALToolTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class ALToolUpload : ALToolTaskBase, ICancelableTask { protected override string ALToolAction => "--upload-app"; public override bool Execute () { - if (ShouldExecuteRemotely()) + if (ShouldExecuteRemotely ()) return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; return base.Execute (); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolValidate.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolValidate.cs index 0e28a5ce62..36448f2a48 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolValidate.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ALToolValidate.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ALToolValidate : ALToolTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class ALToolValidate : ALToolTaskBase, ICancelableTask { protected override string ALToolAction => "--validate-app"; public override bool Execute () diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs index c9c806bc84..6cbeb704a9 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompile.cs @@ -4,10 +4,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class AOTCompile : AOTCompileTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class AOTCompile : AOTCompileTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs index 5d1cbc867a..beb864411e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/AOTCompileTaskBase.cs @@ -34,13 +34,13 @@ namespace Xamarin.MacDev.Tasks { [Required] public string SdkDevPath { get; set; } = string.Empty; -#region Output + #region Output [Output] - public ITaskItem[]? AssemblyFiles { get; set; } + public ITaskItem []? AssemblyFiles { get; set; } [Output] - public ITaskItem[]? FileWrites { get; set; } -#endregion + public ITaskItem []? FileWrites { get; set; } + #endregion public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/AlToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/AlToolTaskBase.cs index 94fe250719..2d8d8a4702 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/AlToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/AlToolTaskBase.cs @@ -8,18 +8,16 @@ using System.Text; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ALToolTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ALToolTaskBase : XamarinToolTask { string sdkDevPath; StringBuilder toolOutput; [Required] - public string Username { get ; set; } + public string Username { get; set; } [Required] - public string Password { get ; set; } + public string Password { get; set; } [Required] public string FilePath { get; set; } @@ -91,10 +89,10 @@ namespace Xamarin.MacDev.Tasks string GetFileTypeValue () { switch (Platform) { - case ApplePlatform.MacOSX: return "osx"; - case ApplePlatform.TVOS: return "appletvos"; - case ApplePlatform.iOS: return "ios"; - default: throw new NotSupportedException ($"Provided file type '{Platform}' is not supported by altool"); + case ApplePlatform.MacOSX: return "osx"; + case ApplePlatform.TVOS: return "appletvos"; + case ApplePlatform.iOS: return "ios"; + default: throw new NotSupportedException ($"Provided file type '{Platform}' is not supported by altool"); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArTool.cs index 072fb1d4d9..0eec156e29 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArTool.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ArTool : ArToolTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class ArTool : ArToolTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArToolTaskBase.cs index e7a1a81505..20bc1f65f4 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArToolTaskBase.cs @@ -6,17 +6,15 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ArToolTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ArToolTaskBase : XamarinToolTask { #region Inputs [Required] public ITaskItem Archive { get; set; } [Required] - public ITaskItem[] Items { get; set; } + public ITaskItem [] Items { get; set; } #endregion diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs index 8e8431ecda..f86619e32a 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Archive.cs @@ -2,16 +2,14 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; using Xamarin.iOS.Tasks; -namespace Xamarin.MacDev.Tasks -{ - public class Archive : ArchiveTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class Archive : ArchiveTaskBase, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) return base.Execute (); - if (AppExtensionReferences != null) + if (AppExtensionReferences != null) TaskItemFixer.ReplaceItemSpecsWithBuildServerPath (AppExtensionReferences, SessionId); return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArchiveTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArchiveTaskBase.cs index 3b18165c4d..e92e103c0d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ArchiveTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ArchiveTaskBase.cs @@ -10,10 +10,8 @@ using System.Globalization; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ArchiveTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ArchiveTaskBase : XamarinTask { protected readonly DateTime Now = DateTime.Now; #region Inputs diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouch.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouch.cs index 467c221633..5b54babed5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouch.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouch.cs @@ -12,10 +12,8 @@ using Xamarin.iOS.Tasks; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public class BTouch : BTouchTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class BTouch : BTouchTaskBase, ITaskCallback { public override bool Execute () { if (!ShouldExecuteRemotely ()) @@ -61,7 +59,7 @@ namespace Xamarin.MacDev.Tasks { base.Cancel (); - if (!string.IsNullOrEmpty(SessionId)) + if (!string.IsNullOrEmpty (SessionId)) BuildConnection.CancelAsync (SessionId, BuildEngine4).Wait (); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouchTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouchTaskBase.cs index e9cb3f1d76..11e8ccb7a0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouchTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/BTouchTaskBase.cs @@ -25,9 +25,9 @@ namespace Xamarin.MacDev.Tasks { public string DotNetCscCompiler { get; set; } - public ITaskItem[] ObjectiveCLibraries { get; set; } + public ITaskItem [] ObjectiveCLibraries { get; set; } - public ITaskItem[] AdditionalLibPaths { get; set; } + public ITaskItem [] AdditionalLibPaths { get; set; } public bool AllowUnsafeBlocks { get; set; } @@ -35,11 +35,11 @@ namespace Xamarin.MacDev.Tasks { public string BaseLibDll { get; set; } [Required] - public ITaskItem[] ApiDefinitions { get; set; } + public ITaskItem [] ApiDefinitions { get; set; } public string AttributeAssembly { get; set; } - public ITaskItem[] CoreSources { get; set; } + public ITaskItem [] CoreSources { get; set; } public string DefineConstants { get; set; } @@ -57,7 +57,7 @@ namespace Xamarin.MacDev.Tasks { public bool NoNFloatUsing { get; set; } - public ITaskItem[] NativeLibraries { get; set; } + public ITaskItem [] NativeLibraries { get; set; } public string OutputAssembly { get; set; } @@ -66,11 +66,11 @@ namespace Xamarin.MacDev.Tasks { [Required] public string ProjectDir { get; set; } - public ITaskItem[] References { get; set; } + public ITaskItem [] References { get; set; } - public ITaskItem[] Resources { get; set; } + public ITaskItem [] Resources { get; set; } - public ITaskItem[] Sources { get; set; } + public ITaskItem [] Sources { get; set; } [Required] public string ResponseFilePath { get; set; } @@ -119,9 +119,9 @@ namespace Xamarin.MacDev.Tasks { { var cmd = new CommandLineArgumentBuilder (); - #if DEBUG +#if DEBUG cmd.Add ("/v"); - #endif +#endif cmd.Add ("/nostdlib"); cmd.AddQuotedSwitchIfNotNull ("/baselib:", BaseLibDll); @@ -246,7 +246,7 @@ namespace Xamarin.MacDev.Tasks { } for (int i = 0; i < extraArgs.Length; i++) { - var argument = extraArgs[i]; + var argument = extraArgs [i]; cmd.Add (StringParserService.Parse (argument, customTags)); } } @@ -271,7 +271,7 @@ namespace Xamarin.MacDev.Tasks { if (IsDotNet) { var customHome = Environment.GetEnvironmentVariable ("DOTNET_CUSTOM_HOME"); - if(!string.IsNullOrEmpty(customHome)) { + if (!string.IsNullOrEmpty (customHome)) { EnvironmentVariables = EnvironmentVariables.CopyAndAdd ($"HOME={customHome}"); } } else { @@ -280,8 +280,8 @@ namespace Xamarin.MacDev.Tasks { } if (!string.IsNullOrEmpty (SessionId) && - !string.IsNullOrEmpty (GeneratedSourcesDir) && - !Directory.Exists (GeneratedSourcesDir)) { + !string.IsNullOrEmpty (GeneratedSourcesDir) && + !Directory.Exists (GeneratedSourcesDir)) { Directory.CreateDirectory (GeneratedSourcesDir); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Codesign.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Codesign.cs index 334a0711aa..74931d23d8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Codesign.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Codesign.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class Codesign : CodesignTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class Codesign : CodesignTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignTaskBase.cs index aa30cf7221..a8d6698cfe 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignTaskBase.cs @@ -11,10 +11,8 @@ using System.Collections.Generic; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CodesignTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CodesignTaskBase : XamarinTask { const string ToolName = "codesign"; const string MacOSDirName = "MacOS"; const string CodeSignatureDirName = "_CodeSignature"; @@ -38,7 +36,7 @@ namespace Xamarin.MacDev.Tasks public string Keychain { get; set; } [Required] - public ITaskItem[] Resources { get; set; } + public ITaskItem [] Resources { get; set; } // Can also be specified per resource using the 'CodesignResourceRules' metadata public string ResourceRules { get; set; } @@ -72,7 +70,7 @@ namespace Xamarin.MacDev.Tasks // This output value is not observed anywhere in our targets, but it's required for building on Windows // to make sure any codesigned files other tasks depend on are copied back to the windows machine. [Output] - public ITaskItem[] CodesignedFiles { get; set; } + public ITaskItem [] CodesignedFiles { get; set; } #endregion @@ -99,7 +97,7 @@ namespace Xamarin.MacDev.Tasks } // 'sortedItems' is sorted by length of path, longest first. - bool NeedsCodesign (ITaskItem[] sortedItems, int index) + bool NeedsCodesign (ITaskItem [] sortedItems, int index) { var item = sortedItems [index]; var stampFile = GetCodesignStampFile (item); @@ -249,7 +247,7 @@ namespace Xamarin.MacDev.Tasks // and `Current` also a symlink to `A`... and `_CodeSignature` will be found there var path = item.ItemSpec; var parent = Path.GetDirectoryName (path); - + // so do not don't sign `A.framework/A`, sign `A.framework` which will always sign the *bundle* if ((Path.GetExtension (parent) == ".framework") && (Path.GetFileName (path) == Path.GetFileNameWithoutExtension (parent))) path = parent; @@ -270,7 +268,7 @@ namespace Xamarin.MacDev.Tasks var rv = ExecuteAsync (fileName, arguments, null, environment, mergeOutput: false).Result; var exitCode = rv.ExitCode; var messages = rv.StandardOutput.ToString (); - + if (messages.Length > 0) Log.LogMessage (MessageImportance.Normal, "{0}", messages.ToString ()); @@ -508,10 +506,10 @@ namespace Xamarin.MacDev.Tasks var executableName = Path.GetFileName (item.ItemSpec); var manifestPath = Path.Combine (item.ItemSpec, "Info.plist"); - if (File.Exists(manifestPath)) { + if (File.Exists (manifestPath)) { var bundleExecutable = PDictionary.FromFile (manifestPath).GetCFBundleExecutable (); - if (!string.IsNullOrEmpty(bundleExecutable)) + if (!string.IsNullOrEmpty (bundleExecutable)) executableName = bundleExecutable; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerify.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerify.cs index d2160b289a..75fa3891ba 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerify.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerify.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CodesignVerify : CodesignVerifyTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class CodesignVerify : CodesignVerifyTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerifyTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerifyTaskBase.cs index 561e251083..ff0d3ac8e4 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerifyTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CodesignVerifyTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Framework; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CodesignVerifyTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CodesignVerifyTaskBase : XamarinToolTask { #region Inputs [Required] @@ -68,7 +66,7 @@ namespace Xamarin.MacDev.Tasks public override bool Execute () { - EnvironmentVariables = new string[] { + EnvironmentVariables = new string [] { "CODESIGN_ALLOCATE=" + CodesignAllocate }; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResources.cs index 1e780a60bb..9695cd1767 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResources.cs @@ -2,10 +2,8 @@ using System; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CollectBundleResources : CollectBundleResourcesTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CollectBundleResources : CollectBundleResourcesTaskBase, ICancelableTask { public override bool Execute () { try { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResourcesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResourcesTaskBase.cs index 231afa295d..cfb46df415 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResourcesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CollectBundleResourcesTaskBase.cs @@ -6,13 +6,11 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CollectBundleResourcesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CollectBundleResourcesTaskBase : XamarinTask { #region Inputs - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } public bool OptimizePropertyLists { get; set; } @@ -29,7 +27,7 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] BundleResourcesWithLogicalNames { get; set; } + public ITaskItem [] BundleResourcesWithLogicalNames { get; set; } #endregion @@ -53,7 +51,7 @@ namespace Xamarin.MacDev.Tasks if (!string.IsNullOrEmpty (publishFolderType)) continue; - var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty(SessionId)); + var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty (SessionId)); // We need a physical path here, ignore the Link element var path = item.GetMetadata ("FullPath"); string illegal; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs index a9555471c0..87aba60c01 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs @@ -6,10 +6,8 @@ using Xamarin.Messaging.Build.Client; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public class CompileAppManifest : CompileAppManifestTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CompileAppManifest : CompileAppManifestTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifestTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifestTaskBase.cs index 41922d2e86..b73061df9a 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifestTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifestTaskBase.cs @@ -11,10 +11,8 @@ using Xamarin.Utils; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public abstract class CompileAppManifestTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CompileAppManifestTaskBase : XamarinTask { #region Inputs // Single-project property that maps to CFBundleIdentifier for Apple platforms @@ -313,7 +311,7 @@ namespace Xamarin.MacDev.Tasks } } - protected void LogAppManifestError (string format, params object[] args) + protected void LogAppManifestError (string format, params object [] args) { // Log an error linking to the Info.plist file if (AppManifest is not null) { @@ -324,7 +322,7 @@ namespace Xamarin.MacDev.Tasks } - protected void LogAppManifestWarning (string format, params object[] args) + protected void LogAppManifestWarning (string format, params object [] args) { // Log a warning linking to the Info.plist file if (AppManifest is not null) { @@ -342,22 +340,22 @@ namespace Xamarin.MacDev.Tasks if (string.IsNullOrEmpty (value)) LogAppManifestWarning (MSBStrings.W0106, key); else - dict[key] = value; + dict [key] = value; } public static void MergePartialPlistDictionary (PDictionary plist, PDictionary partial) { foreach (var property in partial) { if (plist.ContainsKey (property.Key)) { - var value = plist[property.Key]; + var value = plist [property.Key]; if (value is PDictionary && property.Value is PDictionary) { MergePartialPlistDictionary ((PDictionary) value, (PDictionary) property.Value); } else { - plist[property.Key] = property.Value.Clone (); + plist [property.Key] = property.Value.Clone (); } } else { - plist[property.Key] = property.Value.Clone (); + plist [property.Key] = property.Value.Clone (); } } } @@ -404,14 +402,14 @@ namespace Xamarin.MacDev.Tasks string miniOSVersion = "?"; if (MacCatalystSupport.TryGetiOSVersion (Sdks.GetAppleSdk (Platform).GetSdkPath (SdkVersion, false), minimumOSVersion, out var iOSVersion, out var _)) miniOSVersion = iOSVersion?.ToString () ?? "?"; - LogAppManifestError (MSBStrings.E7099 /* The UIDeviceFamily value '6' requires macOS 11.0. Please set the 'SupportedOSPlatformVersion' in the project file to at least 14.0 (the Mac Catalyst version equivalent of macOS 11.0). The current value is {0} (equivalent to macOS {1}). */, miniOSVersion, minimumOSVersion); + LogAppManifestError (MSBStrings.E7099 /* The UIDeviceFamily value '6' requires macOS 11.0. Please set the 'SupportedOSPlatformVersion' in the project file to at least 14.0 (the Mac Catalyst version equivalent of macOS 11.0). The current value is {0} (equivalent to macOS {1}). */, miniOSVersion, minimumOSVersion); } } switch (Platform) { case ApplePlatform.iOS: var supportsIPhone = (supportedDevices & IPhoneDeviceType.IPhone) != 0 - || supportedDevices == IPhoneDeviceType.NotSet; + || supportedDevices == IPhoneDeviceType.NotSet; var supportsIPad = (supportedDevices & IPhoneDeviceType.IPad) != 0; if (!IsAppExtension) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlementsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlementsTaskBase.cs index 798cd13527..6018e4c201 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlementsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlementsTaskBase.cs @@ -9,10 +9,8 @@ using Xamarin.Utils; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public abstract class CompileEntitlementsTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CompileEntitlementsTaskBase : XamarinTask { bool warnedTeamIdentifierPrefix; bool warnedAppIdentifierPrefix; @@ -59,7 +57,7 @@ namespace Xamarin.MacDev.Tasks [Required] public ITaskItem? CompiledEntitlements { get; set; } - public ITaskItem[] CustomEntitlements { get; set; } = Array.Empty (); + public ITaskItem [] CustomEntitlements { get; set; } = Array.Empty (); public bool Debug { get; set; } @@ -156,7 +154,7 @@ namespace Xamarin.MacDev.Tasks Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0108); warnedTeamIdentifierPrefix = true; } - + if (!warnedAppIdentifierPrefix && pstr.Value.Contains ("$(AppIdentifierPrefix)")) { Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0109); warnedAppIdentifierPrefix = true; @@ -164,12 +162,12 @@ namespace Xamarin.MacDev.Tasks } if (profile is not null && profile.ApplicationIdentifierPrefix.Count > 0) - AppIdentifierPrefix = profile.ApplicationIdentifierPrefix[0] + "."; + AppIdentifierPrefix = profile.ApplicationIdentifierPrefix [0] + "."; else AppIdentifierPrefix = string.Empty; if (profile is not null && profile.TeamIdentifierPrefix.Count > 0) - TeamIdentifierPrefix = profile.TeamIdentifierPrefix[0] + "."; + TeamIdentifierPrefix = profile.TeamIdentifierPrefix [0] + "."; else TeamIdentifierPrefix = AppIdentifierPrefix; @@ -297,7 +295,7 @@ namespace Xamarin.MacDev.Tasks var arraySeparator = item.GetMetadata ("ArraySeparator"); if (string.IsNullOrEmpty (arraySeparator)) arraySeparator = ";"; - var arrayContent = value.Split (new string[] { arraySeparator }, StringSplitOptions.None); + var arrayContent = value.Split (new string [] { arraySeparator }, StringSplitOptions.None); var parray = new PArray (); foreach (var element in arrayContent) parray.Add (new PString (element)); @@ -310,13 +308,13 @@ namespace Xamarin.MacDev.Tasks } } - static bool AreEqual (byte[] x, byte[] y) + static bool AreEqual (byte [] x, byte [] y) { if (x.Length != y.Length) return false; for (int i = 0; i < x.Length; i++) { - if (x[i] != y[i]) + if (x [i] != y [i]) return false; } @@ -380,9 +378,9 @@ namespace Xamarin.MacDev.Tasks var value = item.Value; if (item.Key == "com.apple.developer.ubiquity-container-identifiers" || - item.Key == "com.apple.developer.icloud-container-identifiers" || - item.Key == "com.apple.developer.icloud-container-environment" || - item.Key == "com.apple.developer.icloud-services") { + item.Key == "com.apple.developer.icloud-container-identifiers" || + item.Key == "com.apple.developer.icloud-container-environment" || + item.Key == "com.apple.developer.icloud-services") { if (profile is null) Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0110, item.Key); else if (!profile.Entitlements.ContainsKey (item.Key)) @@ -405,7 +403,7 @@ namespace Xamarin.MacDev.Tasks value = value.Clone (); if (value is not null) - entitlements[item.Key] = value; + entitlements [item.Key] = value; } switch (Platform) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCode.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCode.cs index b84d290114..5f8e1181ac 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCode.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCode.cs @@ -4,17 +4,14 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CompileNativeCode : CompileNativeCodeTaskBase, ICancelableTask, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class CompileNativeCode : CompileNativeCodeTaskBase, ICancelableTask, ITaskCallback { public override bool Execute () { if (!ShouldExecuteRemotely ()) return base.Execute (); - foreach (var info in CompileInfo) - { + foreach (var info in CompileInfo) { var outputFile = info.GetMetadata ("OutputFile"); if (!string.IsNullOrEmpty (outputFile)) @@ -31,11 +28,9 @@ namespace Xamarin.MacDev.Tasks public IEnumerable GetAdditionalItemsToBeCopied () { if (IncludeDirectories != null) { - foreach (var dir in IncludeDirectories) - { - foreach (var file in Directory.EnumerateFiles(dir.ItemSpec, "*.*", SearchOption.AllDirectories)) - { - yield return new TaskItem(file); + foreach (var dir in IncludeDirectories) { + foreach (var file in Directory.EnumerateFiles (dir.ItemSpec, "*.*", SearchOption.AllDirectories)) { + yield return new TaskItem (file); } } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCodeTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCodeTaskBase.cs index 0675498435..3af4d3ca5c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCodeTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCodeTaskBase.cs @@ -12,11 +12,11 @@ using Xamarin.Utils; namespace Xamarin.MacDev.Tasks { public abstract class CompileNativeCodeTaskBase : XamarinTask { -#region Inputs + #region Inputs [Required] public ITaskItem [] CompileInfo { get; set; } - public ITaskItem[] IncludeDirectories { get; set; } + public ITaskItem [] IncludeDirectories { get; set; } [Required] public string MinimumOSVersion { get; set; } @@ -29,7 +29,7 @@ namespace Xamarin.MacDev.Tasks { [Required] public bool SdkIsSimulator { get; set; } -#endregion + #endregion public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileProductDefinitionTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileProductDefinitionTaskBase.cs index ef873e05f3..4dbc6fda8e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileProductDefinitionTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileProductDefinitionTaskBase.cs @@ -56,7 +56,7 @@ namespace Xamarin.MacDev.Tasks { // productbuild can do a guess of the targeted architectures if not provided, but the guess // is very simple : on Catalina and lower, it will suppose it's x86_64 (even with an arm64 slice). - HashSet archStrings = new HashSet (architectures.ToArray ().Select (a => a.ToNativeArchitecture ())); + HashSet archStrings = new HashSet (architectures.ToArray ().Select (a => a.ToNativeArchitecture ())); if (plist.TryGetValue (ProductDefinitionKeys.Architectures, out PArray archArray)) { var existingArchs = archArray.ToStringArray (); if (!archStrings.SetEquals (existingArchs)) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs index fde08a0368..7223b8132f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CompileSceneKitAssets : CompileSceneKitAssetsTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CompileSceneKitAssets : CompileSceneKitAssetsTaskBase, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssetsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssetsTaskBase.cs index 3cabffed79..e50def49bd 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssetsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssetsTaskBase.cs @@ -11,10 +11,8 @@ using Xamarin.MacDev; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CompileSceneKitAssetsTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CompileSceneKitAssetsTaskBase : XamarinTask { string toolExe; #region Inputs @@ -34,7 +32,7 @@ namespace Xamarin.MacDev.Tasks public string ResourcePrefix { get; set; } [Required] - public ITaskItem[] SceneKitAssets { get; set; } + public ITaskItem [] SceneKitAssets { get; set; } [Required] public string SdkDevPath { get; set; } @@ -60,7 +58,7 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } #endregion @@ -138,7 +136,7 @@ namespace Xamarin.MacDev.Tasks asset.RemoveMetadata ("LogicalName"); - var bundleName = BundleResource.GetLogicalName (ProjectDir, prefixes, asset, !string.IsNullOrEmpty(SessionId)); + var bundleName = BundleResource.GetLogicalName (ProjectDir, prefixes, asset, !string.IsNullOrEmpty (SessionId)); var output = new TaskItem (Path.Combine (intermediate, bundleName)); if (!modified.Contains (scnassets) && (!File.Exists (output.ItemSpec) || File.GetLastWriteTimeUtc (asset.ItemSpec) > File.GetLastWriteTimeUtc (output.ItemSpec))) { @@ -190,7 +188,7 @@ namespace Xamarin.MacDev.Tasks var tasks = new List (); foreach (var item in items) { - var bundleDir = BundleResource.GetLogicalName (ProjectDir, prefixes, new TaskItem (item), !string.IsNullOrEmpty(SessionId)); + var bundleDir = BundleResource.GetLogicalName (ProjectDir, prefixes, new TaskItem (item), !string.IsNullOrEmpty (SessionId)); var output = Path.Combine (intermediate, bundleDir); tasks.Add (CopySceneKitAssets (item.ItemSpec, output, intermediate)); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleLocationTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleLocationTaskBase.cs index fcc35b7572..21da64e4d3 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleLocationTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleLocationTaskBase.cs @@ -57,7 +57,7 @@ namespace Xamarin.MacDev.Tasks { } } - void AddResourceFiles (ITaskItem[]? items) + void AddResourceFiles (ITaskItem []? items) { if (items is null || items.Length == 0) return; @@ -90,7 +90,7 @@ namespace Xamarin.MacDev.Tasks { var appleFrameworks = new Dictionary> (); var list = ResolvedFileToPublish.ToList (); foreach (var item in list.ToArray ()) { // iterate over a copy of the list, because we might modify the original list - // Compute the publish folder type if it's not specified + // Compute the publish folder type if it's not specified var publishFolderType = ParsePublishFolderType (item); if (publishFolderType == PublishFolderType.Unset) { publishFolderType = ComputePublishFolderType (list, item); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPaths.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPaths.cs index fb580f70b9..1d6ebff2f8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPaths.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPaths.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ComputeBundleResourceOutputPaths : ComputeBundleResourceOutputPathsTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class ComputeBundleResourceOutputPaths : ComputeBundleResourceOutputPathsTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPathsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPathsTaskBase.cs index b7c056aed2..2ff04b2554 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPathsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeBundleResourceOutputPathsTaskBase.cs @@ -7,17 +7,15 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ComputeBundleResourceOutputPathsTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ComputeBundleResourceOutputPathsTaskBase : XamarinTask { [Required] public ITaskItem AppResourcesPath { get; set; } [Required] public string BundleIdentifier { get; set; } - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } public bool EnableOnDemandResources { get; set; } @@ -28,7 +26,7 @@ namespace Xamarin.MacDev.Tasks public string OutputPath { get; set; } [Output] - public ITaskItem[] BundleResourcesWithOutputPaths { get; set; } + public ITaskItem [] BundleResourcesWithOutputPaths { get; set; } public override bool Execute () { @@ -57,7 +55,7 @@ namespace Xamarin.MacDev.Tasks var array = new PArray (); for (int i = 0; i < tags.Count; i++) - array.Add (new PString (tags[i])); + array.Add (new PString (tags [i])); plist.SetCFBundleIdentifier (BundleIdentifier + ".asset-pack-" + hash); plist.Add ("Tags", array); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItemsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItemsTaskBase.cs index 867d77ee09..ac6defbe87 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItemsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItemsTaskBase.cs @@ -49,9 +49,9 @@ namespace Xamarin.MacDev.Tasks { public ITaskItem [] NativeStripItems { get; set; } = Array.Empty (); [Output] - public ITaskItem[] OutputCodesignItems { get; set; } = Array.Empty (); + public ITaskItem [] OutputCodesignItems { get; set; } = Array.Empty (); - public ITaskItem[] SkipCodesignItems { get; set; } = Array.Empty (); + public ITaskItem [] SkipCodesignItems { get; set; } = Array.Empty (); public override bool Execute () { @@ -66,7 +66,7 @@ namespace Xamarin.MacDev.Tasks { // or a 'CodesignSigningKey' has been provided. var requireCodeSigning = bundle.GetMetadata ("RequireCodeSigning"); var codesignSigningKey = bundle.GetMetadata ("CodesignSigningKey"); - if (!string.Equals (requireCodeSigning, "true") && string.IsNullOrEmpty (codesignSigningKey)) + if (!string.Equals (requireCodeSigning, "true") && string.IsNullOrEmpty (codesignSigningKey)) continue; // Create a new item for the app bundle, and copy any metadata over. @@ -215,7 +215,7 @@ namespace Xamarin.MacDev.Tasks { var outputPath = Path.GetFullPath (item.ItemSpec); // item.ItemSpec is relative to the project directory outputPath = PathUtils.ResolveSymbolicLinks (outputPath); // Canonicalize - if (canonicalizedFilesToSkip.Contains (outputPath)) { + if (canonicalizedFilesToSkip.Contains (outputPath)) { Log.LogMessage (MessageImportance.Low, $"Not signing '{output [i].ItemSpec}' because it's in the list of files that skips signing"); output.RemoveAt (i); continue; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorProperties.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorProperties.cs index 8f950e3b8e..e6ad1af026 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorProperties.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorProperties.cs @@ -6,8 +6,7 @@ using Microsoft.Build.Framework; #nullable enable -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public class ComputeRemoteGeneratorProperties : ComputeRemoteGeneratorPropertiesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorPropertiesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorPropertiesTaskBase.cs index cb6e24a658..ac6f21bbdb 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorPropertiesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeRemoteGeneratorPropertiesTaskBase.cs @@ -92,7 +92,7 @@ namespace Xamarin.MacDev.Tasks { var arguments = new List (); var environment = default (Dictionary); - if (IsDotNet) { + if (IsDotNet) { executable = Environment.GetEnvironmentVariable ("DOTNET_HOST_PATH"); if (string.IsNullOrEmpty (executable)) executable = "dotnet"; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompiler.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompiler.cs index 85edb10f3a..6e253cbb1d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompiler.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompiler.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CoreMLCompiler : CoreMLCompilerTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CoreMLCompiler : CoreMLCompilerTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompilerTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompilerTaskBase.cs index 5c52330b45..80d074b0c2 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompilerTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CoreMLCompilerTaskBase.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CoreMLCompilerTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CoreMLCompilerTaskBase : XamarinTask { string toolExe; public string ToolName { get { return "coremlc"; } } @@ -23,7 +21,7 @@ namespace Xamarin.MacDev.Tasks public string IntermediateOutputPath { get; set; } [Required] - public ITaskItem[] Models { get; set; } + public ITaskItem [] Models { get; set; } [Required] public string ProjectDir { get; set; } @@ -49,10 +47,10 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } [Output] - public ITaskItem[] PartialAppManifests { get; set; } + public ITaskItem [] PartialAppManifests { get; set; } #endregion @@ -182,7 +180,7 @@ namespace Xamarin.MacDev.Tasks output.SetMetadata ("ResourceTags", resourceTags); var metadata = output.CloneCustomMetadata (); - mapping[outputPath + "/"] = metadata; + mapping [outputPath + "/"] = metadata; if (FileChanged (model, partialPlist)) { Directory.CreateDirectory (outputDir); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifest.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifest.cs index 4b4f52d022..4ab0c464ac 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifest.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifest.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CreateAssetPackManifest : CreateAssetPackManifestTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CreateAssetPackManifest : CreateAssetPackManifestTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifestTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifestTaskBase.cs index 8aa3455466..72dd14292d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifestTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateAssetPackManifestTaskBase.cs @@ -9,10 +9,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CreateAssetPackManifestTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CreateAssetPackManifestTaskBase : XamarinTask { const double DownloadPriorityInterval = 0.90; const double TopDownloadPriority = 0.95; @@ -112,7 +110,7 @@ namespace Xamarin.MacDev.Tasks priority = 1.0f; } else { for (int i = 0; i < prefetchOrder.Length; i++) { - if (tag == prefetchOrder[i]) { + if (tag == prefetchOrder [i]) { var value = GetDownloadPriority (i, prefetchOrder.Length); priority = double.IsNaN (priority) ? value : Math.Max (priority, value); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackage.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackage.cs index e113b524f3..e1af84521f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackage.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackage.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CreateBindingResourcePackage : CreateBindingResourcePackageBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CreateBindingResourcePackage : CreateBindingResourcePackageBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackageBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackageBase.cs index 6eaf4802eb..fc2e298669 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackageBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateBindingResourcePackageBase.cs @@ -23,12 +23,12 @@ namespace Xamarin.MacDev.Tasks { [Required] public string IntermediateOutputPath { get; set; } - [Required] - public ITaskItem[] NativeReferences { get; set; } - + [Required] + public ITaskItem [] NativeReferences { get; set; } + // This is a list of files to copy back to Windows [Output] - public ITaskItem[] PackagedFiles { get; set; } + public ITaskItem [] PackagedFiles { get; set; } public override bool Execute () { @@ -103,7 +103,7 @@ namespace Xamarin.MacDev.Tasks { return !Log.HasLoggedErrors; } - static bool ContainsSymlinks (ITaskItem[] items) + static bool ContainsSymlinks (ITaskItem [] items) { foreach (var item in items) { if (PathUtils.IsSymlinkOrContainsSymlinks (item.ItemSpec)) @@ -113,11 +113,11 @@ namespace Xamarin.MacDev.Tasks { return false; } - string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx"}; + string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx" }; string CreateManifest (string resourcePath) { - XmlWriterSettings settings = new XmlWriterSettings() { + XmlWriterSettings settings = new XmlWriterSettings () { OmitXmlDeclaration = true, Indent = true, IndentChars = "\t", diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfiguration.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfiguration.cs index 8b26e35f7f..0f4371d064 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfiguration.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfiguration.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CreateDebugConfiguration : CreateDebugConfigurationTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CreateDebugConfiguration : CreateDebugConfigurationTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfigurationTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfigurationTaskBase.cs index 95a69bd10e..0d45a1d877 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfigurationTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugConfigurationTaskBase.cs @@ -8,10 +8,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CreateDebugConfigurationTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CreateDebugConfigurationTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettings.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettings.cs index fb36259b9f..587463be5b 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettings.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettings.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CreateDebugSettings : CreateDebugSettingsTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CreateDebugSettings : CreateDebugSettingsTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettingsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettingsTaskBase.cs index 15423ac3ca..74287aaca0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettingsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateDebugSettingsTaskBase.cs @@ -9,10 +9,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CreateDebugSettingsTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CreateDebugSettingsTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs index be33b0168b..d83047dade 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResources.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Tasks; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ - public class CreateEmbeddedResources : CreateEmbeddedResourcesTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class CreateEmbeddedResources : CreateEmbeddedResourcesTaskBase { public override bool Execute () { if (this.ShouldExecuteRemotely (SessionId)) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResourcesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResourcesTaskBase.cs index b960d910ed..a5ce60f583 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResourcesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateEmbeddedResourcesTaskBase.cs @@ -5,29 +5,28 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace Xamarin.MacDev.Tasks { - public abstract class CreateEmbeddedResourcesTaskBase : Task - { + public abstract class CreateEmbeddedResourcesTaskBase : Task { public string SessionId { get; set; } [Required] - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } [Required] public string Prefix { get; set; } [Output] - public ITaskItem[] EmbeddedResources { get; set; } + public ITaskItem [] EmbeddedResources { get; set; } static string EscapeMangledResource (string name) { var mangled = new StringBuilder (); for (int i = 0; i < name.Length; i++) { - switch (name[i]) { + switch (name [i]) { case '\\': mangled.Append ("_b"); break; case '/': mangled.Append ("_f"); break; case '_': mangled.Append ("__"); break; - default: mangled.Append (name[i]); break; + default: mangled.Append (name [i]); break; } } @@ -36,10 +35,10 @@ namespace Xamarin.MacDev.Tasks { public override bool Execute () { - EmbeddedResources = new ITaskItem[BundleResources.Length]; + EmbeddedResources = new ITaskItem [BundleResources.Length]; for (int i = 0; i < BundleResources.Length; i++) { - var bundleResource = BundleResources[i]; + var bundleResource = BundleResources [i]; // clone the item var embeddedResource = new TaskItem (bundleResource.ItemSpec); @@ -50,9 +49,9 @@ namespace Xamarin.MacDev.Tasks { embeddedResource.SetMetadata ("LogicalName", logicalName); // add it to the output connection - EmbeddedResources[i] = embeddedResource; + EmbeddedResources [i] = embeddedResource; } - + return true; } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackage.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackage.cs index b3cf1810cb..a6373728db 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackage.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackage.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class CreateInstallerPackage : CreateInstallerPackageTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class CreateInstallerPackage : CreateInstallerPackageTaskBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackageTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackageTaskBase.cs index 95f92ed3f7..a4f7853a4f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackageTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreateInstallerPackageTaskBase.cs @@ -11,10 +11,8 @@ using System.Security.Cryptography.X509Certificates; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CreateInstallerPackageTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class CreateInstallerPackageTaskBase : XamarinToolTask { #region Inputs [Required] public string OutputDirectory { get; set; } @@ -35,14 +33,14 @@ namespace Xamarin.MacDev.Tasks public ITaskItem MainAssembly { get; set; } [Required] // Should we even look at the PackageSigningKey? - // It has a default value when this is false, so we can't just switch off it being null + // It has a default value when this is false, so we can't just switch off it being null public bool EnablePackageSigning { get; set; } public string ProductDefinition { get; set; } public string PackageSigningKey { get; set; } - public string PackagingExtraArgs { get ; set; } + public string PackagingExtraArgs { get; set; } // both input and output [Output] @@ -68,8 +66,7 @@ namespace Xamarin.MacDev.Tasks return plist.GetCFBundleShortVersionString (); } - protected override string ToolName - { + protected override string ToolName { get { return "productbuild"; } } @@ -89,7 +86,7 @@ namespace Xamarin.MacDev.Tasks var args = new CommandLineArgumentBuilder (); - if (!string.IsNullOrEmpty(ProductDefinition)) { + if (!string.IsNullOrEmpty (ProductDefinition)) { args.Add ("--product"); args.AddQuoted (Path.GetFullPath (ProductDefinition)); } @@ -129,7 +126,7 @@ namespace Xamarin.MacDev.Tasks { var target = this.MainAssembly.ItemSpec; - string[] argv = CommandLineArgumentBuilder.Parse (extraArgs); + string [] argv = CommandLineArgumentBuilder.Parse (extraArgs); var customTags = new Dictionary (StringComparer.OrdinalIgnoreCase) { { "projectdir", Path.GetDirectoryName (this.ProjectPath) }, // Apparently msbuild doesn't propagate the solution path, so we can't get it. - MTouchTaskBase.cs @@ -142,7 +139,7 @@ namespace Xamarin.MacDev.Tasks }; for (int i = 0; i < argv.Length; i++) - args.AddQuoted (StringParserService.Parse (argv[i], customTags)); + args.AddQuoted (StringParserService.Parse (argv [i], customTags)); } string GetPackageSigningCertificateCommonName () diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfo.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfo.cs index 4ae677a4eb..4611e10abd 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfo.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfo.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class CreatePkgInfo : CreatePkgInfoTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class CreatePkgInfo : CreatePkgInfoTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfoTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfoTaskBase.cs index ed196497bb..219c077055 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfoTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CreatePkgInfoTaskBase.cs @@ -4,11 +4,9 @@ using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -namespace Xamarin.MacDev.Tasks -{ - public abstract class CreatePkgInfoTaskBase : XamarinTask - { - static readonly byte[] PkgInfoData = { 0X41, 0X50, 0X50, 0X4C, 0x3f, 0x3f, 0x3f, 0x3f }; +namespace Xamarin.MacDev.Tasks { + public abstract class CreatePkgInfoTaskBase : XamarinTask { + static readonly byte [] PkgInfoData = { 0X41, 0X50, 0X50, 0X4C, 0x3f, 0x3f, 0x3f, 0x3f }; #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs index 23ae1d135a..9748dccb96 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs @@ -7,10 +7,8 @@ using Xamarin.Messaging.Build.Client; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public class DSymUtil : DSymUtilTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class DSymUtil : DSymUtilTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtilTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtilTaskBase.cs index 7a2b5b5bf5..61e09b1139 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtilTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtilTaskBase.cs @@ -8,10 +8,8 @@ using Microsoft.Build.Utilities; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public abstract class DSymUtilTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class DSymUtilTaskBase : XamarinTask { #region Inputs // This can also be specified as metadata on the Executable item (as 'DSymDir') @@ -27,7 +25,7 @@ namespace Xamarin.MacDev.Tasks // This property is required for XVS to work properly, even though it's not used for anything in the targets. [Output] - public ITaskItem[] DsymContentFiles { get; set; } = Array.Empty (); + public ITaskItem [] DsymContentFiles { get; set; } = Array.Empty (); #endregion diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfiguration.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfiguration.cs index 997d6af67c..2818e18a31 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfiguration.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfiguration.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class DetectDebugNetworkConfiguration : DetectDebugNetworkConfigurationBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class DetectDebugNetworkConfiguration : DetectDebugNetworkConfigurationBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfigurationTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfigurationTaskBase.cs index d4d02423f3..b8c3d8957e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfigurationTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectDebugNetworkConfigurationTaskBase.cs @@ -12,10 +12,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class DetectDebugNetworkConfigurationBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class DetectDebugNetworkConfigurationBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs index 14433bde64..daad6d5653 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class DetectSigningIdentity : DetectSigningIdentityTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class DetectSigningIdentity : DetectSigningIdentityTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentityTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentityTaskBase.cs index 4d426148a8..c1994b2f2e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentityTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentityTaskBase.cs @@ -11,10 +11,8 @@ using Xamarin.Localization.MSBuild; using SecKeychain = Xamarin.MacDev.Keychain; -namespace Xamarin.MacDev.Tasks -{ - public abstract class DetectSigningIdentityTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class DetectSigningIdentityTaskBase : XamarinTask { const string AutomaticProvision = "Automatic"; const string AutomaticAdHocProvision = "Automatic:AdHoc"; const string AutomaticAppStoreProvision = "Automatic:AppStore"; @@ -198,8 +196,7 @@ namespace Xamarin.MacDev.Tasks } } - class CodeSignIdentity - { + class CodeSignIdentity { public X509Certificate2 SigningKey { get; set; } public MobileProvision Profile { get; set; } public string BundleId { get; set; } @@ -247,7 +244,7 @@ namespace Xamarin.MacDev.Tasks } return ConstructValidAppId ( - provision.ApplicationIdentifierPrefix[0] + "." + bundleId, + provision.ApplicationIdentifierPrefix [0] + "." + bundleId, ((PString) provision.Entitlements [ApplicationIdentifierKey]).Value, out matchLength ); @@ -291,17 +288,17 @@ namespace Xamarin.MacDev.Tasks Log.LogMessage (MessageImportance.High, " App Id: {0}", DetectedAppId); } - static bool MatchesAny (string name, string[] names) + static bool MatchesAny (string name, string [] names) { for (int i = 0; i < names.Length; i++) { - if (name == names[i]) + if (name == names [i]) return true; } return false; } - static bool StartsWithAny (string name, string[] prefixes) + static bool StartsWithAny (string name, string [] prefixes) { foreach (var prefix in prefixes) { if (name.StartsWith (prefix, StringComparison.Ordinal)) @@ -311,7 +308,7 @@ namespace Xamarin.MacDev.Tasks return false; } - bool TryGetSigningCertificates (SecKeychain keychain, out IList certs, string[] prefixes, bool allowZeroCerts) + bool TryGetSigningCertificates (SecKeychain keychain, out IList certs, string [] prefixes, bool allowZeroCerts) { var now = DateTime.Now; @@ -400,8 +397,7 @@ namespace Xamarin.MacDev.Tasks } } - class SigningIdentityComparer : IComparer - { + class SigningIdentityComparer : IComparer { public int Compare (CodeSignIdentity x, CodeSignIdentity y) { // reverse sort by provisioning profile creation date @@ -428,7 +424,7 @@ namespace Xamarin.MacDev.Tasks if (profiles.Count == 0) { foreach (var f in failures) Log.LogMessage (MessageImportance.Low, "{0}", f); - + Log.LogError (MSBStrings.E0131, AppBundleName, PlatformName); return null; } @@ -445,12 +441,15 @@ namespace Xamarin.MacDev.Tasks List pairs; if (certs.Count > 0) { - pairs = (from p in profiles from c in certs where p.DeveloperCertificates.Any (d => { - var rv = d.Thumbprint == c.Thumbprint; - if (!rv) - Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, d.Thumbprint, c.Thumbprint); - return rv; - }) select new CodeSignIdentity { SigningKey = c, Profile = p }).ToList (); + pairs = (from p in profiles + from c in certs + where p.DeveloperCertificates.Any (d => { + var rv = d.Thumbprint == c.Thumbprint; + if (!rv) + Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, d.Thumbprint, c.Thumbprint); + return rv; + }) + select new CodeSignIdentity { SigningKey = c, Profile = p }).ToList (); if (pairs.Count == 0) { Log.LogError (MSBStrings.E0133, PlatformName, AppBundleName); @@ -510,14 +509,14 @@ namespace Xamarin.MacDev.Tasks matches.Sort (new SigningIdentityComparer ()); for (int i = 0; i < matches.Count; i++) { - Log.LogMessage (MessageImportance.Normal, "{0,3}. Provisioning Profile: \"{1}\" ({2})", i + 1, matches[i].Profile.Name, matches[i].Profile.Uuid); + Log.LogMessage (MessageImportance.Normal, "{0,3}. Provisioning Profile: \"{1}\" ({2})", i + 1, matches [i].Profile.Name, matches [i].Profile.Uuid); - if (matches[i].SigningKey != null) - Log.LogMessage (MessageImportance.Normal, "{0} Signing Identity: \"{1}\"", spaces, SecKeychain.GetCertificateCommonName (matches[i].SigningKey)); + if (matches [i].SigningKey != null) + Log.LogMessage (MessageImportance.Normal, "{0} Signing Identity: \"{1}\"", spaces, SecKeychain.GetCertificateCommonName (matches [i].SigningKey)); } } - return matches[0]; + return matches [0]; } public override bool Execute () @@ -609,7 +608,7 @@ namespace Xamarin.MacDev.Tasks DetectedProvisioningProfile = identity.Profile.Uuid; DetectedDistributionType = identity.Profile.DistributionType.ToString (); } else { - certs = new X509Certificate2[0]; + certs = new X509Certificate2 [0]; if ((profiles = GetProvisioningProfiles (platform, type, identity, certs)) == null) return false; @@ -667,12 +666,12 @@ namespace Xamarin.MacDev.Tasks for (int i = 0; i < certs.Count; i++) { Log.LogMessage (MessageImportance.Normal, "{0,3}. Signing Identity: {1} ({2})", i + 1, - SecKeychain.GetCertificateCommonName (certs[i]), certs[i].Thumbprint); + SecKeychain.GetCertificateCommonName (certs [i]), certs [i].Thumbprint); } } - codesignCommonName = SecKeychain.GetCertificateCommonName (certs[0]); - DetectedCodeSigningKey = certs[0].Thumbprint; + codesignCommonName = SecKeychain.GetCertificateCommonName (certs [0]); + DetectedCodeSigningKey = certs [0].Thumbprint; ReportDetectedCodesignInfo (); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs index 8cb8fc5d3d..261fa07b88 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Ditto.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class Ditto : DittoTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class Ditto : DittoTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) { @@ -31,8 +29,8 @@ namespace Xamarin.MacDev.Tasks } public IEnumerable GetAdditionalItemsToBeCopied () - { - if (!Directory.Exists(Source.ItemSpec)) + { + if (!Directory.Exists (Source.ItemSpec)) return Enumerable.Empty (); if (!CopyFromWindows) @@ -41,8 +39,8 @@ namespace Xamarin.MacDev.Tasks // TaskRunner doesn't know how to copy directories to Mac but `ditto` can take directories (and that's why we use ditto often). // If Source is a directory path, let's add each file within it as an TaskItem, as TaskRunner knows how to copy files to Mac. return Directory.GetFiles (Source.ItemSpec, "*", SearchOption.AllDirectories) - .Select(f => new TaskItem(f)); - } + .Select (f => new TaskItem (f)); + } public bool ShouldCopyToBuildServer (ITaskItem item) => true; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DittoTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DittoTaskBase.cs index 6c6ff118f1..1a056013cb 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DittoTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DittoTaskBase.cs @@ -7,10 +7,8 @@ using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -namespace Xamarin.MacDev.Tasks -{ - public abstract class DittoTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class DittoTaskBase : XamarinToolTask { #region Inputs public string? AdditionalArguments { get; set; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfile.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfile.cs index 355cb280b3..e7a7abfc4c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfile.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class EmbedProvisionProfile : EmbedProvisionProfileTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class EmbedProvisionProfile : EmbedProvisionProfileTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfileTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfileTaskBase.cs index 85bf2f9874..5252717d78 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfileTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/EmbedProvisionProfileTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Framework; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class EmbedProvisionProfileTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class EmbedProvisionProfileTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompiler.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompiler.cs index 0e9d1e6106..38bccfc640 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompiler.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompiler.cs @@ -4,8 +4,7 @@ using System.Collections.Generic; using Xamarin.Messaging.Build.Client; using Microsoft.Build.Framework; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public class FindAotCompiler : FindAotCompilerTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompilerTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompilerTaskBase.cs index e6287f3bdf..917fdf0822 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompilerTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindAotCompilerTaskBase.cs @@ -10,7 +10,7 @@ using Xamarin.Localization.MSBuild; namespace Xamarin.MacDev.Tasks { public abstract class FindAotCompilerTaskBase : XamarinTask { [Required] - public ITaskItem[] MonoAotCrossCompiler { get; set; } + public ITaskItem [] MonoAotCrossCompiler { get; set; } public bool KeepTemporaryOutput { get; set; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalName.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalName.cs index a951ba6460..af9beaa11e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalName.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalName.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class FindItemWithLogicalName : FindItemWithLogicalNameTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class FindItemWithLogicalName : FindItemWithLogicalNameTaskBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalNameTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalNameTaskBase.cs index 85e873820b..a7ed0122e8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalNameTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/FindItemWithLogicalNameTaskBase.cs @@ -4,10 +4,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class FindItemWithLogicalNameTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class FindItemWithLogicalNameTaskBase : XamarinTask { #region Inputs [Required] @@ -19,7 +17,7 @@ namespace Xamarin.MacDev.Tasks [Required] public string LogicalName { get; set; } - public ITaskItem[] Items { get; set; } + public ITaskItem [] Items { get; set; } #endregion Inputs @@ -36,7 +34,7 @@ namespace Xamarin.MacDev.Tasks var prefixes = BundleResource.SplitResourcePrefixes (ResourcePrefix); foreach (var item in Items) { - var logical = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty(SessionId)); + var logical = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty (SessionId)); if (logical == LogicalName) { Log.LogMessage (MessageImportance.Low, MSBStrings.M0149, LogicalName, item.ItemSpec); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleName.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleName.cs index 79159dedc8..b61e8214af 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleName.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleName.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class GenerateBundleName : GenerateBundleNameTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class GenerateBundleName : GenerateBundleNameTaskBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleNameTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleNameTaskBase.cs index 97d2bbb550..7444caa79f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleNameTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GenerateBundleNameTaskBase.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Utilities; using Microsoft.Build.Framework; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GenerateBundleNameTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GenerateBundleNameTaskBase : XamarinTask { [Required] public string ProjectName { get; set; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectories.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectories.cs index bdb14e8e89..3368620f18 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectories.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectories.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class GetDirectories : GetDirectoriesTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class GetDirectories : GetDirectoriesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectoriesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectoriesTaskBase.cs index 69a332b491..b2280a58ea 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectoriesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetDirectoriesTaskBase.cs @@ -8,10 +8,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetDirectoriesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetDirectoriesTaskBase : XamarinTask { [Required] public string Path { get; set; } @@ -22,7 +20,7 @@ namespace Xamarin.MacDev.Tasks public string Exclude { get; set; } [Output] - public ITaskItem[] Directories { get; set; } + public ITaskItem [] Directories { get; set; } public override bool Execute () { @@ -53,7 +51,7 @@ namespace Xamarin.MacDev.Tasks dirs = Directory.EnumerateDirectories (path, "*.*", option); if (!string.IsNullOrEmpty (Exclude)) { - foreach (var rpath in Exclude.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { + foreach (var rpath in Exclude.Split (new char [] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var full = System.IO.Path.Combine (path, rpath.Replace ('\\', '/')); exclude.Add (full); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntries.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntries.cs index 02646e06bd..b37ab909f3 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntries.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntries.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class GetFileSystemEntries : GetFileSystemEntriesTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class GetFileSystemEntries : GetFileSystemEntriesTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs index 30e78e1237..4e9a56d511 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs @@ -6,10 +6,8 @@ using System.Linq; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetFileSystemEntriesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetFileSystemEntriesTaskBase : XamarinTask { #region Inputs [Required] @@ -28,7 +26,7 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] Entries { get; set; } + public ITaskItem [] Entries { get; set; } #endregion diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFiles.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFiles.cs index 33ec9cfc10..276d7d206c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFiles.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFiles.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class GetFiles : GetFilesTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class GetFiles : GetFilesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFilesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFilesTaskBase.cs index 1bcf15dca3..e849252364 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFilesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFilesTaskBase.cs @@ -8,10 +8,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetFilesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetFilesTaskBase : XamarinTask { [Required] public string Path { get; set; } @@ -22,7 +20,7 @@ namespace Xamarin.MacDev.Tasks public string Exclude { get; set; } [Output] - public ITaskItem[] Files { get; set; } + public ITaskItem [] Files { get; set; } public override bool Execute () { @@ -53,7 +51,7 @@ namespace Xamarin.MacDev.Tasks files = Directory.EnumerateFiles (path, "*.*", option); if (!string.IsNullOrEmpty (Exclude)) { - foreach (var rpath in Exclude.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { + foreach (var rpath in Exclude.Split (new char [] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { var full = System.IO.Path.Combine (path, rpath.Replace ('\\', '/')); exclude.Add (full); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPath.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPath.cs index 0a708078b6..b3250961dc 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPath.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPath.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class GetFullPath : GetFullPathTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class GetFullPath : GetFullPathTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPathTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPathTaskBase.cs index d7e3dfc120..12b4fa88ad 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPathTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFullPathTaskBase.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetFullPathTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetFullPathTaskBase : XamarinTask { [Required] public string RelativePath { get; set; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableName.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableName.cs index c65527cb86..ce8f668db9 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableName.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableName.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class GetNativeExecutableName : GetNativeExecutableNameTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class GetNativeExecutableName : GetNativeExecutableNameTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableNameTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableNameTaskBase.cs index 3817fa4edb..7228579dc1 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableNameTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetNativeExecutableNameTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetNativeExecutableNameTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetNativeExecutableNameTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValue.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValue.cs index 3f8a4da35b..23c251366c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValue.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValue.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class GetPropertyListValue : GetPropertyListValueTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class GetPropertyListValue : GetPropertyListValueTaskBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValueTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValueTaskBase.cs index 7f5b99259b..6db5f1a52d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValueTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetPropertyListValueTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class GetPropertyListValueTaskBase : Task - { +namespace Xamarin.MacDev.Tasks { + public abstract class GetPropertyListValueTaskBase : Task { #region Inputs [Required] @@ -32,7 +30,7 @@ namespace Xamarin.MacDev.Tasks PArray array = null; PDictionary dict; PObject value; - string[] path; + string [] path; int i = 0; path = Property.TrimStart (':').Split (new [] { ':' }); @@ -51,16 +49,16 @@ namespace Xamarin.MacDev.Tasks do { if (dict != null) { - if (!dict.TryGetValue (path[i], out value)) { + if (!dict.TryGetValue (path [i], out value)) { var item = i > 0 ? string.Join ("/", path, 0, i - 1) : PropertyListFile; - Log.LogError (MSBStrings.E0153, item, path[i]); + Log.LogError (MSBStrings.E0153, item, path [i]); return false; } } else if (array != null) { int arrayIndex; - if (!int.TryParse (path[i], out arrayIndex)) { - Log.LogError (MSBStrings.E0145, path[i]); + if (!int.TryParse (path [i], out arrayIndex)) { + Log.LogError (MSBStrings.E0145, path [i]); return false; } @@ -70,7 +68,7 @@ namespace Xamarin.MacDev.Tasks return false; } - value = array[arrayIndex]; + value = array [arrayIndex]; } else { Log.LogError (MSBStrings.E0156, value.Type); return false; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs index cc29644018..46e6abc592 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class IBTool : IBToolTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class IBTool : IBToolTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBToolTaskBase.cs index 29e08517c4..417f7ffe58 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBToolTaskBase.cs @@ -9,18 +9,16 @@ using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class IBToolTaskBase : XcodeCompilerToolTask - { - static readonly string[] WatchAppExtensions = { "-glance.plist", "-notification.plist" }; +namespace Xamarin.MacDev.Tasks { + public abstract class IBToolTaskBase : XcodeCompilerToolTask { + static readonly string [] WatchAppExtensions = { "-glance.plist", "-notification.plist" }; #region Inputs public bool EnableOnDemandResources { get; set; } [Required] - public ITaskItem[] InterfaceDefinitions { get; set; } + public ITaskItem [] InterfaceDefinitions { get; set; } public bool IsWatchApp { get; set; } public bool IsWatch2App { get; set; } @@ -53,13 +51,13 @@ namespace Xamarin.MacDev.Tasks get { return AppleSdkSettings.XcodeVersion.Major > 7 || (AppleSdkSettings.XcodeVersion.Major == 7 && AppleSdkSettings.XcodeVersion.Minor >= 2); } } - protected override void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem[] items) + protected override void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem [] items) { environment.Add ("IBSC_MINIMUM_COMPATIBILITY_VERSION", MinimumOSVersion); environment.Add ("IBC_MINIMUM_COMPATIBILITY_VERSION", MinimumOSVersion); args.Add ("--minimum-deployment-target", MinimumOSVersion); - + foreach (var targetDevice in GetTargetDevices ()) args.Add ("--target-device", targetDevice); @@ -80,9 +78,9 @@ namespace Xamarin.MacDev.Tasks // will retain the *.lproj directory as their parent, but the *.lproj directory will be // in the root of the app bundle. var components = input.ItemSpec.Split (Path.DirectorySeparatorChar); - var bundleName = components[components.Length - 1]; - if (components.Length > 1 && components[components.Length - 2].EndsWith (".lproj", StringComparison.Ordinal)) - bundleName = Path.Combine (components[components.Length - 2], bundleName); + var bundleName = components [components.Length - 1]; + if (components.Length > 1 && components [components.Length - 2].EndsWith (".lproj", StringComparison.Ordinal)) + bundleName = Path.Combine (components [components.Length - 2], bundleName); switch (Path.GetExtension (bundleName)) { case ".storyboard": @@ -113,7 +111,7 @@ namespace Xamarin.MacDev.Tasks // Note: all storyboardc's/nib's will be found in the top-level or within a top-level *.lproj dir (if they've been translated) for (int i = 0; i < baseOutputDirs.Count; i++) { - foreach (var path in Directory.EnumerateFileSystemEntries (baseOutputDirs[i])) { + foreach (var path in Directory.EnumerateFileSystemEntries (baseOutputDirs [i])) { if (i == 0 && path.EndsWith (".lproj", StringComparison.Ordinal) && Directory.Exists (path)) { baseOutputDirs.Add (path); continue; @@ -231,7 +229,7 @@ namespace Xamarin.MacDev.Tasks Directory.CreateDirectory (manifestDir); Directory.CreateDirectory (outputDir); - if ((Compile (new[] { item }, output, manifest)) != 0) + if ((Compile (new [] { item }, output, manifest)) != 0) return false; changed = true; @@ -271,7 +269,7 @@ namespace Xamarin.MacDev.Tasks // // In this case, we want to override the metadata for "MyView.xib" with the metadata for // "MyView~ipad.xib". - mapping[path] = metadata; + mapping [path] = metadata; } else { compiled.AddRange (GetCompilationOutput (expected)); } @@ -301,16 +299,16 @@ namespace Xamarin.MacDev.Tasks // While we are at it, we'll also filter out device-specific storyboards since ibtool doesn't // require them if we have an equivalent generic version. for (int i = 0; i < storyboards.Count; i++) { - var interfaceDefinition = storyboards[i].GetMetadata ("InterfaceDefinition"); - var bundleName = storyboards[i].GetMetadata ("LogicalName"); + var interfaceDefinition = storyboards [i].GetMetadata ("InterfaceDefinition"); + var bundleName = storyboards [i].GetMetadata ("LogicalName"); var path = Path.Combine (baseOutputDir, bundleName); - storyboards[i].RemoveMetadata ("InterfaceDefinition"); - var metadata = storyboards[i].CloneCustomMetadata (); + storyboards [i].RemoveMetadata ("InterfaceDefinition"); + var metadata = storyboards [i].CloneCustomMetadata (); mapping.Add (path, metadata); if (unique.Add (interfaceDefinition)) - items.Add (storyboards[i]); + items.Add (storyboards [i]); } // We only need to run `ibtool --link` if storyboards have changed... @@ -431,16 +429,16 @@ namespace Xamarin.MacDev.Tasks for (int i = 0; i < compiled.Count; i++) { // pretend that non-storyboardc items (e.g. *.nib) are already 'linked' - if (compiled[i].ItemSpec.EndsWith (".storyboardc", StringComparison.Ordinal)) { - var interfaceDefinition = compiled[i].GetMetadata ("InterfaceDefinition"); + if (compiled [i].ItemSpec.EndsWith (".storyboardc", StringComparison.Ordinal)) { + var interfaceDefinition = compiled [i].GetMetadata ("InterfaceDefinition"); unique.Add (interfaceDefinition); - storyboards.Add (compiled[i]); + storyboards.Add (compiled [i]); continue; } // just pretend any *nib's have already been 'linked'... - compiled[i].RemoveMetadata ("InterfaceDefinition"); - linked.Add (compiled[i]); + compiled [i].RemoveMetadata ("InterfaceDefinition"); + linked.Add (compiled [i]); } // only link the storyboards if there are multiple unique storyboards @@ -454,7 +452,7 @@ namespace Xamarin.MacDev.Tasks } } else { for (int i = 0; i < compiled.Count; i++) - compiled[i].RemoveMetadata ("InterfaceDefinition"); + compiled [i].RemoveMetadata ("InterfaceDefinition"); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/InstallNameToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/InstallNameToolTaskBase.cs index 67d2c5f2f7..e0cc2e8e2d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/InstallNameToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/InstallNameToolTaskBase.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.Build.Framework; namespace Xamarin.MacDev.Tasks { - public abstract class InstallNameToolTaskBase : XamarinTask { + public abstract class InstallNameToolTaskBase : XamarinTask { [Required] public ITaskItem [] DynamicLibrary { get; set; } @@ -16,7 +16,7 @@ namespace Xamarin.MacDev.Tasks { // This isn't consumed from the targets files, but it's needed for VSX to create corresponding // files on Windows. [Output] - public ITaskItem[] ReidentifiedDynamicLibrary { get; set; } + public ITaskItem [] ReidentifiedDynamicLibrary { get; set; } public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs index d018c323d5..b6d5790795 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public class LinkNativeCode : LinkNativeCodeTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class LinkNativeCode : LinkNativeCodeTaskBase, ITaskCallback { string outputPath; public override bool Execute () diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCodeTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCodeTaskBase.cs index 706bf15e78..4a84742b78 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCodeTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCodeTaskBase.cs @@ -10,10 +10,10 @@ using Xamarin.Utils; namespace Xamarin.MacDev.Tasks { public abstract class LinkNativeCodeTaskBase : XamarinTask { -#region Inputs - public ITaskItem[] LinkerFlags { get; set; } + #region Inputs + public ITaskItem [] LinkerFlags { get; set; } - public ITaskItem[] LinkWithLibraries { get; set; } + public ITaskItem [] LinkWithLibraries { get; set; } // A path to entitlements to be embedded into the executable public string EntitlementsInExecutable { get; set; } @@ -38,7 +38,7 @@ namespace Xamarin.MacDev.Tasks { public ITaskItem [] NativeReferences { get; set; } - public ITaskItem[] Frameworks { get; set; } + public ITaskItem [] Frameworks { get; set; } public string DylibRPath { get; set; } @@ -48,7 +48,7 @@ namespace Xamarin.MacDev.Tasks { public string TargetArchitectures { get; set; } TargetArchitecture architectures; -#endregion + #endregion public override bool Execute () { @@ -125,7 +125,7 @@ namespace Xamarin.MacDev.Tasks { default: throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform)); } - + bool hasDylibs = false; if (LinkWithLibraries != null) { foreach (var libSpec in LinkWithLibraries) { @@ -205,7 +205,7 @@ namespace Xamarin.MacDev.Tasks { return !Log.HasLoggedErrors; } - public static string[] GetEmbedEntitlementsInExecutableLinkerFlags (string entitlements) + public static string [] GetEmbedEntitlementsInExecutableLinkerFlags (string entitlements) { if (string.IsNullOrEmpty (entitlements)) return Array.Empty (); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundlesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundlesTaskBase.cs index 466c56831b..45ea8bded7 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundlesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/MergeAppBundlesTaskBase.cs @@ -29,7 +29,7 @@ namespace Xamarin.MacDev.Tasks { #region Inputs // This is a list of files (filename only, no path, will match any file with the given name in the app bundle) // that can be put in a RID-specific subdirectory. - public ITaskItem[] ArchitectureSpecificFiles { get; set; } + public ITaskItem [] ArchitectureSpecificFiles { get; set; } // This is a list of files (filename only, no path, will match any file with the given name in the app bundle) // to ignore/skip. @@ -275,7 +275,7 @@ namespace Xamarin.MacDev.Tasks { var specificSubdirectory = input.GetMetadata ("SpecificSubdirectory"); var fullInput = Path.GetFullPath (input.ItemSpec); // strip the trailing path separator - if (fullInput[fullInput.Length - 1] == Path.DirectorySeparatorChar) + if (fullInput [fullInput.Length - 1] == Path.DirectorySeparatorChar) fullInput = fullInput.Substring (0, fullInput.Length - 1); // get all the files and subdirectories in the input app bundle var files = Directory.GetFileSystemEntries (fullInput, "*", SearchOption.AllDirectories); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs index d50294dd89..3adb015d7b 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Metal.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class Metal : MetalTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class Metal : MetalTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs index bdfe93f721..7d6ec927a1 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLib.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class MetalLib : MetalLibTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class MetalLib : MetalLibTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLibTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLibTaskBase.cs index 3b89314504..c80c003555 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLibTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalLibTaskBase.cs @@ -7,14 +7,12 @@ using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class MetalLibTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class MetalLibTaskBase : XamarinToolTask { #region Inputs [Required] - public ITaskItem[] Items { get; set; } + public ITaskItem [] Items { get; set; } [Required] public string OutputLibrary { get; set; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalTaskBase.cs index bc65ea6b87..51f5a41639 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/MetalTaskBase.cs @@ -10,10 +10,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class MetalTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class MetalTaskBase : XamarinToolTask { #region Inputs [Required] @@ -93,7 +91,7 @@ namespace Xamarin.MacDev.Tasks { var prefixes = BundleResource.SplitResourcePrefixes (ResourcePrefix); var intermediate = Path.Combine (IntermediateOutputPath, ToolName); - var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, SourceFile, !string.IsNullOrEmpty(SessionId)); + var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, SourceFile, !string.IsNullOrEmpty (SessionId)); var path = Path.Combine (intermediate, logicalName); var args = new CommandLineArgumentBuilder (); var dir = Path.GetDirectoryName (path); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImage.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImage.cs index b6a4bb34f1..12474728e7 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImage.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImage.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class OptimizeImage : OptimizeImageTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class OptimizeImage : OptimizeImageTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) @@ -25,7 +23,7 @@ namespace Xamarin.MacDev.Tasks { base.Cancel (); - if (!string.IsNullOrEmpty(SessionId)) + if (!string.IsNullOrEmpty (SessionId)) BuildConnection.CancelAsync (SessionId, BuildEngine4).Wait (); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImageTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImageTaskBase.cs index 768a588cb2..4678ae89c2 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImageTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizeImageTaskBase.cs @@ -4,21 +4,19 @@ using System.IO; using Microsoft.Build.Utilities; using Microsoft.Build.Framework; -namespace Xamarin.MacDev.Tasks -{ - public abstract class OptimizeImageTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class OptimizeImageTaskBase : XamarinToolTask { ITaskItem inputImage; ITaskItem outputImage; #region Inputs [Required] - public ITaskItem[] InputImages { get; set; } + public ITaskItem [] InputImages { get; set; } [Required] [Output] - public ITaskItem[] OutputImages { get; set; } + public ITaskItem [] OutputImages { get; set; } [Required] public string SdkDevPath { get; set; } @@ -61,15 +59,15 @@ namespace Xamarin.MacDev.Tasks { var tokens = singleLine.Split (new [] { ':' }, 2); - if (tokens.Length == 2 && tokens[0].StartsWith ("libpng ", StringComparison.Ordinal)) { - var type = tokens[0].Substring ("libpng ".Length).Trim (); + if (tokens.Length == 2 && tokens [0].StartsWith ("libpng ", StringComparison.Ordinal)) { + var type = tokens [0].Substring ("libpng ".Length).Trim (); switch (type) { case "warning": - Log.LogWarning (null, null, null, inputImage.ItemSpec, 0, 0, 0, 0, "{0}", tokens[1].Trim ()); + Log.LogWarning (null, null, null, inputImage.ItemSpec, 0, 0, 0, 0, "{0}", tokens [1].Trim ()); break; case "error": - Log.LogError (null, null, null, inputImage.ItemSpec, 0, 0, 0, 0, "{0}", tokens[1].Trim ()); + Log.LogError (null, null, null, inputImage.ItemSpec, 0, 0, 0, 0, "{0}", tokens [1].Trim ()); break; default: Log.LogError (null, null, null, inputImage.ItemSpec, 0, 0, 0, 0, "{0}", singleLine); @@ -85,8 +83,8 @@ namespace Xamarin.MacDev.Tasks var result = true; for (var index = 0; index < this.InputImages.Length && index < this.OutputImages.Length; index++) { - this.inputImage = this.InputImages[index]; - this.outputImage = this.OutputImages[index]; + this.inputImage = this.InputImages [index]; + this.outputImage = this.OutputImages [index]; Directory.CreateDirectory (Path.GetDirectoryName (outputImage.ItemSpec)); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyList.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyList.cs index cc7d546e44..538119ec40 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyList.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyList.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class OptimizePropertyList : OptimizePropertyListTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class OptimizePropertyList : OptimizePropertyListTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) @@ -25,7 +23,7 @@ namespace Xamarin.MacDev.Tasks { base.Cancel (); - if (!string.IsNullOrEmpty(SessionId)) + if (!string.IsNullOrEmpty (SessionId)) BuildConnection.CancelAsync (SessionId, BuildEngine4).Wait (); } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyListTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyListTaskBase.cs index 4e4db31876..48dd9e2762 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyListTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/OptimizePropertyListTaskBase.cs @@ -4,10 +4,8 @@ using System.IO; using Microsoft.Build.Utilities; using Microsoft.Build.Framework; -namespace Xamarin.MacDev.Tasks -{ - public abstract class OptimizePropertyListTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class OptimizePropertyListTaskBase : XamarinToolTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs index f6c642703f..892ac146b0 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResources.cs @@ -4,10 +4,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class PackLibraryResources : PackLibraryResourcesTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class PackLibraryResources : PackLibraryResourcesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResourcesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResourcesTaskBase.cs index 65b482107d..5615ebb2d5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResourcesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PackLibraryResourcesTaskBase.cs @@ -6,23 +6,21 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class PackLibraryResourcesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class PackLibraryResourcesTaskBase : XamarinTask { #region Inputs [Required] public string Prefix { get; set; } - public ITaskItem[] BundleResourcesWithLogicalNames { get; set; } + public ITaskItem [] BundleResourcesWithLogicalNames { get; set; } #endregion #region Outputs [Output] - public ITaskItem[] EmbeddedResources { get; set; } + public ITaskItem [] EmbeddedResources { get; set; } #endregion @@ -31,11 +29,11 @@ namespace Xamarin.MacDev.Tasks var mangled = new StringBuilder (); for (int i = 0; i < name.Length; i++) { - switch (name[i]) { + switch (name [i]) { case '\\': mangled.Append ("_b"); break; case '/': mangled.Append ("_f"); break; case '_': mangled.Append ("__"); break; - default: mangled.Append (name[i]); break; + default: mangled.Append (name [i]); break; } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArgumentsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArgumentsTaskBase.cs index be489787ad..b2d3af5a84 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArgumentsTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArgumentsTaskBase.cs @@ -17,7 +17,7 @@ namespace Xamarin.MacDev.Tasks { public ITaskItem [] DlSym { get; set; } [Output] - public ITaskItem[] EnvironmentVariables { get; set; } + public ITaskItem [] EnvironmentVariables { get; set; } [Output] public string MarshalManagedExceptionMode { get; set; } @@ -29,7 +29,7 @@ namespace Xamarin.MacDev.Tasks { public string CustomBundleName { get; set; } [Output] - public ITaskItem[] CustomLinkFlags { get; set; } + public ITaskItem [] CustomLinkFlags { get; set; } [Output] public string NoSymbolStrip { get; set; } @@ -57,7 +57,7 @@ namespace Xamarin.MacDev.Tasks { public int Verbosity { get; set; } [Output] - public ITaskItem[] XmlDefinitions { get; set; } + public ITaskItem [] XmlDefinitions { get; set; } public override bool Execute () { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferences.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferences.cs index de2301bc11..96a422d4c1 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferences.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferences.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class PrepareNativeReferences : PrepareNativeReferencesTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class PrepareNativeReferences : PrepareNativeReferencesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferencesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferencesTaskBase.cs index ab95cf25e4..fb86ebbbfe 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferencesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareNativeReferencesTaskBase.cs @@ -7,14 +7,12 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class PrepareNativeReferencesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class PrepareNativeReferencesTaskBase : XamarinTask { [Required] public string IntermediateOutputPath { get; set; } - public ITaskItem[] NativeReferences { get; set; } + public ITaskItem [] NativeReferences { get; set; } #region Output @@ -22,10 +20,10 @@ namespace Xamarin.MacDev.Tasks public ITaskItem LinkWithAttributes { get; set; } [Output] - public ITaskItem[] EmbeddedResources { get; set; } + public ITaskItem [] EmbeddedResources { get; set; } [Output] - public ITaskItem[] NativeFrameworks { get; set; } + public ITaskItem [] NativeFrameworks { get; set; } #endregion @@ -49,7 +47,7 @@ namespace Xamarin.MacDev.Tasks for (int i = 0; i < targets.Length; i++) { if (i > 0) builder.Append (" | "); - builder.AppendFormat ("LinkTarget.{0}", targets[i].Trim ()); + builder.AppendFormat ("LinkTarget.{0}", targets [i].Trim ()); } } @@ -81,9 +79,9 @@ namespace Xamarin.MacDev.Tasks builder.AppendFormat (", {0} = \"", property); for (int i = 0; i < value.Length; i++) { - if (value[i] == '\\' || value[i] == '"') + if (value [i] == '\\' || value [i] == '"') builder.Append ('\\'); - builder.Append (value[i]); + builder.Append (value [i]); } builder.Append ('"'); } @@ -101,13 +99,13 @@ namespace Xamarin.MacDev.Tasks NativeReferenceKind kind; string value; - value = NativeReferences[i].GetMetadata ("Kind") ?? string.Empty; + value = NativeReferences [i].GetMetadata ("Kind") ?? string.Empty; if (!Enum.TryParse (value, out kind)) { - Log.LogError (null, null, null, NativeReferences[i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0051, value); + Log.LogError (null, null, null, NativeReferences [i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0051, value); continue; } - var path = NativeReferences[i].ItemSpec; + var path = NativeReferences [i].ItemSpec; var logicalName = Path.GetFileName (path); var item = new TaskItem (path); @@ -122,14 +120,14 @@ namespace Xamarin.MacDev.Tasks } text.AppendFormat ("[assembly: ObjCRuntime.LinkWith (\"{0}\"", logicalName); - AppendLinkTargetProperty (text, NativeReferences[i]); - AppendBooleanProperty (text, NativeReferences[i], "IsCxx"); - AppendBooleanProperty (text, NativeReferences[i], "NeedsGccExceptionHandling"); - AppendBooleanProperty (text, NativeReferences[i], "SmartLink", true); - AppendBooleanProperty (text, NativeReferences[i], "ForceLoad"); - AppendStringProperty (text, NativeReferences[i], "Frameworks"); - AppendStringProperty (text, NativeReferences[i], "WeakFrameworks"); - AppendStringProperty (text, NativeReferences[i], "LinkerFlags"); + AppendLinkTargetProperty (text, NativeReferences [i]); + AppendBooleanProperty (text, NativeReferences [i], "IsCxx"); + AppendBooleanProperty (text, NativeReferences [i], "NeedsGccExceptionHandling"); + AppendBooleanProperty (text, NativeReferences [i], "SmartLink", true); + AppendBooleanProperty (text, NativeReferences [i], "ForceLoad"); + AppendStringProperty (text, NativeReferences [i], "Frameworks"); + AppendStringProperty (text, NativeReferences [i], "WeakFrameworks"); + AppendStringProperty (text, NativeReferences [i], "LinkerFlags"); text.Append (")]"); text.AppendLine (); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRules.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRules.cs index e4e7f74045..e502fc854b 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRules.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRules.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class PrepareResourceRules : PrepareResourceRulesTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class PrepareResourceRules : PrepareResourceRulesTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRulesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRulesTaskBase.cs index 476fa8ce9f..79e30af946 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRulesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareResourceRulesTaskBase.cs @@ -4,10 +4,8 @@ using Microsoft.Build.Framework; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class PrepareResourceRulesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class PrepareResourceRulesTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditor.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditor.cs index 34af116b68..199e58275c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditor.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditor.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class PropertyListEditor : PropertyListEditorTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class PropertyListEditor : PropertyListEditorTaskBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditorTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditorTaskBase.cs index d26389b993..fa33252e06 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditorTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PropertyListEditorTaskBase.cs @@ -7,8 +7,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ +namespace Xamarin.MacDev.Tasks { public enum PropertyListEditorAction { Add, Clear, @@ -18,8 +17,7 @@ namespace Xamarin.MacDev.Tasks Set } - public abstract class PropertyListEditorTaskBase : Task - { + public abstract class PropertyListEditorTaskBase : Task { [Required] public string PropertyList { get; set; } @@ -36,13 +34,13 @@ namespace Xamarin.MacDev.Tasks { switch (value.Type) { case PObjectType.Dictionary: return "dict"; - case PObjectType.Array: return "array"; - case PObjectType.Real: return "real"; - case PObjectType.Number: return "integer"; - case PObjectType.Boolean: return "bool"; - case PObjectType.Data: return "data"; - case PObjectType.String: return "string"; - case PObjectType.Date: return "date"; + case PObjectType.Array: return "array"; + case PObjectType.Real: return "real"; + case PObjectType.Number: return "integer"; + case PObjectType.Boolean: return "bool"; + case PObjectType.Data: return "data"; + case PObjectType.String: return "string"; + case PObjectType.Date: return "date"; default: return null; } } @@ -100,7 +98,7 @@ namespace Xamarin.MacDev.Tasks if (text != null) value = new PData (Encoding.UTF8.GetBytes (Value)); else - value = new PData (new byte[0]); + value = new PData (new byte [0]); return true; default: Log.LogError (7045, null, $"Unrecognized Type: {type}"); @@ -109,14 +107,14 @@ namespace Xamarin.MacDev.Tasks } } - string[] GetPropertyPath () + string [] GetPropertyPath () { var path = Entry; if (string.IsNullOrEmpty (path)) - return new string[0]; + return new string [0]; - if (path[0] == ':') + if (path [0] == ':') path = path.Substring (1); return path.Split (':'); @@ -142,15 +140,15 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0 || index >= array.Count) { + if (!int.TryParse (path [i], out index) || index < 0 || index >= array.Count) { Log.LogError (7047, null, MSBStrings.E7047, Entry); return false; } - current = array[index]; + current = array [index]; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out current)) - dict[path[i]] = current = new PDictionary (); + if (!dict.TryGetValue (path [i], out current)) + dict [path [i]] = current = new PDictionary (); } else { Log.LogError (7046, null, MSBStrings.E7046, Entry); return false; @@ -163,9 +161,9 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (path[i].Length == 0) { + if (path [i].Length == 0) { index = array.Count; - } else if (!int.TryParse (path[i], out index) || index < 0) { + } else if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7047, null, MSBStrings.E7047, Entry); return false; } @@ -178,7 +176,7 @@ namespace Xamarin.MacDev.Tasks else array.Add (value); } else if (dict != null) { - if (dict.ContainsKey (path[i])) { + if (dict.ContainsKey (path [i])) { Log.LogError (7048, null, MSBStrings.E7048, Entry); return false; } @@ -186,7 +184,7 @@ namespace Xamarin.MacDev.Tasks if (!CreateValue (Type ?? string.Empty, Value, out value)) return false; - dict[path[i]] = value; + dict [path [i]] = value; } else { Log.LogError (7049, null, MSBStrings.E7049, Entry); return false; @@ -206,7 +204,7 @@ namespace Xamarin.MacDev.Tasks case "real": plist = new PReal (0); break; case "integer": plist = new PNumber (0); break; case "date": plist = new PDate (DateTime.Now); break; - case "data": plist = new PData (new byte[1]); break; + case "data": plist = new PData (new byte [1]); break; default: Log.LogError (7045, null, MSBStrings.E7045, Type); return false; @@ -237,7 +235,7 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0) { + if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7051, null, MSBStrings.E7051, Entry); return false; } @@ -247,9 +245,9 @@ namespace Xamarin.MacDev.Tasks return false; } - current = array[index]; + current = array [index]; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out current)) { + if (!dict.TryGetValue (path [i], out current)) { Log.LogError (7052, null, MSBStrings.E7052, Entry); return false; } @@ -286,15 +284,15 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0 || index >= array.Count) { + if (!int.TryParse (path [i], out index) || index < 0 || index >= array.Count) { Log.LogError (7054, null, MSBStrings.E7054, Entry); return false; } - current = array[index]; + current = array [index]; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out current)) - dict[path[i]] = current = new PDictionary (); + if (!dict.TryGetValue (path [i], out current)) + dict [path [i]] = current = new PDictionary (); } else { Log.LogError (7053, null, MSBStrings.E7053, Entry); return false; @@ -307,9 +305,9 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (path[i].Length == 0) { + if (path [i].Length == 0) { index = array.Count; - } else if (!int.TryParse (path[i], out index) || index < 0) { + } else if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7054, null, MSBStrings.E7054, Entry); return false; } @@ -333,7 +331,7 @@ namespace Xamarin.MacDev.Tasks return false; } - dict[path[i]] = value; + dict [path [i]] = value; } else { Log.LogError (7056, null, MSBStrings.E7056, Entry); return false; @@ -375,7 +373,7 @@ namespace Xamarin.MacDev.Tasks var import = (PArray) value; for (int i = 0; i < import.Count; i++) - array.Add (import[i].Clone ()); + array.Add (import [i].Clone ()); } else { array.Add (value); } @@ -404,7 +402,7 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0) { + if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7059, PropertyList, MSBStrings.E7059, Entry); return false; } @@ -414,9 +412,9 @@ namespace Xamarin.MacDev.Tasks return false; } - current = array[index]; + current = array [index]; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out current)) { + if (!dict.TryGetValue (path [i], out current)) { Log.LogError (7060, PropertyList, MSBStrings.E7060, Entry); return false; } @@ -433,8 +431,8 @@ namespace Xamarin.MacDev.Tasks PObject root; if (array != null) { - if (i > 0 || path[i].Length > 0) { - if (!int.TryParse (path[i], out index) || index < 0) { + if (i > 0 || path [i].Length > 0) { + if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7059, PropertyList, MSBStrings.E7059, Entry); return false; } @@ -444,7 +442,7 @@ namespace Xamarin.MacDev.Tasks return false; } - root = array[index]; + root = array [index]; } else { root = array; } @@ -460,8 +458,8 @@ namespace Xamarin.MacDev.Tasks } if (dict != null) { - if (i > 0 || path[i].Length > 0) { - if (!dict.TryGetValue (path[i], out root)) { + if (i > 0 || path [i].Length > 0) { + if (!dict.TryGetValue (path [i], out root)) { Log.LogError (7060, PropertyList, MSBStrings.E7060, Entry); return false; } @@ -515,7 +513,7 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0) { + if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7063, PropertyList, MSBStrings.E7063, Entry); return false; } @@ -525,9 +523,9 @@ namespace Xamarin.MacDev.Tasks return false; } - current = array[index]; + current = array [index]; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out current)) { + if (!dict.TryGetValue (path [i], out current)) { Log.LogError (7064, PropertyList, MSBStrings.E7064, Entry); return false; } @@ -543,7 +541,7 @@ namespace Xamarin.MacDev.Tasks array = current as PArray; if (array != null) { - if (!int.TryParse (path[i], out index) || index < 0) { + if (!int.TryParse (path [i], out index) || index < 0) { Log.LogError (7063, PropertyList, MSBStrings.E7063, Entry); return false; } @@ -556,9 +554,9 @@ namespace Xamarin.MacDev.Tasks if (!CreateValue (Type ?? string.Empty, Value, out value)) return false; - array[index] = value; + array [index] = value; } else if (dict != null) { - if (!dict.TryGetValue (path[i], out value)) { + if (!dict.TryGetValue (path [i], out value)) { Log.LogError (7064, PropertyList, MSBStrings.E7064, Entry); return false; } @@ -569,7 +567,7 @@ namespace Xamarin.MacDev.Tasks if (!CreateValue (type, Value, out value)) return false; - dict[path[i]] = value; + dict [path [i]] = value; } else { Log.LogError (7064, PropertyList, MSBStrings.E7064, Entry); return false; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs index bedbfcc325..662d4ac482 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadAppManifest.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ReadAppManifest : ReadAppManifestTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class ReadAppManifest : ReadAppManifestTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs index 9a54102d1a..d0e4003da5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ReadItemsFromFile : ReadItemsFromFileBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class ReadItemsFromFile : ReadItemsFromFileBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFileBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFileBase.cs index c8be0d97fa..0ca3117dc9 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFileBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFileBase.cs @@ -8,11 +8,9 @@ using Microsoft.Build.Utilities; using Microsoft.Build.Tasks; using System.Xml.Linq; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ReadItemsFromFileBase : XamarinTask - { - static readonly XNamespace XmlNs = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003"); +namespace Xamarin.MacDev.Tasks { + public abstract class ReadItemsFromFileBase : XamarinTask { + static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003"); static readonly XName ItemGroupElementName = XmlNs + "ItemGroup"; const string IncludeAttributeName = "Include"; @@ -21,14 +19,14 @@ namespace Xamarin.MacDev.Tasks [Output] [Required] - public ITaskItem[] File { get; set; } + public ITaskItem [] File { get; set; } #endregion #region Outputs [Output] - public ITaskItem[] Items { get; set; } + public ITaskItem [] Items { get; set; } #endregion diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs index aff16a9deb..7a210e8003 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs @@ -15,8 +15,7 @@ using Xamarin.Localization.MSBuild; namespace Xamarin.MacDev.Tasks { - public abstract class ResolveNativeReferencesBase : XamarinTask - { + public abstract class ResolveNativeReferencesBase : XamarinTask { #region Inputs [Required] @@ -221,8 +220,7 @@ namespace Xamarin.MacDev.Tasks { // note: last part is not translated since it match the (non-translated) keys inside the `Info.plist` var msg = (path == null) ? MSBStrings.E0174 : MSBStrings.E0175 + $" SupportedPlatform: '{platformName}', SupportedPlatformVariant: '{variant}', SupportedArchitectures: '{Architectures}'."; Log.LogError (msg, xcframework); - } - catch (Exception) { + } catch (Exception) { Log.LogError (MSBStrings.E0174, xcframework); } return null; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs index 4ba8f90941..277122b270 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ScnTool : ScnToolTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class ScnTool : ScnToolTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnToolTaskBase.cs index 65f04348ed..31503b35ad 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnToolTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Framework; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ScnToolTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ScnToolTaskBase : XamarinToolTask { string sdkDevPath; #region Inputs diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopy.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopy.cs index 92a5856a76..ea6df55909 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopy.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopy.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class SmartCopy : SmartCopyTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class SmartCopy : SmartCopyTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopyTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopyTaskBase.cs index 5698fb0c49..666c90e731 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopyTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SmartCopyTaskBase.cs @@ -7,27 +7,25 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class SmartCopyTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class SmartCopyTaskBase : XamarinTask { readonly List copied = new List (); #region Inputs - public ITaskItem[] DestinationFiles { get; set; } + public ITaskItem [] DestinationFiles { get; set; } public ITaskItem DestinationFolder { get; set; } [Required] - public ITaskItem[] SourceFiles { get; set; } + public ITaskItem [] SourceFiles { get; set; } #endregion #region Outputs [Output] - public ITaskItem[] CopiedFiles { get; set; } + public ITaskItem [] CopiedFiles { get; set; } #endregion @@ -89,14 +87,14 @@ namespace Xamarin.MacDev.Tasks } for (int i = 0; i < SourceFiles.Length; i++) { - var target = DestinationFiles[i].GetMetadata ("FullPath"); - var source = SourceFiles[i].GetMetadata ("FullPath"); + var target = DestinationFiles [i].GetMetadata ("FullPath"); + var source = SourceFiles [i].GetMetadata ("FullPath"); var targetDir = Path.GetDirectoryName (target); EnsureDirectoryExists (targetDir); if (FileChanged (source, target)) - CopyFile (source, target, DestinationFiles[i].ItemSpec); + CopyFile (source, target, DestinationFiles [i].ItemSpec); } } else if (DestinationFolder != null) { var destinationFolder = DestinationFolder.GetMetadata ("FullPath"); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexer.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexer.cs index 0093061fb3..27fac6e477 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexer.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexer.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class SpotlightIndexer : SpotlightIndexerTaskBase - { +namespace Xamarin.MacDev.Tasks { + public class SpotlightIndexer : SpotlightIndexerTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexerTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexerTaskBase.cs index ec3f48533f..f6aad5e46e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexerTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SpotlightIndexerTaskBase.cs @@ -4,10 +4,8 @@ using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; -namespace Xamarin.MacDev.Tasks -{ - public abstract class SpotlightIndexerTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class SpotlightIndexerTaskBase : XamarinToolTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs index 083f65c59d..ba38e84e4d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStrip.cs @@ -7,10 +7,8 @@ using Xamarin.Messaging.Build.Client; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public class SymbolStrip : SymbolStripTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class SymbolStrip : SymbolStripTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStripTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStripTaskBase.cs index 1bd23e2832..d332ce567e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStripTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/SymbolStripTaskBase.cs @@ -9,14 +9,12 @@ using Microsoft.Build.Framework; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public abstract class SymbolStripTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class SymbolStripTaskBase : XamarinTask { #region Inputs [Required] - public ITaskItem[] Executable { get; set; } = Array.Empty (); + public ITaskItem [] Executable { get; set; } = Array.Empty (); // This can also be specified as metadata on the Executable item (as 'SymbolFile') public string SymbolFile { get; set; } = string.Empty; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlas.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlas.cs index 674270ad26..cc56255457 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlas.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlas.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class TextureAtlas : TextureAtlasTaskBase, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class TextureAtlas : TextureAtlasTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlasTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlasTaskBase.cs index d229b2587c..5334ec7545 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlasTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/TextureAtlasTaskBase.cs @@ -7,15 +7,13 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ - public abstract class TextureAtlasTaskBase : XcodeToolTaskBase - { +namespace Xamarin.MacDev.Tasks { + public abstract class TextureAtlasTaskBase : XcodeToolTaskBase { readonly Dictionary> atlases = new Dictionary> (); #region Inputs - public ITaskItem[] AtlasTextures { get; set; } + public ITaskItem [] AtlasTextures { get; set; } #endregion @@ -69,7 +67,7 @@ namespace Xamarin.MacDev.Tasks if (!File.Exists (plist)) return true; - var items = atlases[input.ItemSpec]; + var items = atlases [input.ItemSpec]; foreach (var item in items) { if (File.GetLastWriteTimeUtc (item.ItemSpec) > File.GetLastWriteTimeUtc (plist)) @@ -86,7 +84,7 @@ namespace Xamarin.MacDev.Tasks // group the atlas textures by their parent .atlas directories foreach (var item in AtlasTextures) { - var atlas = Path.GetDirectoryName (BundleResource.GetVirtualProjectPath (ProjectDir, item, !string.IsNullOrEmpty(SessionId))); + var atlas = Path.GetDirectoryName (BundleResource.GetVirtualProjectPath (ProjectDir, item, !string.IsNullOrEmpty (SessionId))); List items; if (!atlases.TryGetValue (atlas, out items)) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs index 291b7ca533..3af65bc219 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResources.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Framework; #nullable enable -namespace Xamarin.MacDev.Tasks -{ - public class UnpackLibraryResources : UnpackLibraryResourcesTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.MacDev.Tasks { + public class UnpackLibraryResources : UnpackLibraryResourcesTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { bool result; @@ -30,7 +28,7 @@ namespace Xamarin.MacDev.Tasks } } else { result = base.Execute (); - } + } return result; } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResourcesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResourcesTaskBase.cs index 52cce6defc..4e69e9606c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResourcesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/UnpackLibraryResourcesTaskBase.cs @@ -7,38 +7,36 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class UnpackLibraryResourcesTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class UnpackLibraryResourcesTaskBase : XamarinTask { List unpackedResources = new List (); - + #region Inputs [Required] public string Prefix { get; set; } [Required] - public ITaskItem[] NoOverwrite { get; set; } - + public ITaskItem [] NoOverwrite { get; set; } + [Required] public string IntermediateOutputPath { get; set; } [Required] - public ITaskItem[] ReferencedLibraries { get; set; } + public ITaskItem [] ReferencedLibraries { get; set; } [Required] - public ITaskItem[] TargetFrameworkDirectory { get; set; } + public ITaskItem [] TargetFrameworkDirectory { get; set; } #endregion #region Outputs [Output] - public ITaskItem[] BundleResourcesWithLogicalNames { get; set; } + public ITaskItem [] BundleResourcesWithLogicalNames { get; set; } [Output] - public ITaskItem[] UnpackedResources { get; set; } + public ITaskItem [] UnpackedResources { get; set; } #endregion @@ -175,7 +173,7 @@ namespace Xamarin.MacDev.Tasks bool escaped = false; for (int i = 0; i < mangled.Length; i++) { - char c = mangled[i]; + char c = mangled [i]; if (c == '_' && !escaped) { escaped = true; @@ -202,8 +200,7 @@ namespace Xamarin.MacDev.Tasks return unmangled.ToString (); } - public class ManifestResource - { + public class ManifestResource { readonly Func callback; public ManifestResource (string name, Func streamCallback) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifest.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifest.cs index 6547dadbb7..065ddba32c 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifest.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifest.cs @@ -5,10 +5,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class WriteAppManifest : WriteAppManifestTaskBase, ICancelableTask, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class WriteAppManifest : WriteAppManifestTaskBase, ICancelableTask, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifestTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifestTaskBase.cs index 68c9fc10e9..18c00c949f 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifestTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteAppManifestTaskBase.cs @@ -8,10 +8,8 @@ using Microsoft.Build.Framework; using Xamarin.Localization.MSBuild; -namespace Xamarin.MacDev.Tasks -{ - public abstract class WriteAppManifestTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class WriteAppManifestTaskBase : XamarinTask { #region Inputs [Required] @@ -19,7 +17,7 @@ namespace Xamarin.MacDev.Tasks public ITaskItem? AppBundleManifest { get; set; } [Required] - public ITaskItem[]? AppManifests { get; set; } + public ITaskItem []? AppManifests { get; set; } #endregion diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs index 016d719cec..68274591bb 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs @@ -1,6 +1,4 @@ -namespace Xamarin.MacDev.Tasks -{ - public class WriteItemsToFile : WriteItemsToFileBase - { +namespace Xamarin.MacDev.Tasks { + public class WriteItemsToFile : WriteItemsToFileBase { } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFileBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFileBase.cs index 898e5d3626..70d07b89df 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFileBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFileBase.cs @@ -8,11 +8,9 @@ using Microsoft.Build.Utilities; using Microsoft.Build.Tasks; using System.Xml.Linq; -namespace Xamarin.MacDev.Tasks -{ - public abstract class WriteItemsToFileBase : XamarinTask - { - static readonly XNamespace XmlNs = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003"); +namespace Xamarin.MacDev.Tasks { + public abstract class WriteItemsToFileBase : XamarinTask { + static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003"); static readonly XName ProjectElementName = XmlNs + "Project"; static readonly XName ItemGroupElementName = XmlNs + "ItemGroup"; @@ -20,8 +18,8 @@ namespace Xamarin.MacDev.Tasks #region Inputs - public ITaskItem[] Items { get; set; } - + public ITaskItem [] Items { get; set; } + public string ItemName { get; set; } [Output] @@ -38,12 +36,12 @@ namespace Xamarin.MacDev.Tasks { var items = this.Items; if (items == null) - items = new ITaskItem[0]; + items = new ITaskItem [0]; var document = new XDocument ( new XElement (ProjectElementName, new XElement (ItemGroupElementName, - items.Select (item => this.CreateElementFromItem(item))))); + items.Select (item => this.CreateElementFromItem (item))))); if (this.Overwrite && System.IO.File.Exists (this.File.ItemSpec)) System.IO.File.Delete (this.File.ItemSpec); @@ -66,11 +64,11 @@ namespace Xamarin.MacDev.Tasks private IEnumerable CreateMetadataFromItem (ITaskItem item) { if (this.IncludeMetadata) { - var metadata = item.CloneCustomMetadata(); + var metadata = item.CloneCustomMetadata (); return metadata.Keys .OfType () - .Select (key => new XElement (XmlNs + key.ToString (), metadata[key].ToString ())); + .Select (key => new XElement (XmlNs + key.ToString (), metadata [key].ToString ())); } return Enumerable.Empty (); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs index 9c2f660569..34533ad772 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs @@ -150,12 +150,12 @@ namespace Xamarin.MacDev.Tasks { public bool ShouldExecuteRemotely () => this.ShouldExecuteRemotely (SessionId); - protected void FileCopierReportErrorCallback (int code, string format, params object[] arguments) + protected void FileCopierReportErrorCallback (int code, string format, params object [] arguments) { Log.LogError (format, arguments); } - protected void FileCopierLogCallback (int min_verbosity, string format, params object[] arguments) + protected void FileCopierLogCallback (int min_verbosity, string format, params object [] arguments) { MessageImportance importance; if (min_verbosity <= 0) { diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs index 821c63fdbf..8d1d1f9ce8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeCompilerToolTask.cs @@ -15,10 +15,8 @@ using Xamarin.Localization.MSBuild; using Xamarin.MacDev; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class XcodeCompilerToolTask : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class XcodeCompilerToolTask : XamarinTask { protected bool Link { get; set; } IList prefixes; string toolExe; @@ -67,10 +65,10 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } [Output] - public ITaskItem[] OutputManifests { get; set; } + public ITaskItem [] OutputManifests { get; set; } #endregion @@ -164,7 +162,7 @@ namespace Xamarin.MacDev.Tasks yield break; } - protected abstract void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem[] items); + protected abstract void AppendCommandLineArguments (IDictionary environment, CommandLineArgumentBuilder args, ITaskItem [] items); static bool? translated; @@ -182,7 +180,7 @@ namespace Xamarin.MacDev.Tasks return translated.Value; } - protected int Compile (ITaskItem[] items, string output, ITaskItem manifest) + protected int Compile (ITaskItem [] items, string output, ITaskItem manifest) { var environment = new Dictionary (); var args = new CommandLineArgumentBuilder (); @@ -236,7 +234,7 @@ namespace Xamarin.MacDev.Tasks // again (in case of ibtool's infamous spurious errors). var errors = rv.StandardError.ToString (); if (errors.Length > 0) - Log.LogError (null, null, null, items[0].ItemSpec, 0, 0, 0, 0, "{0}", errors); + Log.LogError (null, null, null, items [0].ItemSpec, 0, 0, 0, 0, "{0}", errors); Log.LogError (MSBStrings.E0117, ToolName, exitCode); @@ -245,7 +243,7 @@ namespace Xamarin.MacDev.Tasks try { var plist = PDictionary.FromFile (manifest.ItemSpec); - LogWarningsAndErrors (plist, items[0]); + LogWarningsAndErrors (plist, items [0]); } catch (Exception ex) { Log.LogError (MSBStrings.E0094, ToolName, manifest.ItemSpec, ex.Message); } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeToolTaskBase.cs index bc18c72339..e6518fcdde 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeToolTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XcodeToolTaskBase.cs @@ -10,10 +10,8 @@ using Xamarin.Localization.MSBuild; using Xamarin.MacDev; -namespace Xamarin.MacDev.Tasks -{ - public abstract class XcodeToolTaskBase : XamarinTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class XcodeToolTaskBase : XamarinTask { string toolExe; #region Inputs @@ -48,7 +46,7 @@ namespace Xamarin.MacDev.Tasks #region Outputs [Output] - public ITaskItem[] BundleResources { get; set; } + public ITaskItem [] BundleResources { get; set; } #endregion @@ -76,7 +74,7 @@ namespace Xamarin.MacDev.Tasks protected virtual string GetBundleRelativeOutputPath (IList prefixes, ITaskItem input) { - return BundleResource.GetLogicalName (ProjectDir, prefixes, input, !string.IsNullOrEmpty(SessionId)); + return BundleResource.GetLogicalName (ProjectDir, prefixes, input, !string.IsNullOrEmpty (SessionId)); } protected virtual IEnumerable GetCompiledBundleResources (ITaskItem input, ITaskItem output) @@ -109,7 +107,7 @@ namespace Xamarin.MacDev.Tasks startInfo.WorkingDirectory = Environment.CurrentDirectory; foreach (var variable in environment) - startInfo.EnvironmentVariables[variable.Key] = variable.Value; + startInfo.EnvironmentVariables [variable.Key] = variable.Value; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/Zip.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/Zip.cs index a3a5620baa..c79f8be7c4 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/Zip.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/Zip.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class Zip : ZipTaskBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class Zip : ZipTaskBase, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ZipTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ZipTaskBase.cs index b51f8982fd..689274ebe9 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ZipTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ZipTaskBase.cs @@ -6,10 +6,8 @@ using Microsoft.Build.Utilities; using Xamarin.Utils; -namespace Xamarin.MacDev.Tasks -{ - public abstract class ZipTaskBase : XamarinToolTask - { +namespace Xamarin.MacDev.Tasks { + public abstract class ZipTaskBase : XamarinToolTask { #region Inputs [Output] @@ -19,7 +17,7 @@ namespace Xamarin.MacDev.Tasks public bool Recursive { get; set; } [Required] - public ITaskItem[] Sources { get; set; } + public ITaskItem [] Sources { get; set; } public bool Symlinks { get; set; } @@ -61,7 +59,7 @@ namespace Xamarin.MacDev.Tasks var root = WorkingDirectory.GetMetadata ("FullPath"); for (int i = 0; i < Sources.Length; i++) { - var relative = PathUtils.AbsoluteToRelative (root, Sources[i].GetMetadata ("FullPath")); + var relative = PathUtils.AbsoluteToRelative (root, Sources [i].GetMetadata ("FullPath")); args.AddQuoted (relative); } diff --git a/msbuild/Xamarin.MacDev.Tasks/VerbosityUtils.cs b/msbuild/Xamarin.MacDev.Tasks/VerbosityUtils.cs index f10080d1f5..f0797ef078 100644 --- a/msbuild/Xamarin.MacDev.Tasks/VerbosityUtils.cs +++ b/msbuild/Xamarin.MacDev.Tasks/VerbosityUtils.cs @@ -12,12 +12,12 @@ namespace Xamarin.MacDev.Tasks { // verbosity can be set in multiple ways // this makes it a consistent interpretation of them - static public string[] Merge (string extraArguments, LoggerVerbosity taskVerbosity) + static public string [] Merge (string extraArguments, LoggerVerbosity taskVerbosity) { - string[] result = Array.Empty (); + string [] result = Array.Empty (); var empty_extra = String.IsNullOrEmpty (extraArguments); // We give the priority to the extra arguments given to the tools - if (empty_extra || (!empty_extra && !extraArguments.Contains ("-q") && !extraArguments.Contains ("-v"))) { + if (empty_extra || (!empty_extra && !extraArguments.Contains ("-q") && !extraArguments.Contains ("-v"))) { // if nothing is specified fall back to msbuild settings // first check if some were supplied on the command-line result = GetVerbosityLevel (Environment.CommandLine); @@ -39,7 +39,7 @@ namespace Xamarin.MacDev.Tasks { // The available verbosity levels are: q[uiet], m[inimal], // n[ormal], d[etailed], and diag[nostic]. (Short form: -v) // - static public string[] GetVerbosityLevel (string commandLine) + static public string [] GetVerbosityLevel (string commandLine) { if (!StringUtils.TryParseArguments (commandLine, out var args, out _)) return GetVerbosityLevel (LoggerVerbosity.Normal); @@ -99,7 +99,7 @@ namespace Xamarin.MacDev.Tasks { // The values here come from: https://github.com/mono/monodevelop/blob/143f9b6617123a0841a5cc5a2a4e13b309535792/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild.Shared/RemoteBuildEngineMessages.cs#L186 // Assume 'Normal (2)' is the default verbosity (no change), and the other values follow from there. - static public string[] GetVerbosityLevel (LoggerVerbosity v) + static public string [] GetVerbosityLevel (LoggerVerbosity v) { switch ((LoggerVerbosity) v) { case LoggerVerbosity.Quiet: diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Properties/AssemblyInfo.cs b/msbuild/Xamarin.iOS.Tasks.Windows/Properties/AssemblyInfo.cs index ecdf4bb399..b2bee70d6b 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Properties/AssemblyInfo.cs +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Properties/AssemblyInfo.cs @@ -7,4 +7,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyInformationalVersionAttribute (VersionConstants.XamarinIOSVersion + "." + VersionConstants.NuGetPrereleaseIdentifier + "+" + VersionConstants.NuGetBuildMetadata)] [assembly: AssemblyProductAttribute ("Xamarin.iOS.Tasks.Windows")] [assembly: AssemblyTitleAttribute ("Xamarin.iOS.Tasks.Windows")] -[assembly: AssemblyVersionAttribute (VersionConstants.XamarinIOSVersion)] \ No newline at end of file +[assembly: AssemblyVersionAttribute (VersionConstants.XamarinIOSVersion)] diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs b/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs index d6bd2d525b..304a30b1f6 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/CompileAppManifest.cs @@ -8,11 +8,9 @@ using Xamarin.MacDev; #nullable enable -namespace Xamarin.iOS.HotRestart.Tasks -{ - public class CompileAppManifest : Task - { - static readonly string[] IgnorePlistKeys = { +namespace Xamarin.iOS.HotRestart.Tasks { + public class CompileAppManifest : Task { + static readonly string [] IgnorePlistKeys = { "XSAppIconAssets", "CFBundleIconName", "XSLaunchImageAssets", @@ -37,44 +35,37 @@ namespace Xamarin.iOS.HotRestart.Tasks #endregion - public override bool Execute() + public override bool Execute () { - try - { - var preBuiltInfoPlistPath = Path.Combine(AppBundlePath, "Info.plist"); + try { + var preBuiltInfoPlistPath = Path.Combine (AppBundlePath, "Info.plist"); - if (!File.Exists(preBuiltInfoPlistPath)) - { - throw new Exception(string.Format(Resources.CompileAppManifest_MissinInfoPList, preBuiltInfoPlistPath)); + if (!File.Exists (preBuiltInfoPlistPath)) { + throw new Exception (string.Format (Resources.CompileAppManifest_MissinInfoPList, preBuiltInfoPlistPath)); } - var infoPlist = PDictionary.FromFile(AppManifestPath); - var preBuiltInfoPlist = PDictionary.FromFile(preBuiltInfoPlistPath); + var infoPlist = PDictionary.FromFile (AppManifestPath); + var preBuiltInfoPlist = PDictionary.FromFile (preBuiltInfoPlistPath); - foreach (var item in infoPlist) - { - if (!IgnorePlistKeys.Contains(item.Key)) - { - if (preBuiltInfoPlist.ContainsKey(item.Key)) - { - preBuiltInfoPlist.Remove(item.Key); + foreach (var item in infoPlist) { + if (!IgnorePlistKeys.Contains (item.Key)) { + if (preBuiltInfoPlist.ContainsKey (item.Key)) { + preBuiltInfoPlist.Remove (item.Key); } - preBuiltInfoPlist.Add(item.Key, item.Value.Clone()); + preBuiltInfoPlist.Add (item.Key, item.Value.Clone ()); } } if (!string.IsNullOrEmpty (ApplicationTitle)) { - preBuiltInfoPlist[ManifestKeys.CFBundleDisplayName] = ApplicationTitle; + preBuiltInfoPlist [ManifestKeys.CFBundleDisplayName] = ApplicationTitle; } - preBuiltInfoPlist.Save(preBuiltInfoPlistPath, binary: true); + preBuiltInfoPlist.Save (preBuiltInfoPlistPath, binary: true); return true; - } - catch (Exception ex) - { - Log.LogErrorFromException(ex); + } catch (Exception ex) { + Log.LogErrorFromException (ex); return false; } diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets index 40e82e95b6..6767aa896c 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Common.After.targets @@ -314,6 +314,9 @@ Copyright (C) 2011-2013 Xamarin. All rights reserved. <_RemoteILLinkPath>$(ILLinkTasksAssembly.Replace('$(NetCoreRoot)', '$(_DotNetRootRemoteDirectory)').Replace('net472', 'net$(BundledNETCoreAppTargetFrameworkVersion)').Replace('$([System.IO.Path]::GetFileName('$(ILLinkTasksAssembly)'))', 'illink.dll')) + + + $(_TrimmerDefaultAction) diff --git a/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs b/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs index 07b8a5d69c..9f730e7333 100644 --- a/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs +++ b/msbuild/Xamarin.iOS.Tasks.Windows/Zip.cs @@ -3,9 +3,8 @@ using System.IO; using System.IO.Compression; namespace Xamarin.iOS.Tasks.Windows { - internal static class Zip - { - internal static void Extract(string sourceFileName, string destinationPath) + internal static class Zip { + internal static void Extract (string sourceFileName, string destinationPath) { // We use a temp dir because the extraction dir should not exist for the ZipFile API to work var tempExtractionPath = Path.Combine (Path.GetTempPath (), Guid.NewGuid ().ToString ().Substring (0, 4)); diff --git a/msbuild/Xamarin.iOS.Tasks/Contracts/VerifyXcodeVersionMessage.cs b/msbuild/Xamarin.iOS.Tasks/Contracts/VerifyXcodeVersionMessage.cs index 0b5f53ccef..04c24a0f39 100644 --- a/msbuild/Xamarin.iOS.Tasks/Contracts/VerifyXcodeVersionMessage.cs +++ b/msbuild/Xamarin.iOS.Tasks/Contracts/VerifyXcodeVersionMessage.cs @@ -1,5 +1,5 @@ namespace Xamarin.Messaging.Build.Contracts { - [Topic("xi/build/verify-xcode-version")] + [Topic ("xi/build/verify-xcode-version")] public class VerifyXcodeVersionMessage { } } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacks.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacks.cs index 17ff653a45..3858122b8f 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacks.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacks.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class CollectAssetPacks : CollectAssetPacksTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class CollectAssetPacks : CollectAssetPacksTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacksTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacksTaskBase.cs index 7ebca2183c..aac505e9ea 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacksTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectAssetPacksTaskBase.cs @@ -7,10 +7,8 @@ using Microsoft.Build.Framework; using Xamarin.MacDev.Tasks; -namespace Xamarin.iOS.Tasks -{ - public abstract class CollectAssetPacksTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class CollectAssetPacksTaskBase : XamarinTask { #region Inputs [Required] @@ -21,7 +19,7 @@ namespace Xamarin.iOS.Tasks #region Outputs [Output] - public ITaskItem[] AssetPacks { get; set; } + public ITaskItem [] AssetPacks { get; set; } #endregion @@ -33,7 +31,7 @@ namespace Xamarin.iOS.Tasks //We need to add the directory separator at the end of the path //so the TaskRunner don't get confused, copying the asset pack as a file assetpacks.Add (new TaskItem (dir + Path.DirectorySeparatorChar)); - } + } AssetPacks = assetpacks.ToArray (); diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtwork.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtwork.cs index b52a011e82..32604e79f8 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtwork.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtwork.cs @@ -3,10 +3,8 @@ using System.Linq; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class CollectITunesArtwork : CollectITunesArtworkTaskBase, ITaskCallback, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class CollectITunesArtwork : CollectITunesArtworkTaskBase, ITaskCallback, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtworkTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtworkTaskBase.cs index 96c23e5f5f..36f5acbec3 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtworkTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesArtworkTaskBase.cs @@ -10,20 +10,18 @@ using Microsoft.Build.Utilities; using Xamarin.MacDev.Tasks; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class CollectITunesArtworkTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class CollectITunesArtworkTaskBase : XamarinTask { #region Inputs - public ITaskItem[] ITunesArtwork { get; set; } + public ITaskItem [] ITunesArtwork { get; set; } #endregion #region Outputs [Output] - public ITaskItem[] ITunesArtworkWithLogicalNames { get; set; } + public ITaskItem [] ITunesArtworkWithLogicalNames { get; set; } #endregion @@ -50,15 +48,15 @@ namespace Xamarin.iOS.Tasks reader = new BinaryReader (File.OpenRead (path)); var pngHeader = reader.ReadBytes (8); // Check for valid PNG header. - if (pngHeader[0] != 137 || - pngHeader[1] != 80 || pngHeader[2] != 78 || pngHeader [3] != 71 || + if (pngHeader [0] != 137 || + pngHeader [1] != 80 || pngHeader [2] != 78 || pngHeader [3] != 71 || pngHeader [4] != 13 || pngHeader [5] != 10 || pngHeader [6] != 26 || pngHeader [7] != 10) return false; // First chunk is always the IHDR header chunk reader.ReadBytes (4); // skip chunk size var ihdrID = reader.ReadBytes (4); - if (ihdrID[0] != 73 || ihdrID[1] != 72 || ihdrID[2] != 68 || ihdrID[3] != 82) + if (ihdrID [0] != 73 || ihdrID [1] != 72 || ihdrID [2] != 68 || ihdrID [3] != 82) return false; width = ReadInt (reader); @@ -93,8 +91,7 @@ namespace Xamarin.iOS.Tasks extern static void CGImageRelease (/* CGImageRef */ IntPtr image); // untyped enum -> CGColorSpace.h - enum CGColorRenderingIntent - { + enum CGColorRenderingIntent { Default, AbsoluteColorimetric, RelativeColorimetric, diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFiles.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFiles.cs index 5bc1e58075..a06b281cd0 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFiles.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFiles.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class CollectITunesSourceFiles : CollectITunesSourceFilesTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class CollectITunesSourceFiles : CollectITunesSourceFilesTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFilesTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFilesTaskBase.cs index bbe6c46766..b65fc73aea 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFilesTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CollectITunesSourceFilesTaskBase.cs @@ -7,11 +7,9 @@ using Microsoft.Build.Framework; using Xamarin.MacDev.Tasks; -namespace Xamarin.iOS.Tasks -{ - public abstract class CollectITunesSourceFilesTaskBase : XamarinTask - { - static readonly string[] iTunesFileNames = { "iTunesMetadata.plist", "iTunesArtwork@2x", "iTunesArtwork" }; +namespace Xamarin.iOS.Tasks { + public abstract class CollectITunesSourceFilesTaskBase : XamarinTask { + static readonly string [] iTunesFileNames = { "iTunesMetadata.plist", "iTunesArtwork@2x", "iTunesArtwork" }; #region Inputs @@ -23,7 +21,7 @@ namespace Xamarin.iOS.Tasks #region Outputs [Output] - public ITaskItem[] ITunesSourceFiles { get; set; } + public ITaskItem [] ITunesSourceFiles { get; set; } #endregion diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadata.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadata.cs index 93a3ad41b9..fc42939f7b 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadata.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadata.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class CompileITunesMetadata : CompileITunesMetadataTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class CompileITunesMetadata : CompileITunesMetadataTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadataTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadataTaskBase.cs index bfc32ede15..e9da13bf89 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadataTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CompileITunesMetadataTaskBase.cs @@ -8,10 +8,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.MacDev; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class CompileITunesMetadataTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class CompileITunesMetadataTaskBase : XamarinTask { #region Inputs [Required] @@ -21,7 +19,7 @@ namespace Xamarin.iOS.Tasks public string BundleVersion { get; set; } - public ITaskItem[] ITunesMetadata { get; set; } + public ITaskItem [] ITunesMetadata { get; set; } [Output] [Required] @@ -39,7 +37,7 @@ namespace Xamarin.iOS.Tasks return false; } - var path = ITunesMetadata[0].GetMetadata ("FullPath"); + var path = ITunesMetadata [0].GetMetadata ("FullPath"); try { metadata = PDictionary.FromFile (path); diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPack.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPack.cs index 435a6ffac4..16cec11b85 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPack.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPack.cs @@ -1,9 +1,7 @@ using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class CreateAssetPack : CreateAssetPackTaskBase - { +namespace Xamarin.iOS.Tasks { + public class CreateAssetPack : CreateAssetPackTaskBase { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPackTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPackTaskBase.cs index 428e12ae11..693e25f66e 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPackTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/CreateAssetPackTaskBase.cs @@ -5,10 +5,8 @@ using System.IO; using Xamarin.MacDev; using Xamarin.MacDev.Tasks; -namespace Xamarin.iOS.Tasks -{ - public abstract class CreateAssetPackTaskBase : XamarinToolTask - { +namespace Xamarin.iOS.Tasks { + public abstract class CreateAssetPackTaskBase : XamarinToolTask { #region Inputs [Required] @@ -82,7 +80,7 @@ namespace Xamarin.iOS.Tasks // We need to delete any existing ipa files, zip will just add to it otherwise if (File.Exists (OutputFile.ItemSpec)) File.Delete (OutputFile.ItemSpec); - + return base.Execute (); } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundle.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundle.cs index f801848ea3..8f20df852a 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundle.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundle.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class FindWatchOS2AppBundle : FindWatchOS2AppBundleTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class FindWatchOS2AppBundle : FindWatchOS2AppBundleTaskBase, ICancelableTask { public override bool Execute () { if (!ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundleTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundleTaskBase.cs index fc0e82ba0b..2181245dbb 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundleTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/FindWatchOS2AppBundleTaskBase.cs @@ -7,14 +7,12 @@ using Xamarin.MacDev.Tasks; using Xamarin.MacDev; using Xamarin.Utils; -namespace Xamarin.iOS.Tasks -{ - public abstract class FindWatchOS2AppBundleTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class FindWatchOS2AppBundleTaskBase : XamarinTask { #region Inputs [Required] - public ITaskItem[] WatchAppReferences { get; set; } + public ITaskItem [] WatchAppReferences { get; set; } #endregion Inputs @@ -30,7 +28,7 @@ namespace Xamarin.iOS.Tasks var pwd = PathUtils.ResolveSymbolicLinks (Environment.CurrentDirectory); if (WatchAppReferences.Length > 0) { - WatchOS2AppBundle = PathUtils.AbsoluteToRelative (pwd, PathUtils.ResolveSymbolicLinks (WatchAppReferences[0].ItemSpec)); + WatchOS2AppBundle = PathUtils.AbsoluteToRelative (pwd, PathUtils.ResolveSymbolicLinks (WatchAppReferences [0].ItemSpec)); return true; } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/GetMlaunchArguments.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/GetMlaunchArguments.cs index 3352c6b8f2..3ce9421499 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/GetMlaunchArguments.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/GetMlaunchArguments.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class GetMlaunchArguments : GetMlaunchArgumentsTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class GetMlaunchArguments : GetMlaunchArgumentsTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ILLink.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ILLink.cs index a5c20e5160..3079bbdfeb 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ILLink.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ILLink.cs @@ -2,10 +2,8 @@ using ILLink.Tasks; using Microsoft.Build.Tasks; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class ILLink : ILLinkBase - { +namespace Xamarin.iOS.Tasks { + public class ILLink : ILLinkBase { public override bool Execute () { if (this.ShouldExecuteRemotely (SessionId)) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ILLinkBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ILLinkBase.cs index d92ed0b072..0efa07615d 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ILLinkBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ILLinkBase.cs @@ -4,8 +4,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace ILLink.Tasks { - public class ILLinkBase : ILLink - { + public class ILLinkBase : ILLink { public string SessionId { get; set; } public ITaskItem [] DebugSymbols { get; set; } @@ -26,23 +25,20 @@ namespace ILLink.Tasks { var linkerItems = new List (); var linkedItems = new List (); - if (result) - { + if (result) { // Adds all the files in the linker-items dir - foreach (var item in Directory.EnumerateFiles (LinkerItemsDirectory)) - { + foreach (var item in Directory.EnumerateFiles (LinkerItemsDirectory)) { linkerItems.Add (new TaskItem (item)); } // Adds all the files in the linked output dir - foreach (var item in Directory.EnumerateFiles (OutputDirectory.ItemSpec)) - { + foreach (var item in Directory.EnumerateFiles (OutputDirectory.ItemSpec)) { linkedItems.Add (new TaskItem (item)); } } LinkerOutputItems = linkerItems.ToArray (); - LinkedItems = linkedItems.ToArray(); + LinkedItems = linkedItems.ToArray (); return result; } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs index 3ed081d294..2b7956dfb6 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs @@ -4,10 +4,8 @@ using Microsoft.Build.Tasks; using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.MacDev.Tasks -{ - public class ILStrip : ILStripTasks.ILStripBase, ITaskCallback - { +namespace Xamarin.MacDev.Tasks { + public class ILStrip : ILStripTasks.ILStripBase, ITaskCallback { public override bool Execute () { if (this.ShouldExecuteRemotely (SessionId)) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs index cc3c4e6803..f5d61c3ea2 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs @@ -6,8 +6,7 @@ using Microsoft.Build.Utilities; // Normally this would be ILStrip.Tasks but ILStrip is in the global namespace // And having a type and the parent namespace have the same name really confuses the compiler namespace ILStripTasks { - public class ILStripBase : ILStrip - { + public class ILStripBase : ILStrip { public string SessionId { get; set; } [Output] @@ -19,15 +18,13 @@ namespace ILStripTasks { var stripedItems = new List (); - if (result) - { - foreach (var item in Assemblies) - { - stripedItems.Add (new TaskItem (item.GetMetadata("OutputPath"), item.CloneCustomMetadata ())); + if (result) { + foreach (var item in Assemblies) { + stripedItems.Add (new TaskItem (item.GetMetadata ("OutputPath"), item.CloneCustomMetadata ())); } } - StrippedAssemblies = stripedItems.ToArray(); + StrippedAssemblies = stripedItems.ToArray (); return result; } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/MTouch.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/MTouch.cs index c7fd25ff05..1a7fe9c843 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/MTouch.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/MTouch.cs @@ -5,10 +5,8 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class MTouch : MTouchTaskBase, ITaskCallback - { +namespace Xamarin.iOS.Tasks { + public class MTouch : MTouchTaskBase, ITaskCallback { public ITaskItem [] ConfigFiles { get; set; } public override bool Execute () @@ -70,7 +68,7 @@ namespace Xamarin.iOS.Tasks { base.Cancel (); - if (!string.IsNullOrEmpty(SessionId)) + if (!string.IsNullOrEmpty (SessionId)) BuildConnection.CancelAsync (SessionId, BuildEngine4).Wait (); } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/MTouchTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/MTouchTaskBase.cs index 7fb6e98962..fa846264bc 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/MTouchTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/MTouchTaskBase.cs @@ -11,10 +11,8 @@ using Xamarin.MacDev; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class MTouchTaskBase : BundlerToolTaskBase - { +namespace Xamarin.iOS.Tasks { + public abstract class MTouchTaskBase : BundlerToolTaskBase { #region Inputs public string Architectures { get; set; } @@ -31,8 +29,8 @@ namespace Xamarin.iOS.Tasks [Required] public bool FastDev { get; set; } - - public ITaskItem[] LinkDescriptions { get; set; } + + public ITaskItem [] LinkDescriptions { get; set; } public string Interpreter { get; set; } @@ -58,7 +56,7 @@ namespace Xamarin.iOS.Tasks public bool UseThumb { get; set; } [Required] - public ITaskItem[] AppExtensionReferences { get; set; } + public ITaskItem [] AppExtensionReferences { get; set; } #endregion @@ -70,7 +68,7 @@ namespace Xamarin.iOS.Tasks public ITaskItem NativeExecutable { get; set; } [Output] - public ITaskItem[] CopiedFrameworks { get; set; } + public ITaskItem [] CopiedFrameworks { get; set; } #endregion @@ -91,7 +89,7 @@ namespace Xamarin.iOS.Tasks if (startIndex >= text.Length) return string.Empty; - if (text[startIndex] != '"') + if (text [startIndex] != '"') return text.Substring (startIndex); var builder = new StringBuilder (); @@ -99,7 +97,7 @@ namespace Xamarin.iOS.Tasks var quoted = true; for (int i = startIndex; i < text.Length && quoted; i++) { - switch (text[i]) { + switch (text [i]) { case '\\': if (escaped) builder.Append ('\\'); @@ -114,7 +112,7 @@ namespace Xamarin.iOS.Tasks } break; default: - builder.Append (text[i]); + builder.Append (text [i]); escaped = false; break; } @@ -137,7 +135,7 @@ namespace Xamarin.iOS.Tasks Log.LogError (MSBStrings.E0053); return null; } - + args.AddQuotedLine ((SdkIsSimulator ? "--sim=" : "--dev=") + Path.GetFullPath (AppBundleDir)); args.AddQuotedLine ($"--executable={ExecutableName}"); @@ -158,7 +156,7 @@ namespace Xamarin.iOS.Tasks switch (LinkMode.ToLowerInvariant ()) { case "sdkonly": args.AddLine ("--linksdkonly"); break; - case "none": args.AddLine ("--nolink"); break; + case "none": args.AddLine ("--nolink"); break; } args.AddQuotedLine ($"--sdk={SdkVersion}"); @@ -263,14 +261,14 @@ namespace Xamarin.iOS.Tasks }; for (int i = 0; i < extraArgs.Length; i++) { - var argument = extraArgs[i]; + var argument = extraArgs [i]; int startIndex = 0; - while (argument.Length > startIndex && argument[startIndex] == '-') + while (argument.Length > startIndex && argument [startIndex] == '-') startIndex++; int endIndex = startIndex; - while (endIndex < argument.Length && argument[endIndex] != '=') + while (endIndex < argument.Length && argument [endIndex] != '=') endIndex++; int length = endIndex - startIndex; @@ -279,17 +277,17 @@ namespace Xamarin.iOS.Tasks // user-defined -gcc_flags argument string flags = null; - if (endIndex < extraArgs[i].Length) { + if (endIndex < extraArgs [i].Length) { flags = Unquote (argument, endIndex + 1); } else if (i + 1 < extraArgs.Length) { - flags = extraArgs[++i]; + flags = extraArgs [++i]; } if (!string.IsNullOrEmpty (flags)) { var gccArgs = CommandLineArgumentBuilder.Parse (flags); for (int j = 0; j < gccArgs.Length; j++) - gcc.Arguments.Add (StringParserService.Parse (gccArgs[j], customTags)); + gcc.Arguments.Add (StringParserService.Parse (gccArgs [j], customTags)); } } else { // other user-defined mtouch arguments @@ -314,7 +312,7 @@ namespace Xamarin.iOS.Tasks unescapedArgs.Add ($"--gcc_flags={gcc.Arguments.ToString ()}"); foreach (var asm in References) { - if (IsFrameworkItem(asm)) { + if (IsFrameworkItem (asm)) { args.AddQuotedLine ($"--reference={ResolveFrameworkFile (asm.ItemSpec)}"); } else { args.AddQuotedLine ($"--reference={Path.GetFullPath (asm.ItemSpec)}"); @@ -334,8 +332,8 @@ namespace Xamarin.iOS.Tasks { bool isFrameworkFile; - return (bool.TryParse(item.GetMetadata("FrameworkFile"), out isFrameworkFile) && isFrameworkFile) || - item.GetMetadata ("ResolvedFrom") == "{TargetFrameworkDirectory}" || + return (bool.TryParse (item.GetMetadata ("FrameworkFile"), out isFrameworkFile) && isFrameworkFile) || + item.GetMetadata ("ResolvedFrom") == "{TargetFrameworkDirectory}" || item.GetMetadata ("ResolvedFrom") == "ImplicitlyExpandDesignTimeFacades"; } @@ -359,7 +357,7 @@ namespace Xamarin.iOS.Tasks return result; } - ITaskItem[] GetCopiedFrameworks () + ITaskItem [] GetCopiedFrameworks () { var copiedFrameworks = new List (); var frameworksDir = Path.Combine (AppBundleDir, "Frameworks"); @@ -388,7 +386,7 @@ namespace Xamarin.iOS.Tasks return ResolveFrameworkFileOrFacade (frameworkDir, fileName) ?? fullName; } - + static string ResolveFrameworkFileOrFacade (string frameworkDir, string fileName) { var facadeFile = Path.Combine (Sdks.XamIOS.LibDir, "mono", frameworkDir, "Facades", fileName); diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformation.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformation.cs index 733127b7b3..ea197882e4 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformation.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformation.cs @@ -1,6 +1,4 @@ -namespace Xamarin.iOS.Tasks -{ - public class ParseDeviceSpecificBuildInformation : ParseDeviceSpecificBuildInformationTaskBase - { +namespace Xamarin.iOS.Tasks { + public class ParseDeviceSpecificBuildInformation : ParseDeviceSpecificBuildInformationTaskBase { } } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformationTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformationTaskBase.cs index 57579e74ed..53beb6f1a5 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformationTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ParseDeviceSpecificBuildInformationTaskBase.cs @@ -9,10 +9,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class ParseDeviceSpecificBuildInformationTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class ParseDeviceSpecificBuildInformationTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchApp.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchApp.cs index ea1ce76ca7..d7a32f42d9 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchApp.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchApp.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class ResolveNativeWatchApp : ResolveNativeWatchAppTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class ResolveNativeWatchApp : ResolveNativeWatchAppTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchAppTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchAppTaskBase.cs index 74f2e79201..99b8ef7103 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchAppTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ResolveNativeWatchAppTaskBase.cs @@ -9,10 +9,8 @@ using Xamarin.MacDev; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class ResolveNativeWatchAppTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class ResolveNativeWatchAppTaskBase : XamarinTask { #region Inputs [Required] diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTask.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTask.cs index 65071d7da3..e7ebde763f 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTask.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTask.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class ValidateAppBundleTask : ValidateAppBundleTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class ValidateAppBundleTask : ValidateAppBundleTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTaskBase.cs index 94742953f6..522a040a37 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/ValidateAppBundleTaskBase.cs @@ -10,10 +10,8 @@ using Xamarin.MacDev.Tasks; using Xamarin.Utils; using Xamarin.Localization.MSBuild; -namespace Xamarin.iOS.Tasks -{ - public abstract class ValidateAppBundleTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class ValidateAppBundleTaskBase : XamarinTask { #region Inputs [Required] @@ -302,13 +300,13 @@ namespace Xamarin.iOS.Tasks if (supportedPlatforms == null || supportedPlatforms.Count == 0) { Log.LogError (7043, mainInfoPath, MSBStrings.E7043, mainInfoPath); } else { - platform = (PString) supportedPlatforms[0]; + platform = (PString) supportedPlatforms [0]; } // Validate UIDeviceFamily var deviceTypes = plist.GetUIDeviceFamily (); var deviceFamilies = deviceTypes.ToDeviceFamily (); - AppleDeviceFamily[] validFamilies = null; + AppleDeviceFamily [] validFamilies = null; AppleDeviceFamily [] requiredFamilies = null; switch (Platform) { @@ -318,16 +316,16 @@ namespace Xamarin.iOS.Tasks }; goto case ApplePlatform.iOS; case ApplePlatform.iOS: - validFamilies = new AppleDeviceFamily[] { + validFamilies = new AppleDeviceFamily [] { AppleDeviceFamily.IPhone, AppleDeviceFamily.IPad, }; break; case ApplePlatform.WatchOS: - validFamilies = new AppleDeviceFamily[] { AppleDeviceFamily.Watch }; + validFamilies = new AppleDeviceFamily [] { AppleDeviceFamily.Watch }; break; case ApplePlatform.TVOS: - validFamilies = new AppleDeviceFamily[] { AppleDeviceFamily.TV }; + validFamilies = new AppleDeviceFamily [] { AppleDeviceFamily.TV }; break; default: Log.LogError ("Invalid platform: {0}", Platform); diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/VerifyXcodeVersion.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/VerifyXcodeVersion.cs index 4c6293b6fd..52b34837c7 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/VerifyXcodeVersion.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/VerifyXcodeVersion.cs @@ -13,7 +13,7 @@ namespace Xamarin.iOS.Tasks { public override bool Execute () => ExecuteAsync ().Result; - async Threading.Task ExecuteAsync() + async Threading.Task ExecuteAsync () { try { var connection = await BuildConnection.GetAsync (SessionId, BuildEngine4).ConfigureAwait (continueOnCapturedContext: false); @@ -30,10 +30,10 @@ namespace Xamarin.iOS.Tasks { .ConfigureAwait (continueOnCapturedContext: false); if (!xcodeVerificationResult.IsCompatibleVersion) { - if (string.IsNullOrEmpty(xcodeVerificationResult.XcodeVersion) || string.IsNullOrEmpty(xcodeVerificationResult.RecommendedXcodeVersion)) { + if (string.IsNullOrEmpty (xcodeVerificationResult.XcodeVersion) || string.IsNullOrEmpty (xcodeVerificationResult.RecommendedXcodeVersion)) { Log.LogWarning (MSBStrings.E0183); } else { - Log.LogWarning (MSBStrings.E0184, xcodeVerificationResult.XcodeVersion, xcodeVerificationResult.RecommendedXcodeVersion); + Log.LogWarning (MSBStrings.E0184, xcodeVerificationResult.XcodeVersion, xcodeVerificationResult.RecommendedXcodeVersion); } } diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifest.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifest.cs index bdc76b791c..a69f7ffc3e 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifest.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifest.cs @@ -1,10 +1,8 @@ using Microsoft.Build.Framework; using Xamarin.Messaging.Build.Client; -namespace Xamarin.iOS.Tasks -{ - public class WriteAssetPackManifest : WriteAssetPackManifestTaskBase, ICancelableTask - { +namespace Xamarin.iOS.Tasks { + public class WriteAssetPackManifest : WriteAssetPackManifestTaskBase, ICancelableTask { public override bool Execute () { if (ShouldExecuteRemotely ()) diff --git a/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifestTaskBase.cs b/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifestTaskBase.cs index 3a6563a570..dd4c0d16df 100644 --- a/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifestTaskBase.cs +++ b/msbuild/Xamarin.iOS.Tasks/Tasks/WriteAssetPackManifestTaskBase.cs @@ -5,10 +5,8 @@ using Xamarin.MacDev; using System.Linq; using Xamarin.MacDev.Tasks; -namespace Xamarin.iOS.Tasks -{ - public abstract class WriteAssetPackManifestTaskBase : XamarinTask - { +namespace Xamarin.iOS.Tasks { + public abstract class WriteAssetPackManifestTaskBase : XamarinTask { #region Inputs [Required] @@ -45,7 +43,7 @@ namespace Xamarin.iOS.Tasks url.Value = OnDemandResourceUrl + name; - resource["isStreamable"] = new PNumber (IsStreamable ? 1 : 0); + resource ["isStreamable"] = new PNumber (IsStreamable ? 1 : 0); } template.Save (OutputFile.ItemSpec, true, true); diff --git a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets index 91ee0d0eb3..5829180d17 100644 --- a/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets +++ b/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Common.targets @@ -20,17 +20,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved. - - - - - - $(MSBuildThisFileDirectory)Xamarin.iOS.Analysis.targets - - - - diff --git a/release/.gitignore b/release/.gitignore new file mode 100644 index 0000000000..2e42c88c40 --- /dev/null +++ b/release/.gitignore @@ -0,0 +1,16 @@ +*.pkg +ios-updateinfo +ios-tmp-package +ios-meta-package +ios-work +mac-updateinfo +mac-tmp-package +mac-work +mac-work-uninstall +_ios-install +_mac-install +Version +Version.rev +xma-tmp-package +xma-work +*.zip diff --git a/release/Distribution.ios.in b/release/Distribution.ios.in new file mode 100644 index 0000000000..3df3fdacfb --- /dev/null +++ b/release/Distribution.ios.in @@ -0,0 +1,31 @@ + + + Xamarin.iOS + + + + + + + + + + + + + + + + #monotouch.pkg + #delete-xma-build-host.pkg + diff --git a/release/Distribution.mac.in b/release/Distribution.mac.in new file mode 100644 index 0000000000..63996e580e --- /dev/null +++ b/release/Distribution.mac.in @@ -0,0 +1,38 @@ + + + Xamarin.Mac + + + + + + + + + + + + + + + + #xamarin.mac-@PACKAGE_VERSION@.pkg + #xamarin.mac-uninstall-@PACKAGE_VERSION@.pkg + diff --git a/release/Distribution.xma.in b/release/Distribution.xma.in new file mode 100644 index 0000000000..61f5ad4992 --- /dev/null +++ b/release/Distribution.xma.in @@ -0,0 +1,13 @@ + + + Xamarin.iOS Build Host + + + + + + + + + #delete-xma-build-host.pkg + diff --git a/release/Makefile b/release/Makefile new file mode 100644 index 0000000000..2719c576a7 --- /dev/null +++ b/release/Makefile @@ -0,0 +1,186 @@ +TOP=../../xamarin-macios +include $(TOP)/Make.config + +IOS_PACKAGE_DESTDIR=$(abspath .)/_ios-install +MAC_PACKAGE_DESTDIR=$(abspath .)/_mac-install + +IOS_PAYLOAD=$(abspath $(IOS_PACKAGE_DESTDIR)) +MAC_PAYLOAD=$(abspath $(MAC_PACKAGE_DESTDIR)) + +MAC_INSTALL_PKG=xamarin.mac-$(MAC_PACKAGE_VERSION).pkg +MAC_UNINSTALL_PKG=xamarin.mac-uninstall-$(MAC_PACKAGE_VERSION).pkg + +MAC_SED_PROCESS_IN = sed \ + -e "s/@INSTALLKBYTES@/`du -sk $(MAC_PAYLOAD) | awk '{print $$1}'`/g" \ + -e "s/@NUMFILES@/`lsbom mac-tmp-package/$(MAC_INSTALL_PKG)/Bom 2>/dev/null | wc -l | awk '{print $$1}'`/g" \ + -e "s/@INSTALL_PKG@/$(MAC_INSTALL_PKG)/g" \ + -e "s/@UNINSTALL_PKG@/$(MAC_UNINSTALL_PKG)/g" \ + -e "s,@PACKAGE_INSTALL_LOCATION@,$(MAC_PACKAGE_INSTALL_LOCATION),g" \ + -e "s/@PACKAGE_VERSION@/$(MAC_PACKAGE_VERSION)/g" \ + -e "s/@PRODUCT@/$(MAC_PRODUCT)/g" \ + -e "s,@XAMMAC_PREFIX@,$(MAC_FRAMEWORK_CURRENT_DIR),g" + +ifdef INCLUDE_MAC +ALL_PACKAGES+=$(MAC_PACKAGE_FILENAME) +endif +ifdef INCLUDE_IOS +ALL_PACKAGES+=$(IOS_PACKAGE_FILENAME) +endif + +build-for-package: + @# make sure we start with a clean slate + $(Q) git clean -xfd + $(Q) $(MAKE) -C $(TOP) install USE_SOURCE_LINKS=0 DEVMODE=0 \ + IOS_DESTDIR=$(IOS_PACKAGE_DESTDIR) IOS_TARGETDIR=/ IOS_INSTALL_VERSION=$(IOS_PACKAGE_VERSION) \ + MAC_DESTDIR=$(MAC_PACKAGE_DESTDIR) MAC_TARGETDIR=/ MAC_INSTALL_VERSION=$(MAC_PACKAGE_VERSION) + +release package: + $(Q) $(MAKE) build-for-package + $(Q) $(MAKE) $(ALL_PACKAGES) + @# updateinfo, uploaded to wrench +ifdef INCLUDE_MAC + $(Q) cp $(MAC_PACKAGE_DESTDIR)/$(MAC_FRAMEWORK_DIR)/Versions/Current/updateinfo mac-updateinfo +endif +ifdef INCLUDE_IOS + $(Q) cp $(IOS_PACKAGE_DESTDIR)/$(IOS_FRAMEWORK_DIR)/Versions/Current/updateinfo ios-updateinfo + $(MAKE) bundle.zip msbuild.zip +endif + +# this are just a useful targets to run locally if you're not interested in the XI/XM package +# it should be almost identical to the normal 'package' target (only difference should be that the XM/XI +# bits aren't built/packaged) +ifdef INCLUDE_MAC +mac-package: + $(Q) $(MAKE) build-for-package + $(Q) $(MAKE) $(MAC_PACKAGE_FILENAME) +endif +ifdef INCLUDE_IOS +ios-package: + $(Q) $(MAKE) build-for-package + $(Q) $(MAKE) $(IOS_PACKAGE_FILENAME) +endif + +prechecks: +ifdef CROSS_BUILD_CFLAGS + echo "CROSS_BUILD_CFLAGS can't be set when building a package. Please fix Make.local.config" && exit 1 +endif +ifdef DEVICE_BUILD_CFLAGS + echo "DEVICE_BUILD_CFLAGS can't be set when building a package. Please fix Make.local.config" && exit 1 +endif + @echo Package prechecks completed successfully. + +monotouch.pkg: Makefile + @echo Building $@ + $(Q) $(MAKE) prechecks + $(Q) mkdir -p ios-work/commercial + $(Q) cp postflight-ios ios-work/commercial/postinstall + $(Q) chmod a+x ios-work/commercial/postinstall + $(Q) mkdir -p ios-tmp-package/Resources/en.lproj + $(Q) mkdir -p ios-tmp-package/monotouch.pkg + $(Q) cp $(TOP)/tools/scripts/License.txt ios-tmp-package/Resources/en.lproj/License.txt + $(Q) mkbom $(IOS_PAYLOAD) ios-tmp-package/monotouch.pkg/Bom + $(Q) (cd $(IOS_PAYLOAD); lsbom -p f $(abspath ./ios-tmp-package/monotouch.pkg/Bom) | cpio -o | gzip -9 -n > $(abspath ios-tmp-package/monotouch.pkg/Payload)) 2>/dev/null + $(Q) (cd ios-work/commercial; ls -d . ./postinstall | cpio -o | gzip -9 -n > ../../ios-tmp-package/monotouch.pkg/Scripts) 2>/dev/null + $(Q) INSTALLKBYTES=`du -sk $(IOS_PAYLOAD) | awk '{print $$1}'`; NUMFILES=`lsbom ios-tmp-package/monotouch.pkg/Bom | wc -l | awk '{print $$1}'`; sed -e "s/@INSTALLKBYTES@/$$INSTALLKBYTES/g" -e "s/@NUMFILES@/$$NUMFILES/g" -e "s/@FULL_PACKAGE_UTI@/$(IOS_PACKAGE_UTI)/g" -e "s,@MONOTOUCH_PREFIX@,$(MONOTOUCH_PREFIX),g" PackageInfo.ios.in > ios-tmp-package/monotouch.pkg/PackageInfo + @echo Built $@ + +$(IOS_PACKAGE_FILENAME): delete-xma-build-host.pkg monotouch.pkg + @echo Building $@ + @rm -Rf ios-meta-package + @cp -R ios-tmp-package ios-meta-package + @cp -R xma-tmp-package/delete-xma-build-host.pkg ios-meta-package + @$(Q) INSTALLBYTES_MTVS=`grep installKBytes ios-meta-package/delete-xma-build-host.pkg/PackageInfo | sed 's/.*installKBytes="\([0-9]*\)".*/\1/'` INSTALLKBYTES=`du -sk $(IOS_PAYLOAD) | awk '{print $$1}'`; sed -e s/@INSTALLKBYTES@/$$INSTALLKBYTES/ -e s/@INSTALLBYTES_MTVS@/$$INSTALLBYTES_MTVS/ Distribution.ios.in > ios-meta-package/Distribution + @$(Q_GEN) (cd ios-meta-package; xar --no-compress monotouch.pkg/Payload --no-compress monotouch.pkg/Scripts --no-compress delete-xma-build-host.pkg/Payload --no-compress delete-xma-build-host.pkg/Scripts -c -f ../$@ *) + @echo Built $@ + +# delete-xma-build-host is a package with the same id as the old MTVS installer, but with 0 files to install. +# This makes OSX remove all files installed by the old MTVS installer. +delete-xma-build-host.pkg: + @echo Building $@ + $(Q) rm -rf xma-work xma-tmp-package + $(Q) mkdir -p xma-work/commercial/payload + $(Q) cp preinstall.xma.in xma-work/commercial/preinstall + $(Q) chmod a+x xma-work/commercial/preinstall + $(Q) mkdir -p xma-tmp-package/$@ + $(Q) mkbom xma-work/commercial/payload xma-tmp-package/$@/Bom + $(Q) (cd xma-work/commercial/payload; lsbom -p f $(abspath ./xma-tmp-package/$@/Bom) | cpio -o | gzip -9 -n > $(abspath xma-tmp-package/$@/Payload)) 2>/dev/null + $(Q) (cd xma-work/commercial; ls -d . ./preinstall | cpio -o | gzip -9 -n > ../../xma-tmp-package/$@/Scripts) 2>/dev/null + $(Q) cp PackageInfo.xma.in xma-tmp-package/$@/PackageInfo + $(Q) cp Distribution.xma.in xma-tmp-package/Distribution + $(Q) (cd xma-tmp-package; xar --no-compress $@/Payload --no-compress $@/Scripts -c -f ../$@ *) + @echo Built $@ + +$(MAC_PACKAGE_FILENAME): + @echo Building $@ + $(Q) $(MAKE) prechecks +# xamarin.mac-v.v.v.pkg meta package + $(Q) mkdir -p mac-work/commercial + $(Q) cp postflight-mac mac-work/commercial/postflight-mac + $(Q) chmod a+x mac-work/commercial/postflight-mac + $(Q) mkdir -p mac-tmp-package/$(MAC_INSTALL_PKG) + $(Q) mkdir -p mac-tmp-package/Resources/en.lproj + $(Q) cp $(TOP)/tools/scripts/License.txt mac-tmp-package/Resources/en.lproj/License.txt + $(Q) mkbom $(MAC_PAYLOAD) mac-tmp-package/$(MAC_INSTALL_PKG)/Bom + $(Q) (cd $(MAC_PAYLOAD); lsbom -p f $(abspath ./mac-tmp-package/$(MAC_INSTALL_PKG)/Bom) | cpio -o | gzip -9 -n > $(abspath ./mac-tmp-package/$(MAC_INSTALL_PKG)/Payload)) 2>/dev/null + $(Q) (cd mac-work/commercial; ls -d . ./postflight-mac | cpio -o | gzip -9 -n > ../../mac-tmp-package/$(MAC_INSTALL_PKG)/Scripts) 2>/dev/null + $(Q) ls -d ./mono-check.sh | cpio -o | gzip -9 -n > mac-tmp-package/Scripts 2>/dev/null + $(Q) $(MAC_SED_PROCESS_IN) PackageInfo.mac.in > mac-tmp-package/$(MAC_INSTALL_PKG)/PackageInfo +# xamarin.mac-uninstall-v.v.v.pkg meta package + $(Q) mkdir -p mac-work-uninstall/commercial + $(Q) $(MAC_SED_PROCESS_IN) uninstall.in > mac-work-uninstall/commercial/uninstall + $(Q) chmod a+x mac-work-uninstall/commercial/uninstall + $(Q) mkdir -p mac-work-uninstall/payload + $(Q) mkdir -p mac-tmp-package/$(MAC_UNINSTALL_PKG) + $(Q) mkbom mac-work-uninstall/payload mac-tmp-package/$(MAC_UNINSTALL_PKG)/Bom + $(Q) (cd mac-work-uninstall/payload; lsbom -p f ../../mac-tmp-package/$(MAC_UNINSTALL_PKG)/Bom | cpio -o | gzip -9 -n > ../../mac-tmp-package/$(MAC_UNINSTALL_PKG)/Payload) 2>/dev/null + $(Q) (cd mac-work-uninstall/commercial; ls -d . ./uninstall | cpio -o | gzip -9 -n > ../../mac-tmp-package/$(MAC_UNINSTALL_PKG)/Scripts) 2>/dev/null + $(Q) $(MAC_SED_PROCESS_IN) UninstallPackageInfo.mac.in > mac-tmp-package/$(MAC_UNINSTALL_PKG)/PackageInfo +# final package + $(Q) $(MAC_SED_PROCESS_IN) Distribution.mac.in > mac-tmp-package/Distribution + $(Q_GEN) (cd mac-tmp-package; xar --no-compress Scripts --no-compress $(MAC_INSTALL_PKG)/Payload --no-compress $(MAC_INSTALL_PKG)/Scripts --no-compress $(MAC_UNINSTALL_PKG)/Payload --no-compress $(MAC_UNINSTALL_PKG)/Scripts -c -f ../$(MAC_PACKAGE_FILENAME) *) + @echo Built $@ + +clean-local:: + rm -rf ios-tmp-package ios-work ios-meta-package + rm -rf mac-tmp-package mac-work mac-work-uninstall + rm -rf *.pkg + +# msbuild.zip and bundle.zip are uploaded to wrench and packaged into the VS plugin +msbuild.zip: + rm -Rf msbuild $@ + mkdir -p msbuild + mkdir -p msbuild/iOS + mkdir -p msbuild/WatchOS + mkdir -p msbuild/TVOS + mkdir -p msbuild/Mac + mkdir -p msbuild/maccore/src + mkdir -p msbuild/maccore/tools/mtouch + mkdir -p msbuild/maccore/msbuild/Xamarin.ObjcBinding.Tasks + cp -aL $(TOP)/src/Constants.iOS.cs.in msbuild/maccore/src/Constants.cs + $(SYSTEM_MSBUILD) $(TOP)/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj -r /p:Configuration=Release /p:"IncludeMSBuildAssets=all" + cp -R $(TOP)/msbuild/Xamarin.iOS.Tasks/bin/Release/netstandard2.0/ msbuild/iOS + $(SYSTEM_MSBUILD) $(TOP)/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj -r /p:Configuration=Release + cp -R $(TOP)/msbuild/Xamarin.iOS.Tasks.Windows/bin/Release/netstandard2.0/win/ msbuild/iOS + $(SYSTEM_MSBUILD) $(TOP)/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj -r /p:Configuration=Release + cp -R $(TOP)/msbuild/Xamarin.Mac.Tasks/bin/Release/netstandard2.0/ msbuild/Mac +ifdef INCLUDE_WATCH + mv -f msbuild/iOS/*WatchOS*.* msbuild/WatchOS + mv -f msbuild/iOS/NoCode.cs msbuild/WatchOS +endif + mv -f msbuild/iOS/*TVOS*.* msbuild/TVOS + cd msbuild && zip -9 -r $(abspath $@) . + rm -rf msbuild + +bundle.zip: Version Version.rev + rm -f $@ + cd $(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/mono && zip -9 -r $(CURDIR)/bundle.zip . + cd $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono && zip -9 -r $(CURDIR)/bundle.zip . + cd $(DOTNET_DESTDIR) && zip -9 -r $(CURDIR)/bundle.zip $(foreach platform,$(DOTNET_PLATFORMS),./Microsoft.$(platform).Ref/ref/) + zip -9 $@ Version Version.rev + +Version: + $(Q) echo "$(IOS_PACKAGE_VERSION_MAJOR).$(IOS_PACKAGE_VERSION_MINOR).$(IOS_PACKAGE_VERSION_REV)" > $@ + +Version.rev: + $(Q) echo "$(IOS_PACKAGE_VERSION_BUILD)" > $@ + diff --git a/release/PackageInfo.ios.in b/release/PackageInfo.ios.in new file mode 100644 index 0000000000..ce6902b21b --- /dev/null +++ b/release/PackageInfo.ios.in @@ -0,0 +1,7 @@ + + + + + + + diff --git a/release/PackageInfo.mac.in b/release/PackageInfo.mac.in new file mode 100644 index 0000000000..75fac02bbd --- /dev/null +++ b/release/PackageInfo.mac.in @@ -0,0 +1,6 @@ + + + + + + diff --git a/release/PackageInfo.xma.in b/release/PackageInfo.xma.in new file mode 100644 index 0000000000..54a1fb1882 --- /dev/null +++ b/release/PackageInfo.xma.in @@ -0,0 +1,6 @@ + + + + + + diff --git a/release/UninstallPackageInfo.mac.in b/release/UninstallPackageInfo.mac.in new file mode 100644 index 0000000000..428de02fc1 --- /dev/null +++ b/release/UninstallPackageInfo.mac.in @@ -0,0 +1,6 @@ + + + + + + diff --git a/release/mono-check.sh b/release/mono-check.sh new file mode 100755 index 0000000000..e868b44f8f --- /dev/null +++ b/release/mono-check.sh @@ -0,0 +1,27 @@ +#!/bin/bash -e + +# if you edit these version numbers, remember to edit the error message +# in Distrubution.in too to refer to the new version. +MONO_MIN_REQUIRED_VERSION=3.2.0 + +VERSION_FILE=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/mono.pc + +if test -f $VERSION_FILE; then + # Grab the version from the pkgconfig file + installed_version=`grep Version $VERSION_FILE | cut -d ' ' -f 2` + + # If the installed version exactly matches the minimum, success! + if `test "$installed_version" = "$MONO_MIN_REQUIRED_VERSION"`; then + exit 2 # the .pkg installer really wants 2 to mean "OK" + fi + + # Use 'sort', splitting on the '.' character, to compare the installed version and our minimum acceptable version + # The newest version will be sorted to the end, so use tail to select the last item + newest_version=`echo -e $MONO_MIN_REQUIRED_VERSION'\n'$installed_version | sort -t'.' -g | tail -n 1` + + if `test "$newest_version" = "$installed_version"`; then + exit 2 # the .pkg installer really wants 2 to mean "OK" + fi +fi + +exit 1 diff --git a/release/postflight-ios b/release/postflight-ios new file mode 100755 index 0000000000..917e7b1ea4 --- /dev/null +++ b/release/postflight-ios @@ -0,0 +1,4 @@ +#!/bin/sh -e + +# Touch all files to make sure projects are rebuilt correctly +find /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/ -type f -print0 | xargs -0 touch || true diff --git a/release/postflight-mac b/release/postflight-mac new file mode 100755 index 0000000000..669acb8c7a --- /dev/null +++ b/release/postflight-mac @@ -0,0 +1,4 @@ +#!/bin/sh -e + +# Touch all files to make sure projects are rebuilt correctly +find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/ -type f -print0 | xargs -0 touch || true diff --git a/release/preinstall.xma.in b/release/preinstall.xma.in new file mode 100755 index 0000000000..277f0ec6ef --- /dev/null +++ b/release/preinstall.xma.in @@ -0,0 +1,21 @@ +#!/bin/sh + +# +# Remove MTVS build server from the system LaunchAgents +# According to launchd.plist(5): +# FILES +# ~/Library/LaunchAgents Per-user agents provided by the user. +# /Library/LaunchAgents Per-user agents provided by the administrator. +# + +# If the plist had been loaded from a previous session, forcefully remove it and potential running mtbserver +(sudo -u $USER launchctl unload -w /Library/LaunchAgents/com.xamarin.mtvs.buildserver.plist &> /dev/null) || true +(sudo -u $USER launchctl remove com.xamarin.mtvs.buildserver &> /dev/null) || true +(killall -KILL mtbserver &> /dev/null) || true + +rm -rf /Library/LaunchAgents/com.xamarin.mtvs.buildserver.plist || true + +# Remove the plist file for launching the Build Server UI, we decided against this +rm -rf /Library/LaunchAgents/com.xamarin.mtvs.buildservergui.plist || true + +exit 0 diff --git a/release/uninstall.in b/release/uninstall.in new file mode 100755 index 0000000000..1b2c279306 --- /dev/null +++ b/release/uninstall.in @@ -0,0 +1,21 @@ +#!/bin/bash -e + +# delete every directory in /Library/Frameworks/Xamarin.Mac.framework/Versions +# except Current and what Current symlinks to. + +if ! test -d /Library/Frameworks/Xamarin.Mac.framework/Versions; then + exit 0; +fi + +cd /Library/Frameworks/Xamarin.Mac.framework/Versions + +if ! test -d Current; then + exit 0 +fi + +# Delete +for d in `ls -1`; do + if [[ "x$d" != "xCurrent" && "x$d" != "x@PACKAGE_VERSION@" ]]; then + rm -R /Library/Frameworks/Xamarin.Mac.framework/Versions/$d 2>&1 >> /tmp/log + fi +done diff --git a/src/Chip/ChipCompat.cs b/src/Chip/ChipCompat.cs index 1ece686890..3b2225dd36 100644 --- a/src/Chip/ChipCompat.cs +++ b/src/Chip/ChipCompat.cs @@ -143,6 +143,7 @@ namespace Chip { [Mac (12,1), Watch (8,3), TV (15,2), iOS (15,2), MacCatalyst (15,2)] public delegate void ChipDeviceConnectionCallback (ChipDevice device, NSError error); + [Obsolete ("This class is removed.")] [Register("CHIPDeviceController", true)] public partial class ChipDeviceController : NSObject { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -198,6 +199,7 @@ namespace Chip { public static ChipDeviceController SharedController => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPLowPower", true)] public partial class ChipLowPower : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -221,6 +223,7 @@ namespace Chip { public virtual Task SleepAsync () => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPTestCluster", true)] public partial class ChipTestCluster : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } @@ -437,6 +440,7 @@ namespace Chip { public virtual Task WriteAttributeUnsupportedAsync (bool boolValue) => throw new InvalidOperationException (Constants.RemovedFromChip); } + [Obsolete ("This class is removed.")] [Register("CHIPGeneralCommissioning", true)] public partial class ChipGeneralCommissioning : ChipCluster { public override IntPtr ClassHandle { get { throw new InvalidOperationException (Constants.RemovedFromChip); } } diff --git a/src/HomeKit/HMCompat.cs b/src/HomeKit/HMCompat.cs index fc62ee20ca..afdb4dfb27 100644 --- a/src/HomeKit/HMCompat.cs +++ b/src/HomeKit/HMCompat.cs @@ -8,6 +8,7 @@ // using System; +using System.ComponentModel; using System.Threading.Tasks; using Foundation; using CoreFoundation; @@ -100,6 +101,7 @@ namespace HomeKit { } /* class HMChipServiceHome */ + [Obsolete ("This class is removed.")] public partial class HMAccessorySetupManager { #pragma warning disable CS0618 // HMChipServiceTopology and HMErrorHandler is obsolete @@ -109,7 +111,12 @@ namespace HomeKit { } #endif // !NET +#if !XAMCORE_5_0 #if __IOS__ && !__MACCATALYST__ +#if NET + [EditorBrowsable (EditorBrowsableState.Never)] + [Obsolete ("This class is removed.")] +#endif public unsafe partial class HMAccessorySetupManager : NSObject { public override NativeHandle ClassHandle => throw new InvalidOperationException (Constants.RemovedFromHomeKit); @@ -125,4 +132,5 @@ namespace HomeKit { public virtual Task PerformMatterEcosystemAccessorySetupAsync (HMAccessorySetupRequest request, HMMatterTopology topology) => throw new InvalidOperationException (Constants.RemovedFromHomeKit); } #endif +#endif } diff --git a/src/ObjCRuntime/ErrorHelper.cs b/src/ObjCRuntime/ErrorHelper.cs index 6793d22dd0..605702f0c3 100644 --- a/src/ObjCRuntime/ErrorHelper.cs +++ b/src/ObjCRuntime/ErrorHelper.cs @@ -8,12 +8,12 @@ using System; using System.Collections.Generic; #if !BUNDLER && !TESTS -using ProductException=ObjCRuntime.RuntimeException; +using ProductException = ObjCRuntime.RuntimeException; #endif #nullable enable -#if BUNDLER || MSBUILD_TASKS || TESTS +#if BUNDLER || MSBUILD_TASKS || TESTS namespace Xamarin.Bundler { #else namespace ObjCRuntime { diff --git a/src/ObjCRuntime/ObsoleteConstants.cs b/src/ObjCRuntime/ObsoleteConstants.cs index 3bb1c4aa45..5e74aeeb34 100644 --- a/src/ObjCRuntime/ObsoleteConstants.cs +++ b/src/ObjCRuntime/ObsoleteConstants.cs @@ -31,10 +31,10 @@ namespace ObjCRuntime { internal const string ChipRemoved = "The CHIP framework has been removed from iOS."; - internal const string BrokenBinding = "This API was incorrectly bound and does not work correctly. Use the new version indicated in the associated Obsolete attribute."; - + internal const string ApiRemovedGeneral = "This API has been removed from the framework."; + internal const string RemovedFromHomeKit = "This API has been removed from the 'HomeKit' framework."; - internal const string ApiRemovedGeneral = "This API has been removed from the framework."; + internal const string BrokenBinding = "This API was incorrectly bound and does not work correctly. Use the new version indicated in the associated Obsolete attribute."; } } diff --git a/src/ObjCRuntime/RuntimeException.cs b/src/ObjCRuntime/RuntimeException.cs index b340c9f328..651f887bdd 100644 --- a/src/ObjCRuntime/RuntimeException.cs +++ b/src/ObjCRuntime/RuntimeException.cs @@ -7,32 +7,32 @@ using System.Collections.Generic; namespace ObjCRuntime { public class RuntimeException : Exception { - public RuntimeException (string message, params object?[] args) + public RuntimeException (string message, params object? [] args) : base (string.Format (message, args)) { } - public RuntimeException (int code, string message, params object?[] args) : + public RuntimeException (int code, string message, params object? [] args) : this (code, false, null, message, args) { } - - public RuntimeException (int code, bool error, string message, params object?[] args) : + + public RuntimeException (int code, bool error, string message, params object? [] args) : this (code, error, null, message, args) { } - - public RuntimeException (int code, bool error, Exception? innerException, string message, params object?[] args) : + + public RuntimeException (int code, bool error, Exception? innerException, string message, params object? [] args) : base (String.Format (message, args), innerException) { Code = code; Error = error; } - + public int Code { get; private set; } - + public bool Error { get; private set; } - + // http://blogs.msdn.com/b/msbuild/archive/2006/11/03/msbuild-visual-studio-aware-error-messages-and-message-formats.aspx /* public override string ToString () diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index e6b74c2277..cd98d906d7 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -385,20 +385,25 @@ namespace Xamarin.Tests { } [Test] - [TestCase ("iossimulator-x64", false)] - [TestCase ("ios-arm64", true)] - [TestCase ("ios-arm64", true, "PublishTrimmed=true;UseInterpreter=true")] - public void IsNotMacBuild (string runtimeIdentifier, bool isDeviceBuild, string? extraProperties = null) + [TestCase (ApplePlatform.iOS, "iossimulator-x64", false)] + [TestCase (ApplePlatform.iOS, "ios-arm64", true)] + [TestCase (ApplePlatform.iOS, "ios-arm64", true, null, "Release")] + [TestCase (ApplePlatform.iOS, "ios-arm64", true, "PublishTrimmed=true;UseInterpreter=true")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64;maccatalyst-x64", false)] + public void IsNotMacBuild (ApplePlatform platform, string runtimeIdentifiers, bool isDeviceBuild, string? extraProperties = null, string configuration = "Debug") { + var project = "MySimpleApp"; + Configuration.IgnoreIfIgnoredPlatform (platform); if (isDeviceBuild) Configuration.AssertDeviceAvailable (); - var platform = ApplePlatform.iOS; - var project_path = GetProjectPath ("MySingleView", runtimeIdentifiers: runtimeIdentifier, platform: platform, out var appPath); + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, configuration: configuration); Configuration.IgnoreIfIgnoredPlatform (platform); Clean (project_path); - var properties = GetDefaultProperties (runtimeIdentifier); + var properties = GetDefaultProperties (runtimeIdentifiers); properties ["IsMacEnabled"] = "false"; + if (!string.IsNullOrEmpty (configuration)) + properties ["Configuration"] = configuration; if (extraProperties is not null) { foreach (var assignment in extraProperties.Split (';')) { var split = assignment.Split ('='); @@ -407,10 +412,16 @@ namespace Xamarin.Tests { } var result = DotNet.AssertBuild (project_path, properties); AssertThatLinkerDidNotExecute (result); - var appExecutable = Path.Combine (appPath, Path.GetFileName (project_path)); - Assert.That (appPath, Does.Exist, "There is an .app"); - Assert.That (appExecutable, Does.Not.Empty, "There is no executable"); - Assert.That (Path.Combine (appPath, "Xamarin.iOS.dll"), Does.Not.Exist, "Xamarin.iOS.dll is in the bundle"); + switch (platform) { + case ApplePlatform.iOS: + var appExecutable = Path.Combine (appPath, Path.GetFileName (project_path)); + Assert.That (appPath, Does.Exist, "There is an .app"); + Assert.That (appExecutable, Does.Not.Empty, "There is no executable"); + Assert.That (Path.Combine (appPath, Configuration.GetBaseLibraryName (platform, true)), Does.Not.Exist, "Platform assembly is in the bundle"); + break; + case ApplePlatform.MacCatalyst: + break; + } } [Test] diff --git a/tests/mtouch/SdkTest.cs b/tests/mtouch/SdkTest.cs index 23cbf83697..aa3480829d 100644 --- a/tests/mtouch/SdkTest.cs +++ b/tests/mtouch/SdkTest.cs @@ -63,7 +63,6 @@ namespace Xamarin.Linker { case "Xamarin.ObjcBinding.Tasks": case "Xamarin.MacDev": case "Xamarin.MacDev.Tasks": - case "Xamarin.Analysis.Tasks": // other stuff that is not part of the SDK but shipped in the same 2.1 directory failed_bcl.Add (aname); break; diff --git a/tools/common/FileCopier.cs b/tools/common/FileCopier.cs index 1c38cae85f..371973e0c8 100644 --- a/tools/common/FileCopier.cs +++ b/tools/common/FileCopier.cs @@ -5,8 +5,7 @@ using System.Linq; using System.Runtime.InteropServices; namespace Xamarin.Bundler { - public static class FileCopier - { + public static class FileCopier { enum CopyFileFlags : uint { ACL = 1 << 0, Stat = 1 << 1, @@ -74,7 +73,7 @@ namespace Xamarin.Bundler { [ThreadStatic] static ReportErrorCallback reportErrorCallback; - static void Log (int min_verbosity, string format, params object[] arguments) + static void Log (int min_verbosity, string format, params object [] arguments) { if (logCallback is not null) { logCallback (min_verbosity, format, arguments); @@ -89,7 +88,7 @@ namespace Xamarin.Bundler { #endif } - static void ReportError (int code, string format, params object[] arguments) + static void ReportError (int code, string format, params object [] arguments) { if (reportErrorCallback is not null) { reportErrorCallback (code, format, arguments); @@ -159,7 +158,7 @@ namespace Xamarin.Bundler { // do not call `Marshal.GetLastWin32Error` inside this method since it's called while the p/invoke is executing and will return `260` static CopyFileResult CopyFileCallback (CopyFileWhat what, CopyFileStep stage, IntPtr state, string source, string target, IntPtr ctx) { -// Console.WriteLine ("CopyFileCallback ({0}, {1}, 0x{2}, {3}, {4}, 0x{5})", what, stage, state.ToString ("x"), source, target, ctx.ToString ("x")); + // Console.WriteLine ("CopyFileCallback ({0}, {1}, 0x{2}, {3}, {4}, 0x{5})", what, stage, state.ToString ("x"), source, target, ctx.ToString ("x")); switch (what) { case CopyFileWhat.File: if (!IsUptodate (source, target)) { @@ -218,13 +217,13 @@ namespace Xamarin.Bundler { static bool IsUptodate (string source, string target, bool check_contents = false, bool check_stamp = true) #endif { -#if MMP || MTOUCH || BUNDLER // msbuild does not have force +#if MMP || MTOUCH || BUNDLER // msbuild does not have force if (Driver.Force) return false; #endif var tfi = new FileInfo (target); - + if (!tfi.Exists) { Log (3, "Target '{0}' does not exist.", target); return false; @@ -245,7 +244,7 @@ namespace Xamarin.Bundler { return true; } -#if MMP || MTOUCH || BUNDLER // msbuild usages do not require CompareFiles optimization +#if MMP || MTOUCH || BUNDLER // msbuild usages do not require CompareFiles optimization if (check_contents && Cache.CompareFiles (source, target)) { Log (3, "Prerequisite '{0}' is newer than the target '{1}', but the contents are identical.", source, target); return true; @@ -258,7 +257,7 @@ namespace Xamarin.Bundler { Log (3, "Prerequisite '{0}' is newer than the target '{1}'.", source, target); return false; } - + public static bool IsUptodate (IEnumerable sources, IEnumerable targets, ReportErrorCallback reportErrorCallback, LogCallback logCallback, bool check_stamp = true) { try { diff --git a/tools/common/MachO.cs b/tools/common/MachO.cs index b098cf61fb..69574c6910 100644 --- a/tools/common/MachO.cs +++ b/tools/common/MachO.cs @@ -11,19 +11,18 @@ using Xamarin.Launcher; using Xamarin.Hosting; #endif -namespace Xamarin -{ +namespace Xamarin { [Flags] public enum Abi { - None = 0, - i386 = 1, - ARMv6 = 2, - ARMv7 = 4, - ARMv7s = 8, - ARM64 = 16, - x86_64 = 32, - Thumb = 64, - LLVM = 128, + None = 0, + i386 = 1, + ARMv6 = 2, + ARMv7 = 4, + ARMv7s = 8, + ARM64 = 16, + x86_64 = 32, + Thumb = 64, + LLVM = 128, ARMv7k = 256, ARM64e = 512, ARM64_32 = 1024, @@ -51,8 +50,7 @@ namespace Xamarin } } - public class MachO - { + public class MachO { /* definitions from: /usr/include/mach-o/loader.h */ /* Constant for the magic field of the mach_header (32-bit architectures) */ internal const uint MH_MAGIC = 0xfeedface; /* the mach magic number */ @@ -70,20 +68,19 @@ namespace Xamarin // Values here match the corresponding values in the Abi enum. public enum Architectures { - None = 0, - i386 = 1, - ARMv6 = 2, - ARMv7 = 4, - ARMv7s = 8, - ARM64 = 16, - x86_64 = 32, + None = 0, + i386 = 1, + ARMv6 = 2, + ARMv7 = 4, + ARMv7s = 8, + ARM64 = 16, + x86_64 = 32, ARMv7k = 256, ARM64e = 512, ARM64_32 = 1024, } - public enum LoadCommands : uint - { + public enum LoadCommands : uint { //#define LC_REQ_DYLD 0x80000000 ReqDyld = 0x80000000, // @@ -140,19 +137,19 @@ namespace Xamarin //#define LC_LOAD_UPWARD_DYLIB (0x23 | LC_REQ_DYLD) /* load upward dylib */ MinMacOSX = 0x24, //#define LC_VERSION_MIN_MACOSX 0x24 /* build for MacOSX min OS version */ MiniPhoneOS = 0x25,//#define LC_VERSION_MIN_IPHONEOS 0x25 /* build for iPhoneOS min OS version */ - //#define LC_FUNCTION_STARTS 0x26 /* compressed table of function start addresses */ - //#define LC_DYLD_ENVIRONMENT 0x27 /* string for dyld to treat - // like environment variable */ - //#define LC_MAIN (0x28|LC_REQ_DYLD) /* replacement for LC_UNIXTHREAD */ - //#define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */ - //#define LC_SOURCE_VERSION 0x2A /* source version used to build binary */ - //#define LC_DYLIB_CODE_SIGN_DRS 0x2B /* Code signing DRs copied from linked dylibs */ - //#define LC_ENCRYPTION_INFO_64 0x2C /* 64-bit encrypted segment information */ - //#define LC_LINKER_OPTION 0x2D /* linker options in MH_OBJECT files */ - //#define LC_LINKER_OPTIMIZATION_HINT 0x2E /* optimization hints in MH_OBJECT files */ + //#define LC_FUNCTION_STARTS 0x26 /* compressed table of function start addresses */ + //#define LC_DYLD_ENVIRONMENT 0x27 /* string for dyld to treat + // like environment variable */ + //#define LC_MAIN (0x28|LC_REQ_DYLD) /* replacement for LC_UNIXTHREAD */ + //#define LC_DATA_IN_CODE 0x29 /* table of non-instructions in __text */ + //#define LC_SOURCE_VERSION 0x2A /* source version used to build binary */ + //#define LC_DYLIB_CODE_SIGN_DRS 0x2B /* Code signing DRs copied from linked dylibs */ + //#define LC_ENCRYPTION_INFO_64 0x2C /* 64-bit encrypted segment information */ + //#define LC_LINKER_OPTION 0x2D /* linker options in MH_OBJECT files */ + //#define LC_LINKER_OPTIMIZATION_HINT 0x2E /* optimization hints in MH_OBJECT files */ MintvOS = 0x2f,//#define LC_VERSION_MIN_TVOS 0x2F /* build for AppleTV min OS version */ MinwatchOS = 0x30,//#define LC_VERSION_MIN_WATCHOS 0x30 /* build for Watch min OS version */ - //#define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */ + //#define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */ BuildVersion = 0x32,//#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */ } @@ -212,10 +209,10 @@ namespace Xamarin case FAT_MAGIC: // little-endian fat binary case FAT_CIGAM: // big-endian fat binary { - var f = new FatFile (filename); - f.Read (reader); - return f; - } + var f = new FatFile (filename); + f.Read (reader); + return f; + } default: if (StaticLibrary.IsStaticLibrary (reader)) { var sl = new StaticLibrary (); @@ -260,7 +257,7 @@ namespace Xamarin yield return obj; yield break; } - + throw ErrorHelper.CreateError (1604, Errors.MX1604, file.GetType ().Name, filename); } } @@ -493,7 +490,7 @@ namespace Xamarin foreach (var entry in fat.entries) if (!entry.IsDynamicLibrary) return false; - + return true; } @@ -518,8 +515,7 @@ namespace Xamarin } } - public class StaticLibrary - { + public class StaticLibrary { List object_files = new List (); public IEnumerable ObjectFiles { get { return object_files; } } @@ -567,7 +563,7 @@ namespace Xamarin var fileSize = ReadDecimal (reader, 10); bytes = reader.ReadBytes (2); // ending characters if (bytes [0] != 0x60 && bytes [1] != 0x0A) - throw ErrorHelper.CreateError (1605, Errors.MT1605, fileIdentifier, filename, bytes[0].ToString("x"), bytes[1].ToString("x")); + throw ErrorHelper.CreateError (1605, Errors.MT1605, fileIdentifier, filename, bytes [0].ToString ("x"), bytes [1].ToString ("x")); if (fileIdentifier.StartsWith ("#1/", StringComparison.Ordinal)) { var nameLength = int.Parse (fileIdentifier.Substring (3).TrimEnd (' ')); @@ -618,8 +614,7 @@ namespace Xamarin } } - public class MachOFile - { + public class MachOFile { FatEntry fat_parent; string filename; @@ -709,30 +704,30 @@ namespace Xamarin * The 32-bit mach header appears at the very beginning of the object file for * 32-bit architectures. */ - // struct mach_header { - // uint32_t magic; /* mach magic number identifier */ - // cpu_type_t cputype; /* cpu specifier */ - // cpu_subtype_t cpusubtype; /* machine specifier */ - // uint32_t filetype; /* type of file */ - // uint32_t ncmds; /* number of load commands */ - // uint32_t sizeofcmds; /* the size of all the load commands */ - // uint32_t flags; /* flags */ - // }; + // struct mach_header { + // uint32_t magic; /* mach magic number identifier */ + // cpu_type_t cputype; /* cpu specifier */ + // cpu_subtype_t cpusubtype; /* machine specifier */ + // uint32_t filetype; /* type of file */ + // uint32_t ncmds; /* number of load commands */ + // uint32_t sizeofcmds; /* the size of all the load commands */ + // uint32_t flags; /* flags */ + // }; - /* - * The 64-bit mach header appears at the very beginning of object files for - * 64-bit architectures. - */ - // struct mach_header_64 { - // uint32_t magic; /* mach magic number identifier */ - // cpu_type_t cputype; /* cpu specifier */ - // cpu_subtype_t cpusubtype; /* machine specifier */ - // uint32_t filetype; /* type of file */ - // uint32_t ncmds; /* number of load commands */ - // uint32_t sizeofcmds; /* the size of all the load commands */ - // uint32_t flags; /* flags */ - // uint32_t reserved; /* reserved */ - // }; + /* + * The 64-bit mach header appears at the very beginning of object files for + * 64-bit architectures. + */ + // struct mach_header_64 { + // uint32_t magic; /* mach magic number identifier */ + // cpu_type_t cputype; /* cpu specifier */ + // cpu_subtype_t cpusubtype; /* machine specifier */ + // uint32_t filetype; /* type of file */ + // uint32_t ncmds; /* number of load commands */ + // uint32_t sizeofcmds; /* the size of all the load commands */ + // uint32_t flags; /* flags */ + // uint32_t reserved; /* reserved */ + // }; magic = reader.ReadUInt32 (); switch (magic) { @@ -763,11 +758,12 @@ namespace Xamarin switch (cmd) { case MachO.LoadCommands.LoadDylib: case MachO.LoadCommands.LoadWeakDylib: - case MachO.LoadCommands.ReexportDylib: { + case MachO.LoadCommands.ReexportDylib: { var dlc = new DylibLoadCommand (); dlc.cmd = reader.ReadUInt32 (); dlc.cmdsize = reader.ReadUInt32 (); - /*var nameofs = */reader.ReadUInt32 (); + /*var nameofs = */ + reader.ReadUInt32 (); dlc.timestamp = reader.ReadUInt32 (); dlc.current_version = reader.ReadUInt32 (); dlc.compatibility_version = reader.ReadUInt32 (); @@ -789,7 +785,8 @@ namespace Xamarin var dlc = new DylibIdCommand (); dlc.cmd = reader.ReadUInt32 (); dlc.cmdsize = reader.ReadUInt32 (); - /*var nameofs = */ reader.ReadUInt32 (); + /*var nameofs = */ + reader.ReadUInt32 (); dlc.timestamp = reader.ReadUInt32 (); dlc.current_version = reader.ReadUInt32 (); dlc.compatibility_version = reader.ReadUInt32 (); @@ -833,12 +830,12 @@ namespace Xamarin buildVer.minos = reader.ReadUInt32 (); buildVer.sdk = reader.ReadUInt32 (); buildVer.ntools = reader.ReadUInt32 (); - buildVer.tools = new BuildVersionCommand.BuildToolVersion[buildVer.ntools]; + buildVer.tools = new BuildVersionCommand.BuildToolVersion [buildVer.ntools]; for (int j = 0; j < buildVer.ntools; j++) { var buildToolVer = new BuildVersionCommand.BuildToolVersion (); buildToolVer.tool = reader.ReadUInt32 (); buildToolVer.version = reader.ReadUInt32 (); - buildVer.tools[j] = buildToolVer; + buildVer.tools [j] = buildToolVer; } lc = buildVer; break; @@ -884,7 +881,7 @@ namespace Xamarin public List entries; internal bool is_big_endian { - get { return magic == MachO.FAT_CIGAM; } + get { return magic == MachO.FAT_CIGAM; } } internal void WriteHeader (BinaryWriter writer) @@ -927,7 +924,7 @@ namespace Xamarin public MachOFile entry; public StaticLibrary static_library; - + public bool IsDynamicLibrary { get { return entry == null ? false : entry.IsDynamicLibrary; } } public FatFile Parent { get { return parent; } } @@ -947,7 +944,7 @@ namespace Xamarin writer.Write (align); } } - + internal void Write (BinaryWriter writer, BinaryReader reader, uint reader_offset) { writer.BaseStream.Position = offset; @@ -1038,7 +1035,7 @@ namespace Xamarin } #endif } - + public class DylibIdCommand : LoadCommand { public string name; public uint timestamp; @@ -1076,7 +1073,7 @@ namespace Xamarin Version DeNibble (uint value) { - return new Version ((int)(value >> 16), (int)((value >> 8) & 0xFF), (int)(value & 0xFF)); + return new Version ((int) (value >> 16), (int) ((value >> 8) & 0xFF), (int) (value & 0xFF)); } public Version Version { @@ -1093,7 +1090,7 @@ namespace Xamarin public uint minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ public uint sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ public uint ntools; - public BuildToolVersion[] tools; + public BuildToolVersion [] tools; public class BuildToolVersion { public uint tool; @@ -1102,7 +1099,7 @@ namespace Xamarin Version DeNibble (uint value) { - return new Version ((int)(value >> 16), (int)((value >> 8) & 0xFF), (int)(value & 0xFF)); + return new Version ((int) (value >> 16), (int) ((value >> 8) & 0xFF), (int) (value & 0xFF)); } public Version MinOS { @@ -1114,7 +1111,7 @@ namespace Xamarin } public MachO.Platform Platform { - get { return (MachO.Platform)platform; } + get { return (MachO.Platform) platform; } } } } diff --git a/tools/common/PListExtensions.cs b/tools/common/PListExtensions.cs index f6283dd24f..a8ab6a3b75 100644 --- a/tools/common/PListExtensions.cs +++ b/tools/common/PListExtensions.cs @@ -2,15 +2,12 @@ using System; using System.IO; using System.Xml; -namespace Xamarin -{ - static class PListExtensions - { +namespace Xamarin { + static class PListExtensions { public static void LoadWithoutNetworkAccess (this XmlDocument doc, string filename) { using (var fs = new FileStream (filename, FileMode.Open, FileAccess.Read)) { - var settings = new XmlReaderSettings () - { + var settings = new XmlReaderSettings () { XmlResolver = null, DtdProcessing = DtdProcessing.Parse, }; @@ -67,7 +64,7 @@ namespace Xamarin SetPListStringValue (plist, "CFBundleName", value); } - public static void SetUIDeviceFamily (this XmlDocument plist, params int[] families) + public static void SetUIDeviceFamily (this XmlDocument plist, params int [] families) { SetPListArrayOfIntegerValues (plist, "UIDeviceFamily", families); } @@ -119,7 +116,7 @@ namespace Xamarin root.AppendChild (valueElement); } - public static void SetPListArrayOfIntegerValues (this XmlDocument plist, string node, params int[] values) + public static void SetPListArrayOfIntegerValues (this XmlDocument plist, string node, params int [] values) { var key = plist.SelectSingleNode ("//dict/key[text()='" + node + "']"); key.ParentNode.RemoveChild (key.NextSibling); diff --git a/tools/common/PathUtils.cs b/tools/common/PathUtils.cs index 0523c2fadd..f26396504f 100644 --- a/tools/common/PathUtils.cs +++ b/tools/common/PathUtils.cs @@ -3,10 +3,8 @@ using System.IO; using System.Runtime.InteropServices; using System.Text; -namespace Xamarin.Utils -{ - public static class PathUtils - { +namespace Xamarin.Utils { + public static class PathUtils { static bool IsSeparator (char c) { return c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar || c == Path.VolumeSeparatorChar; @@ -70,10 +68,10 @@ namespace Xamarin.Utils int index = 0; while (index < absolute.Length) { - if (ToOrdinalIgnoreCase (absolute[index]) != ToOrdinalIgnoreCase (baseDirectory[index])) + if (ToOrdinalIgnoreCase (absolute [index]) != ToOrdinalIgnoreCase (baseDirectory [index])) break; - if (IsSeparator (absolute[index])) { + if (IsSeparator (absolute [index])) { baseDirectoryStartIndex = index; absoluteStartIndex = index + 1; separators++; @@ -82,7 +80,7 @@ namespace Xamarin.Utils index++; if (index >= baseDirectory.Length) { - if (index >= absolute.Length || IsSeparator (absolute[index])) { + if (index >= absolute.Length || IsSeparator (absolute [index])) { baseDirectoryStartIndex = index; absoluteStartIndex = index + 1; separators++; @@ -97,14 +95,14 @@ namespace Xamarin.Utils if (absoluteStartIndex >= absolute.Length) return "."; - if (index >= absolute.Length && IsSeparator (baseDirectory[index])) { + if (index >= absolute.Length && IsSeparator (baseDirectory [index])) { absoluteStartIndex = index + 1; baseDirectoryStartIndex = index; } int parentDirCount = 0; while (baseDirectoryStartIndex < baseDirectory.Length) { - if (IsSeparator (baseDirectory[baseDirectoryStartIndex])) + if (IsSeparator (baseDirectory [baseDirectoryStartIndex])) parentDirCount++; baseDirectoryStartIndex++; } @@ -114,13 +112,13 @@ namespace Xamarin.Utils index = 0; for (int i = 0; i < parentDirCount; i++) { - result[index++] = '.'; - result[index++] = '.'; - result[index++] = Path.DirectorySeparatorChar; + result [index++] = '.'; + result [index++] = '.'; + result [index++] = Path.DirectorySeparatorChar; } while (absoluteStartIndex < absolute.Length) - result[index++] = absolute[absoluteStartIndex++]; + result [index++] = absolute [absoluteStartIndex++]; return new string (result); } @@ -147,7 +145,7 @@ namespace Xamarin.Utils } [DllImport ("/usr/lib/libSystem.dylib", SetLastError = true)] - static extern int readlink (string path, [Out] byte[] buffer, IntPtr len); + static extern int readlink (string path, [Out] byte [] buffer, IntPtr len); public static string GetSymlinkTarget (string path) { diff --git a/tools/common/error.cs b/tools/common/error.cs index 07e161c9dc..c065598bd6 100644 --- a/tools/common/error.cs +++ b/tools/common/error.cs @@ -14,7 +14,7 @@ namespace Xamarin.Bundler { { } - public ProductException (int code, string message, params object[] args) : + public ProductException (int code, string message, params object [] args) : this (code, false, message, args) { } @@ -24,7 +24,7 @@ namespace Xamarin.Bundler { { } - public ProductException (int code, bool error, string message, params object[] args) : + public ProductException (int code, bool error, string message, params object [] args) : this (code, error, null, message, args) { } @@ -35,7 +35,7 @@ namespace Xamarin.Bundler { SetValues (code, error); } - public ProductException (int code, bool error, Exception innerException, string message, params object[] args) : + public ProductException (int code, bool error, Exception innerException, string message, params object [] args) : base (Format (message, args), innerException) { SetValues (code, error); @@ -46,7 +46,7 @@ namespace Xamarin.Bundler { public int LineNumber { get; set; } public int Code { get; private set; } - + public bool Error { get; private set; } void SetValues (int code, bool error) @@ -69,12 +69,11 @@ namespace Xamarin.Bundler { // this is to avoid having error message that can throw FormatException since they hide the real issue // so we need to fix it (first) before we can get the underlying root issue // this is getting more complex with localization since the strings (format) are not in the source itself - static string Format (string message, params object[] args) + static string Format (string message, params object [] args) { try { return String.Format (message, args); - } - catch { + } catch { var sb = new StringBuilder (message); sb.Append (". String.Format failed! Arguments were:"); if (args != null) { diff --git a/tools/devops/automation/build-cronjob.yml b/tools/devops/automation/build-cronjob.yml index 2063645542..99c05409a5 100644 --- a/tools/devops/automation/build-cronjob.yml +++ b/tools/devops/automation/build-cronjob.yml @@ -111,17 +111,6 @@ parameters: displayName: macOS test configurations to run type: object default: [ - { - stageName: 'mac_10_15', - displayName: 'Mac Catalina (10.15)', - macPool: 'macOS-10.15', - useImage: true, - statusContext: 'Mac Catalina (10.15)', - demands: [ - "Agent.OS -equals Darwin", - "Agent.OSVersion -equals '10.15'" - ] - }, { stageName: 'mac_11_5_m1', displayName: 'M1 - Mac Big Sur (11.5)', diff --git a/tools/devops/automation/build-pipeline.yml b/tools/devops/automation/build-pipeline.yml index 130cef5c90..6c32622041 100644 --- a/tools/devops/automation/build-pipeline.yml +++ b/tools/devops/automation/build-pipeline.yml @@ -111,17 +111,6 @@ parameters: displayName: macOS test configurations to run type: object default: [ - { - stageName: 'mac_10_15', - displayName: 'Mac Catalina (10.15)', - macPool: 'macOS-10.15', - useImage: true, - statusContext: 'Mac Catalina (10.15)', - demands: [ - "Agent.OS -equals Darwin", - "Agent.OSVersion -equals '10.15'" - ] - }, { stageName: 'mac_11_5_m1', displayName: 'M1 - Mac Big Sur (11.5)', diff --git a/tools/devops/automation/build-pull-request.yml b/tools/devops/automation/build-pull-request.yml index c2cb7a450c..d4515f0274 100644 --- a/tools/devops/automation/build-pull-request.yml +++ b/tools/devops/automation/build-pull-request.yml @@ -96,17 +96,6 @@ parameters: displayName: macOS test configurations to run type: object default: [ - { - stageName: 'mac_10_15', - displayName: 'Mac Catalina (10.15)', - macPool: 'macOS-10.15', - useImage: true, - statusContext: 'Mac Catalina (10.15)', - demands: [ - "Agent.OS -equals Darwin", - "Agent.OSVersion -equals '10.15'" - ] - }, { stageName: 'mac_11_5_m1', displayName: 'M1 - Mac Big Sur (11.5)', diff --git a/tools/scripts/License.txt b/tools/scripts/License.txt new file mode 100644 index 0000000000..d526d223cb --- /dev/null +++ b/tools/scripts/License.txt @@ -0,0 +1,174 @@ +XAMARIN SOFTWARE LICENSE TERMS +XAMARIN STUDIO + +These license terms are an agreement between Xamarin Inc. and you. They apply to the software named above. They also apply to any Xamarin services or updates for the software, except to the extent those have different terms. + +BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE. + +SECTION I: XAMARIN STUDIO COMMUNITY. If you do not have an active Visual Studio Enterprise or Visual Studio Professional subscription, then your license is for Xamarin Studio Community, and this Section I and Section III below apply to your use of Xamarin Studio. If you comply with these license terms, you have the rights in those sections. + +1. INSTALLATION AND USE RIGHTS. + +a. Individual license. If you are an individual working on your own applications to sell or for any other purpose, you may use the software to develop and test those applications. + +b. Organization licenses. If you are an organization, your users may use the software as follows: + +Any number of your users may use the software to develop and test your applications released under Open Source Initiative (OSI) approved open source software licenses. + +Any number of your users may use the software to develop and test Xamarin Studio or Visual Studio extensions and Xamarin Component Store or Visual Studio Marketplace components. + +Any number of your users may use the software to develop and test your applications as part of online or in person classroom training and education, or for performing academic research. + +If none of the above apply, and you are also not an enterprise (defined below), then up to 5 of your individual users can use the software concurrently to develop and test your applications. + +If you are an enterprise, your employees and contractors may not use the software to develop or test your applications, except for open source and education purposes as permitted above. An “enterprise” is any organization and its affiliates who collectively have more than (i) 250 PCs or users and (ii) one million dollars (or the equivalent in other currencies) in annual revenues, and “affiliates” means those entities that control (via majority ownership), are controlled by, or are under common control with an organization. + +c. Demo Use. The uses permitted above includes use of the software in demonstrating your applications. + +2. SUPPORT SERVICES. Because Xamarin Studio Community is licensed “as is,” we may not provide support services for it. + +3. DISCLAIMER OF WARRANTY. XAMARIN STUDIO COMMUNITY IS LICENSED “AS-IS.”  YOU BEAR THE RISK OF USING IT. XAMARIN GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, XAMARIN EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + +SECTION II: XAMARIN STUDIO ENTERPRISE AND XAMARIN STUDIO PROFESSIONAL: When you acquire an active and valid subscription for either Microsoft Visual Studio Enterprise or Microsoft Visual Studio Professional (“Visual Studio”), and either enter a coupon code or sign in to the software, then your license is for Xamarin Studio Enterprise or Xamarin Studio Professional, respectively, and the license terms in this Section II and Section III below apply. If you comply with these license terms, you have the rights in those sections. You may not share your coupon code or access credentials. + + +1. INSTALLATION AND USE RIGHTS. + +a. General. The software is licensed on a per user basis. One user may use copies of the software to develop and test your applications. This includes using copies of the software on your own internal servers that remain fully dedicated to your own use. You may not separate the components of the software and run those in a production environment, or on different devices (except as otherwise stated in this agreement), or for any purpose other than developing and testing your applications. + +b. Demo Use. The uses permitted above includes use of the software in demonstrating your applications. + +2. DOCUMENTATION. Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes. + +3. NOT FOR RESALE SOFTWARE. You may not sell software marked as “NFR” or “Not for Resale.” + +4. PROOF OF LICENSE. Your proof of license is the Xamarin Studio coupon code you received through your Visual Studio subscription and your receipt and/or being able to access the software service through your Xamarin or Microsoft account. + +5. TRANSFER TO A THIRD PARTY. If you are a valid licensee of Visual Studio and the software, you may transfer this software together with Visual Studio and the applicable license agreements directly to another party. Before the transfer, that party must agree that this agreement applies to the transfer and use of the software. The transfer must include the software and coupon code. You must uninstall all copies of the software after transferring it from your device(s). You may not retain any copies of the coupon code to be transferred, and may only retain copies of the software if otherwise licensed to do so. If you have acquired a non-perpetual license to use the software or if the software is marked Not for Resale you may not transfer the software or this agreement to another party. + +6. SUPPORT SERVICES. Xamarin provides support services for the software as described at https://www.xamarin.com/support. + +7. LIMITED WARRANTY. If you follow the instructions, the software will perform substantially as described in the Xamarin materials that you receive in or with the software. +References to “limited warranty” are references to the express warranty provided by Xamarin. This warranty is given in addition to other rights and remedies you may have under law, including your rights and remedies in accordance with the statutory guarantees under local Consumer Law. + +8. TERM OF WARRANTY; WARRANTY RECIPIENT; LENGTH OF ANY IMPLIED WARRANTIES. The limited warranty covers the software for one year after acquired by the first user. If you receive supplements, updates, or replacement software during that year, they will be covered for the remainder of the warranty or 30 days, whichever is longer. If the first user transfers the software, the remainder of the warranty will apply to the recipient. + +To the extent permitted by law, any implied warranties, guarantees, or conditions last only during the term of the limited warranty. Some states do not allow limitations on how long an implied warranty lasts, so these limitations may not apply to you. They also might not apply to you because some countries may not allow limitations on how long an implied warranty, guarantee or condition lasts. + +9. EXCLUSIONS FROM WARRANTY. This warranty does not cover problems caused by your acts (or failures to act), the acts of others, or events beyond Xamarin’s reasonable control. + +10. REMEDY FOR BREACH OF WARRANTY. Xamarin will repair or replace the software at no charge. If Xamarin cannot repair or replace it, Xamarin will refund the amount shown on your receipt for the software. It will also repair or replace supplements, updates, and replacement software at no charge. If Xamarin cannot repair or replace them, it will refund the amount you paid for them, if any. You must uninstall the software and return any media and other associated materials to Xamarin with proof of purchase to obtain a refund. These are your only remedies for breach of the limited warranty. + +11. CONSUMER RIGHTS NOT AFFECTED. You may have additional consumer rights under your local laws, which this agreement cannot change. + +12. WARRANTY PROCEDURES. You need proof of purchase for warranty service. + +For warranty service or information about how to obtain a refund for software, contact Microsoft or Xamarin at: + +(800) MICROSOFT; +Microsoft Customer Service and Support, One Microsoft Way, Redmond, WA 98052-6399; +visit aka.ms/nareturns or email xamacctg@microsoft.com. + +13. NO OTHER WARRANTIES. The limited warranty is the only direct warranty from Xamarin. Xamarin gives no other express warranties, guarantees, or conditions. Where allowed by your local laws, Xamarin excludes implied warranties of merchantability, fitness for a particular purpose, and non-infringement. If your local laws give you any implied warranties, guarantees or conditions, despite this exclusion, your remedies are described in the Remedy for Breach of Warranty clause above, to the extent permitted by your local laws. + +FOR AUSTRALIA ONLY. References to “Limited Warranty” are references to the warranty provided by Xamarin. This warranty is given in addition to other rights and remedies you may have under law, including your rights and remedies in accordance with the statutory guarantees under the Australian Consumer Law. Our goods come with guarantees that cannot be excluded under the Australian Consumer Law. You are entitled to a replacement or refund for a major failure and compensation for any other reasonably foreseeable loss or damage. You are also entitled to have the goods repaired or replaced if the goods fail to be of acceptable quality and the failure does not amount to a major failure. Goods presented for repair may be replaced by refurbished goods of the same type rather than being replaced. Refurbished parts may be used to repair the goods. + +14. LIMITATION ON AND EXCLUSION OF DAMAGES FOR BREACH OF WARRANTY. The Limitation on and Exclusion of Damages clause above applies to breaches of this limited warranty. + +This warranty gives you specific legal rights, and you may also have other rights that vary from state to state. You may also have other rights that vary from country to country. + + +SECTION III. GENERAL TERMS: The license terms in this Section III apply to the software regardless of whether you have the Community, Professional, or Enterprise level of the software. + +1. THIRD PARTY COMPONENTS. The software may include third party components with separate legal notices or governed by other agreements, as described in the ThirdPartyNotices file(s) accompanying the software. Even if such components are governed by other agreements, the disclaimers and the limitations on and exclusions of damages below also apply. + +The software may also include components licensed under open source licenses with source code availability obligations. Copies of those licenses, if applicable, are included in the ThirdPartyNotices file(s). You may obtain this source code from us, if and as required under the relevant open source licenses, by sending a money order or check for $5.00 to: Source Code Compliance Team, Microsoft Corporation, 1 Microsoft Way, Redmond, WA 98052. Please write “open source compliance for Xamarin Studio” in the memo line of your payment. + +2. PACKAGE MANAGERS. The software includes package managers, like NuGet, that give you the option to download other Xamarin and third party software packages to use with your application. Those packages are under their own licenses, and not this agreement. Xamarin does not distribute, license or provide any warranties for any of the third party packages. + +3. DISTRIBUTABLE CODE. The software contains code that you are permitted to distribute without modification (except as expressly permitted below) in applications you develop as described in this Section. (For this Section the term “distribution” also means deployment of your applications for third parties to access over the Internet.) + +a. Distribution Rights. The code and other files listed below are “Distributable Code”. + +Distribution in Your Applications. You may copy and distribute the object code form of the Distributable Code only and solely as part of your applications that you develop using the software, and only for use on the platforms identified on the REDIST list located at http://xmn.io/redists. For clarity, the term “distribute” includes deployment of your applications for third parties to access over the Internet. + +Sample Code and Templates. You may copy, modify and distribute the source and object code form of any code marked as “sample” or “template”. + +Third Party Distribution. You may permit distributors of your applications to copy and distribute the Distributable Code as part of those applications. + +b. Distribution Requirements. For any Distributable Code you distribute, you must: + +add significant primary functionality to it in your applications; + +require distributors and external end users to agree to terms that protect the Distributable Code at least as much as this agreement; and + +indemnify, defend, and hold harmless Xamarin from any claims, including attorneys’ fees, related to the distribution or use of your applications, except to the extent that any claim is based solely on the Distributable Code. + +c. Distribution Restrictions. You may not: + +use Xamarin’s trademarks in your applications’ names or in a way that suggests your applications come from or are endorsed by Xamarin; or + +modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An “Excluded License” is one that requires, as a condition of use, modification or distribution, that (i) the code be disclosed or distributed in source code form; or (ii) others have the right to modify it. + +4. DATA. The software may prompt you from time to time to sign in. If you do not sign in when prompted, you may not be able to use the software and access your data in the software. The software may collect information about you and your use of the software, and send that to Xamarin and its affiliates. They may use this information to provide services and improve our products and services. You may opt-out of many of these scenarios, but not all, as described in the product documentation. There are also some features in the software that may enable you and Xamarin to collect data from users of your applications. If you use these features you must comply with applicable law, including providing appropriate notices to users of your applications and you should provide a copy of Microsoft’s privacy statement to your users. The Microsoft privacy statement is located, here https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices. + +5. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you some rights to use the software. Xamarin reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not: + +work around any technical limitations in the software; + +reverse engineer, decompile or disassemble the software, or otherwise attempt to derive the source code for the software except, and only to the extent required by third party licensing terms governing use of certain open source components that may be included with the software; + +remove, minimize, block or modify any notices of Xamarin or its suppliers in the software; + +use the software in any way that is against the law; or + +share, publish, rent or lease the software, or provide the software as a stand-alone hosted solution for others to use. + +6. EXPORT RESTRICTIONS. You must comply with all domestic and international export laws and regulations that apply to the software, which include restrictions on destinations, end users, and end use. For further information on export restrictions, visit www.microsoft.com/exporting. + +7. ENTIRE AGREEMENT. This agreement (including the warranty below), and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and services. + +8. APPLICABLE LAW. If you acquired the software in the United States, Washington law applies to interpretation of and claims for breach of this agreement, and the laws of the state where you live apply to all other claims. If you acquired the software in any other country, its laws apply. + +9. CONSUMER RIGHTS; REGIONAL VARIATIONS. This agreement describes certain legal rights. You may have other rights, including consumer rights, under the laws of your state or country. Separate and apart from your relationship with Xamarin, you may also have rights with respect to the party from which you acquired the software. This agreement does not change those other rights if the laws of your state or country do not permit it to do so. For example, if you acquired the software in one of the below regions, or mandatory country law applies, then the following provisions apply to you: + +a. Australia. References to “Limited Warranty” are references to the express warranty provided by Xamarin or the manufacturer or installer. This warranty is given in addition to other rights and remedies you may have under law, including your rights and remedies in accordance with the statutory guarantees under the Australian Consumer Law. + +In this section, “goods” refers to the software for which Xamarin or the manufacturer or installer provides the express warranty. Our goods come with guarantees that cannot be excluded under the Australian Consumer Law. You are entitled to a replacement or refund for a major failure and compensation for any other reasonably foreseeable loss or damage. You are also entitled to have the goods repaired or replaced if the goods fail to be of acceptable quality and the failure does not amount to a major failure + +b. Canada. If you acquired this software in Canada, you may stop receiving updates by turning off the automatic update feature, disconnecting your device from the Internet (if and when you re-connect to the Internet, however, the software will resume checking for and installing updates), or uninstalling the software. The product documentation, if any, may also specify how to turn off updates for your specific device or software. + +c. Germany and Austria. + +i. Warranty. The properly licensed software will perform substantially as described in any Xamarin materials that accompany the software. However, Xamarin gives no contractual guarantee in relation to the licensed software. + +ii. Limitation of Liability. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as well as, in case of death or personal or physical injury, Xamarin is liable according to the statutory law. + +Subject to the foregoing clause (ii), Xamarin will only be liable for slight negligence if Xamarin is in breach of such material contractual obligations, the fulfillment of which facilitate the due performance of this agreement, the breach of which would endanger the purpose of this agreement and the compliance with which a party may constantly trust in (so-called “cardinal obligations”). In other cases of slight negligence, Xamarin will not be liable for slight negligence. + +10. LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM XAMARIN AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES. + +This limitation applies to (a) anything related to the software, services, content (including code) on third party Internet sites, or third party applications; and (b) claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law. + +It also applies even if Xamarin knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your state or country may not allow the exclusion or limitation of incidental, consequential or other damages. + +Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French. + +Remarque : Ce logiciel étant distribué au Québec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en français. + +EXONÉRATION DE GARANTIE. Le logiciel visé par une licence est offert « tel quel ». Toute utilisation de ce logiciel est à votre seule risque et péril. Xamarin n’accorde aucune autre garantie expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues. + +LIMITATION DES DOMMAGES-INTÉRÊTS ET EXCLUSION DE RESPONSABILITÉ POUR LES DOMMAGES. Vous pouvez obtenir de Xamarin et de ses fournisseurs une indemnisation en cas de dommages directs uniquement à hauteur de 5,00 $ US. Vous ne pouvez prétendre à aucune indemnisation pour les autres dommages, y compris les dommages spéciaux, indirects ou accessoires et pertes de bénéfices. + +Cette limitation concerne: + +tout ce qui est relié au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers; et + +les réclamations au titre de violation de contrat ou de garantie, ou au titre de responsabilité stricte, de négligence ou d’une autre faute dans la limite autorisée par la loi en vigueur. + +Elle s’applique également, même si Xamarin connaissait ou devrait connaître l’éventualité d’un tel dommage. Si votre pays n’autorise pas l’exclusion ou la limitation de responsabilité pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l’exclusion ci-dessus ne s’appliquera pas à votre égard. + +EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre pays si celles-ci ne le permettent pas. + +EULA ID: Xamarin Studio 10 November 2016 +