Skip to content

Commit eb71848

Browse files
authored
[msbuild] Merge the ILStrip and ILStripTaskBase classes. (#18211)
We no longer need to have overridable logic for remote builds, so the non-abstract task class and the abstract base class can be merged. Also enable nullability and fix any issues.
1 parent 32bf0b1 commit eb71848

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1+
using System;
12
using System.Collections.Generic;
3+
using System.Linq;
24
using System.IO;
5+
36
using Microsoft.Build.Framework;
7+
using Microsoft.Build.Tasks;
48
using Microsoft.Build.Utilities;
59

6-
// Normally this would be ILStrip.Tasks but ILStrip is in the global namespace
7-
// And having a type and the parent namespace have the same name really confuses the compiler
8-
namespace ILStripTasks {
9-
public class ILStripBase : ILStrip {
10-
public string SessionId { get; set; }
10+
using Xamarin.Messaging.Build.Client;
11+
12+
#nullable enable
13+
14+
namespace Xamarin.MacDev.Tasks {
15+
public class ILStrip : global::ILStrip, ITaskCallback {
16+
public string SessionId { get; set; } = string.Empty;
1117

1218
[Output]
13-
public ITaskItem [] StrippedAssemblies { get; set; }
19+
public ITaskItem [] StrippedAssemblies { get; set; } = Array.Empty<ITaskItem> ();
1420

1521
public override bool Execute ()
1622
{
23+
if (this.ShouldExecuteRemotely (SessionId))
24+
return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;
25+
1726
var result = base.Execute ();
1827

1928
var stripedItems = new List<ITaskItem> ();
@@ -28,5 +37,11 @@ public override bool Execute ()
2837

2938
return result;
3039
}
40+
41+
public bool ShouldCopyToBuildServer (ITaskItem item) => false;
42+
43+
public bool ShouldCreateOutputFile (ITaskItem item) => true;
44+
45+
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> ();
3146
}
3247
}

0 commit comments

Comments
 (0)