Skip to content

Commit bb5ea75

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 866ed06 commit bb5ea75

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
@@ -1912,7 +1912,6 @@
19121912
<!-- When we're building a universal app, we need to collect the list of user frameworks we need to run dsymutil on -->
19131913
<Target Name="_CollectRidSpecificUserFrameworksWithoutDebugSymbols">
19141914
<ReadItemsFromFile
1915-
SessionId="$(BuildSessionId)"
19161915
File="%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)"
19171916
Condition="Exists('%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)')"
19181917
>
@@ -1933,9 +1932,8 @@
19331932

19341933
<!-- Read the stored list of files to sign if we're an outer build of a multi-rid build -->
19351934
<ReadItemsFromFile
1936-
SessionId="$(BuildSessionId)"
19371935
File="%(_RidSpecificCodesignItemsPath.Identity)"
1938-
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0 And '$(IsMacEnabled)' == 'true'"
1936+
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0"
19391937
>
19401938
<Output TaskParameter="Items" ItemName="_RidSpecificCodesignItems" />
19411939
</ReadItemsFromFile>
@@ -2245,8 +2243,7 @@
22452243

22462244
<!-- Write a list of files to sign if we're not an outer build of a multi-rid build -->
22472245
<WriteItemsToFile
2248-
SessionId="$(BuildSessionId)"
2249-
Condition="'$(IsMacEnabled)' == 'true' And '$(_CodesignItemsPath)' != ''"
2246+
Condition="'$(_CodesignItemsPath)' != ''"
22502247
Items="@(_CreateDumpExecutableToSign)"
22512248
ItemName="_CodesignItems"
22522249
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)