Skip to content

Commit d75305a

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 8a9ad82 commit d75305a

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
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 & 9 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 SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Files="$(DeviceSpecificOutputPath)codesign.items" />
409-
<Delete SessionId="$(BuildSessionId)" 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

@@ -2530,8 +2530,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
25302530
>
25312531

25322532
<WriteItemsToFile
2533-
Condition="'$(IsMacEnabled)' == 'true'"
2534-
SessionId="$(BuildSessionId)"
25352533
Items="@(_CodesignBundle)"
25362534
ItemName="_CodesignBundle"
25372535
File="$(DeviceSpecificOutputPath)codesign-bundle.items"
@@ -2540,8 +2538,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
25402538
/>
25412539

25422540
<WriteItemsToFile
2543-
Condition="'$(IsMacEnabled)' == 'true'"
2544-
SessionId="$(BuildSessionId)"
25452541
Items="@(_CodesignItems)"
25462542
ItemName="_CodesignItems"
25472543
File="$(DeviceSpecificOutputPath)codesign.items"
@@ -3002,7 +2998,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
30022998
>
30032999

30043000
<WriteItemsToFile
3005-
Condition="'$(IsMacEnabled)' == 'true' And '$(_PostProcessingItemPath)' != ''"
3001+
Condition="'$(_PostProcessingItemPath)' != ''"
30063002
Items="@(_PostProcessingItem)"
30073003
ItemName="_PostProcessingItem"
30083004
File="$(_PostProcessingItemPath)"

0 commit comments

Comments
 (0)