Skip to content

Commit f33d81e

Browse files
emafrolfbjarne
authored andcommitted
Keep remote ReadItemsFromFile support
Some files are written remotely as part of other tasks (not through WriteItemsToFile), like the linker outputs (Illink).
1 parent 518c3d3 commit f33d81e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

dotnet/targets/Xamarin.Shared.Sdk.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@
10171017
<_ExistingLinkerItemFiles Include="@(_LinkerItemFiles)" Condition="Exists('%(Identity)')" />
10181018
</ItemGroup>
10191019

1020-
<ReadItemsFromFile File="@(_ExistingLinkerItemFiles)" Condition="'@(_ExistingLinkerItemFiles)' != ''">
1020+
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="@(_ExistingLinkerItemFiles)" Condition="'@(_ExistingLinkerItemFiles)' != ''">
10211021
<Output TaskParameter="Items" ItemName="_AllLinkerItems" />
10221022
</ReadItemsFromFile>
10231023

msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
using Microsoft.Build.Tasks;
99
using System.Xml.Linq;
1010

11+
using Xamarin.Messaging.Build.Client;
12+
1113
namespace Xamarin.MacDev.Tasks {
12-
public class ReadItemsFromFile : XamarinTask {
14+
public class ReadItemsFromFile : XamarinTask, ITaskCallback {
1315
static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003");
1416

1517
static readonly XName ItemGroupElementName = XmlNs + "ItemGroup";
@@ -32,6 +34,9 @@ public class ReadItemsFromFile : XamarinTask {
3234

3335
public override bool Execute ()
3436
{
37+
if (ShouldExecuteRemotely ())
38+
return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;
39+
3540
var result = new List<ITaskItem> ();
3641
foreach (var file in File) {
3742
// XDocument.Load(string) takes a string to a URI, not a file path, so with certain characters that becomes a problem.
@@ -68,5 +73,11 @@ ITaskItem CreateItemFromElement (XElement element, string sourceFile)
6873

6974
return item;
7075
}
76+
77+
public bool ShouldCopyToBuildServer (ITaskItem item) => false;
78+
79+
public bool ShouldCreateOutputFile (ITaskItem item) => false;
80+
81+
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied () => Enumerable.Empty<ITaskItem> ();
7182
}
7283
}

0 commit comments

Comments
 (0)