All other changes should be blank space only: https://github.com/xamarin/xamarin-macios/pull/16132/files?w=1

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
This commit is contained in:
Rolf Bjarne Kvinge 2022-09-28 16:25:35 +02:00 коммит произвёл GitHub
Родитель b6d484e3c4
Коммит 9e0fecc4ff
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
197 изменённых файлов: 1185 добавлений и 1520 удалений

6
.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"

Просмотреть файл

@ -1,6 +1,4 @@
namespace Xamarin.Mac.Tasks
{
public class Mmp : MmpTaskBase
{
namespace Xamarin.Mac.Tasks {
public class Mmp : MmpTaskBase {
}
}

Просмотреть файл

@ -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 <string> allSupportedArchs = new List <string> ();
List<string> allSupportedArchs = new List<string> ();
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);
}
}

Просмотреть файл

@ -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,

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<string> illegalDirectoryNames = new HashSet<string> (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);
}

Просмотреть файл

@ -6,14 +6,12 @@ using System.Collections.Generic;
using Microsoft.Build.Utilities;
using Xamarin.Utils;
namespace Xamarin.MacDev
{
namespace Xamarin.MacDev {
/// <summary>
/// Builds a process argument string.
/// </summary>
public class CommandLineArgumentBuilder
{
static readonly char[] QuoteSpecials = new char[] { ' ', '\\', '\'', '"', ',', ';' };
public class CommandLineArgumentBuilder {
static readonly char [] QuoteSpecials = new char [] { ' ', '\\', '\'', '"', ',', ';' };
readonly HashSet<string> hash = new HashSet<string> ();
readonly StringBuilder builder = new StringBuilder ();
@ -69,7 +67,7 @@ namespace Xamarin.MacDev
/// <summary>
/// Adds multiple arguments without escaping or quoting.
/// </summary>
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
/// <summary>
/// Adds a formatted argument, quoting and escaping as necessary.
/// </summary>
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
/// <summary>
/// Adds multiple arguments, quoting and escaping each as necessary.
/// </summary>
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))

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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
}
}

Просмотреть файл

@ -21,7 +21,7 @@ namespace Xamarin.MacDev.Tasks {
Frameworks = new HashSet<string> ();
}
public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem[] NativeReferences)
public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem [] NativeReferences)
{
if (NativeReferences == null)
return;

Просмотреть файл

@ -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}: <null>", 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}: <null>", 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
/// <param name="errorCode">In the 7xxx range for MSBuild error.</param>
/// <param name="message">The error's message to be displayed in the error pad.</param>
/// <param name="fileName">Path to the known guilty file or null.</param>
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);
}

Просмотреть файл

@ -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))

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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 ();

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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 ()

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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 ();

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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))

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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 ()

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -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))

Просмотреть файл

@ -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; }
}
}

Просмотреть файл

@ -1,5 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
namespace Xamarin.MacDev.Tasks {
public enum NativeReferenceKind {
Static,
Dynamic,

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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<string, string> 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]);
}
}

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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<string, string> environment, CommandLineArgumentBuilder args, ITaskItem[] items)
protected override void AppendCommandLineArguments (IDictionary<string, string> environment, CommandLineArgumentBuilder args, ITaskItem [] items)
{
var assetDirs = new HashSet<string> (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);

Просмотреть файл

@ -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 ();

Просмотреть файл

@ -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 ()

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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 ()
{

Просмотреть файл

@ -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");
}
}

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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 ();
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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
};

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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<ITaskItem> ();
public ITaskItem [] CustomEntitlements { get; set; } = Array.Empty<ITaskItem> ();
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) {

Просмотреть файл

@ -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<ITaskItem> 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);
}
}
}

Просмотреть файл

@ -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 ()
{

Просмотреть файл

@ -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 <string> archStrings = new HashSet <string> (architectures.ToArray ().Select (a => a.ToNativeArchitecture ()));
HashSet<string> archStrings = new HashSet<string> (architectures.ToArray ().Select (a => a.ToNativeArchitecture ()));
if (plist.TryGetValue (ProductDefinitionKeys.Architectures, out PArray archArray)) {
var existingArchs = archArray.ToStringArray ();
if (!archStrings.SetEquals (existingArchs)) {

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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<Task> ();
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));

Просмотреть файл

@ -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<string, List<ITaskItem>> ();
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);

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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);

Просмотреть файл

@ -49,9 +49,9 @@ namespace Xamarin.MacDev.Tasks {
public ITaskItem [] NativeStripItems { get; set; } = Array.Empty<ITaskItem> ();
[Output]
public ITaskItem[] OutputCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] OutputCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem[] SkipCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] SkipCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
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;

Просмотреть файл

@ -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 ()
{

Просмотреть файл

@ -92,7 +92,7 @@ namespace Xamarin.MacDev.Tasks {
var arguments = new List<string> ();
var environment = default (Dictionary<string, string>);
if (IsDotNet) {
if (IsDotNet) {
executable = Environment.GetEnvironmentVariable ("DOTNET_HOST_PATH");
if (string.IsNullOrEmpty (executable))
executable = "dotnet";

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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",

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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]

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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]

Просмотреть файл

@ -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)) {

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -1,6 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
public class CreateInstallerPackage : CreateInstallerPackageTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class CreateInstallerPackage : CreateInstallerPackageTaskBase {
}
}

Просмотреть файл

@ -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<string, string> (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 ()

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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]

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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<ITaskItem> ();
public ITaskItem [] DsymContentFiles { get; set; } = Array.Empty<ITaskItem> ();
#endregion

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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]

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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<X509Certificate2> certs, string[] prefixes, bool allowZeroCerts)
bool TryGetSigningCertificates (SecKeychain keychain, out IList<X509Certificate2> certs, string [] prefixes, bool allowZeroCerts)
{
var now = DateTime.Now;
@ -400,8 +397,7 @@ namespace Xamarin.MacDev.Tasks
}
}
class SigningIdentityComparer : IComparer<CodeSignIdentity>
{
class SigningIdentityComparer : IComparer<CodeSignIdentity> {
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<CodeSignIdentity> 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 ();

Просмотреть файл

@ -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<ITaskItem> GetAdditionalItemsToBeCopied ()
{
if (!Directory.Exists(Source.ItemSpec))
{
if (!Directory.Exists (Source.ItemSpec))
return Enumerable.Empty<ITaskItem> ();
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;

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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]

Просмотреть файл

@ -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 ()
{

Просмотреть файл

@ -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; }

Просмотреть файл

@ -1,6 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
public class FindItemWithLogicalName : FindItemWithLogicalNameTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class FindItemWithLogicalName : FindItemWithLogicalNameTaskBase {
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -1,6 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
public class GenerateBundleName : GenerateBundleNameTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class GenerateBundleName : GenerateBundleNameTaskBase {
}
}

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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 ())

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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 ())

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше