Skip to content

Commit 606e87b

Browse files
emafrolfbjarne
authored andcommitted
[msbuild] Always run WriteItemsFromFile locally.
Always run WriteItemsFromFile locally, as these operations just read/write items from/to an XML file, this is something we don't need to run remotely when building from Windows. This improves the build performance and also fixes some inconsistencies we had were sometimes files were written locally and read remotely (or the other way around). This means we need to adjust any corresponding ReadItemsFromFile calls accordingly. It also allows us to remove the remoting support in WriteItemsFromFile, but we can't remove remoting support for ReadItemsFromFile, because sometimes we have to read files that aren't written with WriteItemsFromFile (they're written by other tasks).
1 parent 5a9fa32 commit 606e87b

File tree

3 files changed

+8
-24
lines changed

3 files changed

+8
-24
lines changed

dotnet/targets/Xamarin.Shared.Sdk.targets

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,7 +1901,6 @@
19011901
<!-- When we're building a universal app, we need to collect the list of user frameworks we need to run dsymutil on -->
19021902
<Target Name="_CollectRidSpecificUserFrameworksWithoutDebugSymbols">
19031903
<ReadItemsFromFile
1904-
SessionId="$(BuildSessionId)"
19051904
File="%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)"
19061905
Condition="Exists('%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)')"
19071906
>
@@ -1922,9 +1921,8 @@
19221921

19231922
<!-- Read the stored list of files to sign if we're an outer build of a multi-rid build -->
19241923
<ReadItemsFromFile
1925-
SessionId="$(BuildSessionId)"
19261924
File="%(_RidSpecificCodesignItemsPath.Identity)"
1927-
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0 And '$(IsMacEnabled)' == 'true'"
1925+
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0"
19281926
>
19291927
<Output TaskParameter="Items" ItemName="_RidSpecificCodesignItems" />
19301928
</ReadItemsFromFile>
@@ -2234,8 +2232,7 @@
22342232

22352233
<!-- Write a list of files to sign if we're not an outer build of a multi-rid build -->
22362234
<WriteItemsToFile
2237-
SessionId="$(BuildSessionId)"
2238-
Condition="'$(IsMacEnabled)' == 'true' And '$(_CodesignItemsPath)' != ''"
2235+
Condition="'$(_CodesignItemsPath)' != ''"
22392236
Items="@(_CreateDumpExecutableToSign)"
22402237
ItemName="_CodesignItems"
22412238
File="$(_CodesignItemsPath)"

msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs

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

11-
using Xamarin.Messaging.Build.Client;
12-
1311
namespace Xamarin.MacDev.Tasks {
14-
public class WriteItemsToFile : XamarinTask, ICancelableTask {
12+
public class WriteItemsToFile : XamarinTask {
1513
static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003");
1614

1715
static readonly XName ProjectElementName = XmlNs + "Project";
@@ -36,9 +34,6 @@ public class WriteItemsToFile : XamarinTask, ICancelableTask {
3634

3735
public override bool Execute ()
3836
{
39-
if (ShouldExecuteRemotely ())
40-
return ExecuteRemotely ();
41-
4237
Write (this, File?.ItemSpec, Items, ItemName, Overwrite, IncludeMetadata);
4338
return true;
4439
}
@@ -83,11 +78,5 @@ static IEnumerable<XElement> CreateMetadataFromItem (ITaskItem item, bool includ
8378

8479
return Enumerable.Empty<XElement> ();
8580
}
86-
87-
public void Cancel ()
88-
{
89-
if (ShouldExecuteRemotely ())
90-
BuildConnection.CancelAsync (BuildEngine4).Wait ();
91-
}
9281
}
9382
}

msbuild/Xamarin.Shared/Xamarin.Shared.targets

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
372372

373373
<RemoveDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="$(AppBundleDir).mSYM;@(_DebugSymbolDir)" />
374374
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)*.bcsymbolmap" />
375-
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)postprocessing.items" />
375+
<Delete Files="$(DeviceSpecificOutputPath)postprocessing.items" />
376376
</Target>
377377

378378
<Target Name="_CleanITunesArtwork" Condition="'$(_CanArchive)' == 'true'" DependsOnTargets="_ComputeTargetArchitectures">
@@ -405,9 +405,9 @@ Copyright (C) 2018 Microsoft. All rights reserved.
405405
<_IpaPackageFile Include="$(DeviceSpecificOutputPath)*.ipa" />
406406
</ItemGroup>
407407

408-
<Delete Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)codesign.items" />
409-
<Delete Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)codesign-bundle.items" />
410-
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)native-frameworks.items" />
408+
<Delete Files="$(DeviceSpecificOutputPath)codesign.items" />
409+
<Delete Files="$(DeviceSpecificOutputPath)codesign-bundle.items" />
410+
<Delete Files="$(DeviceSpecificOutputPath)native-frameworks.items" />
411411
<Delete SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="@(_IpaPackageFile)" />
412412
</Target>
413413

@@ -2529,7 +2529,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
25292529
>
25302530

25312531
<WriteItemsToFile
2532-
Condition="'$(IsMacEnabled)' == 'true'"
25332532
Items="@(_CodesignBundle)"
25342533
ItemName="_CodesignBundle"
25352534
File="$(DeviceSpecificOutputPath)codesign-bundle.items"
@@ -2538,7 +2537,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
25382537
/>
25392538

25402539
<WriteItemsToFile
2541-
Condition="'$(IsMacEnabled)' == 'true'"
25422540
Items="@(_CodesignItems)"
25432541
ItemName="_CodesignItems"
25442542
File="$(DeviceSpecificOutputPath)codesign.items"
@@ -2999,7 +2997,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
29992997
>
30002998

30012999
<WriteItemsToFile
3002-
Condition="'$(IsMacEnabled)' == 'true' And '$(_PostProcessingItemPath)' != ''"
3000+
Condition="'$(_PostProcessingItemPath)' != ''"
30033001
Items="@(_PostProcessingItem)"
30043002
ItemName="_PostProcessingItem"
30053003
File="$(_PostProcessingItemPath)"

0 commit comments

Comments
 (0)