-
Notifications
You must be signed in to change notification settings - Fork 518
/
Copy pathXamarin.iOS.Common.After.targets
393 lines (337 loc) · 23.3 KB
/
Xamarin.iOS.Common.After.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<?xml version="1.0" encoding="utf-8"?>
<!--
***********************************************************************************************
Xamarin.iOS.Common.After.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (C) 2010-2011 Novell. All rights reserved.
Copyright (C) 2011-2013 Xamarin. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.MacDev.Tasks.WriteItemsToFile" AssemblyFile="$(CoreiOSSdkDirectory)Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.Zip" AssemblyFile="$(CoreiOSSdkDirectory)Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.CopyArchiveFiles" AssemblyFile="$(CoreiOSSdkDirectory)Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.ILLink" AssemblyFile="$(CoreiOSSdkDirectory)Xamarin.iOS.Tasks.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.Windows.CreateArchiveDirectory" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.Windows.ResolveUniversalTypeIdentifiers" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<UsingTask TaskName="Xamarin.iOS.Tasks.Windows.Unzip" AssemblyFile="Xamarin.iOS.Tasks.Windows.dll" />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Messaging.Build.targets" Condition="Exists('$(MSBuildThisFileDirectory)Xamarin.Messaging.Build.targets') And '$(MessagingBuildTargetsImported)' != 'true'" />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.iOS.Windows.After.targets" Condition="Exists('$(MSBuildThisFileDirectory)Xamarin.iOS.Windows.After.targets')" />
<Target Name="EnsureMacConnection"
DependsOnTargets="_SayHello"
BeforeTargets="_CleanDebugSymbols;_CleanAppBundle;_DetectAppManifest;_DetectSdkLocations;_GenerateBundleName" />
<PropertyGroup>
<CreateAppBundleDependsOn>
GetBundleResourceWithLogicalNameItems;
$(CreateAppBundleDependsOn)
</CreateAppBundleDependsOn>
</PropertyGroup>
<Target Name="GetBundleResourceWithLogicalNameItems" Returns="@(_BundleResourceWithLogicalName)" DependsOnTargets="_GenerateBundleName">
<ItemGroup>
<!-- We need this metadata to fix the source in VS -->
<_BundleResourceWithLogicalName>
<BuildSessionId>$(BuildSessionId)</BuildSessionId>
<BuildServerPath>..\..\$(BuildAppName)\$(BuildSessionId)\%(Identity)</BuildServerPath>
<BuildServerPath Condition="'$(IsWatchApp)' == 'true' Or '$(IsAppExtension)' == 'true'">..\..\$(_AppBundleName)\$(BuildSessionId)\%(Identity)</BuildServerPath>
</_BundleResourceWithLogicalName>
</ItemGroup>
<CollectMonotouchReferences References="@(_MSBuildProjectReferenceExistent)">
<Output TaskParameter="MonoTouchReferences" ItemName="MonoTouchReferences" />
</CollectMonotouchReferences>
<!-- This will collect the bundle resource items in the referenced projects -->
<MSBuild Projects="@(MonoTouchReferences)" Targets="GetBundleResourceWithLogicalNameItems" BuildInParallel="$(BuildInParallel)" RebaseOutputs="true" Properties="%(MonoTouchReferences.SetConfiguration); %(MonoTouchReferences.SetPlatform)" Condition="'@(MonoTouchReferences)' != '' and '%(MonoTouchReferences.Private)' != 'false' and '$(UseCommonOutputDirectory)' != 'true'" ContinueOnError="$(ContinueOnError)">
<Output TaskParameter="TargetOutputs" ItemName="_BundleResourceWithLogicalName" />
</MSBuild>
</Target>
<PropertyGroup>
<CreateIpaDependsOn>
$(CreateIpaDependsOn);
CopyIpaFromMac
</CreateIpaDependsOn>
<_BeforeCreateIpaForDistributionDependsOn>
_SayHello;
CopyArchiveToMac;
$(_BeforeCreateIpaForDistributionDependsOn);
</_BeforeCreateIpaForDistributionDependsOn>
<ArchiveDependsOn>
$(ArchiveDependsOn);
CopyArchiveFromMac
</ArchiveDependsOn>
</PropertyGroup>
<Target Name="CopyAppBundleFromMac" Condition="'$(OutputType)' == 'Exe' And '$(IsMacEnabled)' == 'true' And '$(CopyAppBundle)' == 'true'" BeforeTargets="BeforeDisconnect">
<!-- Creates AppBundle dir on the output path -->
<MakeDir Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true'" SessionId="$(BuildSessionId)" Directories="$(DeviceSpecificOutputPath)AppBundle" />
<!--Zip AppBundle-->
<Zip SessionId="$(BuildSessionId)" Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true'" ToolExe="$(ZipExe)" ToolPath="$(ZipPath)" Recursive="true" Sources="$(DeviceSpecificOutputPath)$(_AppBundleName)$(AppBundleExtension)" OutputFile="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" WorkingDirectory="$(DeviceSpecificOutputPath)AppBundle" />
<!--Copy Zip from Mac-->
<Message Text="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" />
<CopyFileFromBuildServer Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true'" SessionId="$(BuildSessionId)" File="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" />
<!--Unzip App Bundle on Windows-->
<Unzip Condition="Exists('$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip')" ZipFilePath="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" ExtractionPath="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName)$(AppBundleExtension)" />
<!-- Delete Zip file -->
<Delete Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true' And Exists('$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip')" SessionId="$(BuildSessionId)" Files="$(DeviceSpecificOutputPath)AppBundle\$(_AppBundleName).zip" />
</Target>
<Target Name="CopyIpaFromMac" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'">
<CopyFileFromBuildServer Condition="'$(IsAppDistribution)' == 'True'" SessionId="$(BuildSessionId)" File="$(IpaPackagePath)" TargetFile="$(DistributionPath)" />
<CopyFileFromBuildServer Condition="'$(IsAppDistribution)' != 'True'" SessionId="$(BuildSessionId)" File="$(IpaPackagePath)" />
<CopyFileFromBuildServer Condition="('$(_DistributionType)' == 'AppStore' Or '$(_DistributionType)' == 'AdHoc') And '$(EmbedOnDemandResources)' == 'false'" SessionId="$(BuildSessionId)" File="$(IpaPackageDir)\OnDemandResources\%(_AssetPack.DirectoryName)" />
<CopyFileFromBuildServer Condition="('$(_DistributionType)' == 'AppStore' Or '$(_DistributionType)' == 'AdHoc') And '$(EmbedOnDemandResources)' == 'false'" SessionId="$(BuildSessionId)" File="$(IpaPackageDir)\OnDemandResources\AssetPackManifest.plist" />
</Target>
<!-- Override Build -->
<Target Name="Build" Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(BuildDependsOn)" Returns="@(TargetPath)">
<ItemGroup>
<TargetPath Include="$(TargetPath)">
<ArchivePath Condition="'$(ArchiveOnBuild)' == 'true'">$(ArchivePath)</ArchivePath>
</TargetPath>
</ItemGroup>
</Target>
<Target Name="CopyArchiveFromMac" Condition="'$(_CanArchive)' == 'true' And '$(ArchiveOnBuild)' == 'true'">
<Error Condition="'$(IsMacEnabled)' != 'true'" Text="A connection to a Mac is required in order to continue" />
<PropertyGroup>
<_ArchiveName>$([System.IO.Path]::GetFileName($(ArchiveDir)))</_ArchiveName>
<_ArchiveZipWorkingDirOnMac>$(DeviceSpecificIntermediateOutputPath)archives</_ArchiveZipWorkingDirOnMac>
<_ArchiveZipFileNameOnMac>$([System.Guid]::NewGuid())</_ArchiveZipFileNameOnMac>
<_ArchiveZipFileNameOnMac>$(_ArchiveZipWorkingDirOnMac)\$(_ArchiveZipFileNameOnMac.Substring(0, $(_ArchiveZipFileNameOnMac.IndexOf('-')))).zip</_ArchiveZipFileNameOnMac>
</PropertyGroup>
<MakeDir SessionId="$(BuildSessionId)" Directories="$(_ArchiveZipWorkingDirOnMac)" />
<CopyArchiveFiles ArchivePath="$(ArchiveDir)" SessionId="$(BuildSessionId)" AppName="$(BuildAppName)" TargetPath="$(_ArchiveZipWorkingDirOnMac)" />
<Zip SessionId="$(BuildSessionId)" Condition="'$(MtouchTargetsEnabled)'" ToolExe="$(ZipExe)" ToolPath="$(ZipPath)" Recursive="true" Symlinks="true" Sources="$(ArchiveDir)" OutputFile="$(_ArchiveZipFileNameOnMac)" WorkingDirectory="$([System.IO.Path]::GetDirectoryName($(ArchiveDir)))" />
<CreateArchiveDirectory ArchiveBasePath="$(ArchiveBasePath)">
<Output TaskParameter="ArchiveRootDir" PropertyName="ArchiveRootDirOnWin" />
</CreateArchiveDirectory>
<PropertyGroup>
<_ArchiveZipFileNameOnWin>$(ArchiveRootDirOnWin)\$([System.IO.Path]::GetFileName($(_ArchiveZipFileNameOnMac)))</_ArchiveZipFileNameOnWin>
<ArchivePath>$(ArchiveRootDirOnWin)\$(_ArchiveName)</ArchivePath>
</PropertyGroup>
<CopyFileFromBuildServer SessionId="$(BuildSessionId)" File="$(_ArchiveZipFileNameOnMac)" TargetFile="$(_ArchiveZipFileNameOnWin)" />
<Unzip ZipFilePath="$(_ArchiveZipFileNameOnWin)" ExtractionPath="$(ArchiveRootDirOnWin)" />
<Delete Files="$(_ArchiveZipFileNameOnMac)" />
<Delete Files="$(_ArchiveZipFileNameOnWin)" />
</Target>
<Target Name="CopyArchiveToMac" Condition="'$(_CanArchive)' == 'true'">
<Error Condition="'$(IsMacEnabled)' != 'true'" Text="A connection to a Mac is required in order to continue" />
<PropertyGroup>
<_ArchiveName>$([System.IO.Path]::GetFileName($(ArchivePath)))</_ArchiveName>
</PropertyGroup>
<ItemGroup>
<_ArchiveFiles Include="$(ArchivePath)\**\*.*" Exclude="$(ArchivePath)\**\_CodeSignature\CodeResources" />
<_ArchiveItems Include="@(_ArchiveFiles)">
<TargetPath>$(MSBuildProjectDirectory)\$(DeviceSpecificIntermediateOutputPath)archives\$(_ArchiveName)\%(_ArchiveFiles.RecursiveDir)%(_ArchiveFiles.Filename)%(_ArchiveFiles.Extension)</TargetPath>
</_ArchiveItems>
<_ArchiveCodeResourceToDelete Include="$(DeviceSpecificIntermediateOutputPath)archives\$(_ArchiveName)\**\_CodeSignature\CodeResources" />
</ItemGroup>
<CopyFilesToBuildServer SessionId="$(BuildSessionId)" Files="@(_ArchiveItems)" />
<PropertyGroup>
<!-- Overrides $(ArchivePath) with the path of the file copied the Mac -->
<ArchivePath>$(MSBuildProjectDirectory)\$(DeviceSpecificIntermediateOutputPath)archives\$(_ArchiveName)</ArchivePath>
</PropertyGroup>
<!-- Ensure there's no CodeResources file in the archive folder that will be used as output of _CodesignAppBundle -->
<!-- since publishing needs to force siging the bundle on each run -->
<Delete Files="@(_ArchiveCodeResourceToDelete)" />
<!-- Copying archive on Windows to the same location it was copied on the Mac because of _CalculateCodesignAppBundleInputs -->
<CopyLongPaths SourceFiles="@(_ArchiveItems)" DestinationFiles="%(_ArchiveItems.TargetPath)">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</CopyLongPaths>
</Target>
<Target Name="CopyDSYMFromMac" DependsOnTargets="_SayHello" Condition="'$(IsMacEnabled)' == 'true' And '$(IsAppExtension)' == 'false' And '$(ComputedPlatform)' == 'iPhone' And '$(CopyDSYM)' == 'true' And ('$(BuildIpa)' == 'true' Or '$(CopyAppBundle)' == 'true')" BeforeTargets="BeforeDisconnect">
<!--Copy watchOS Dsym folders from Mac-->
<MSBuild Projects="@(_WatchAppReferenceWithConfigurationExistent)" Targets="CopyDSYMFromMac" Properties="%(_WatchAppReferenceWithConfigurationExistent.SetConfiguration); %(_WatchAppReferenceWithConfigurationExistent.SetPlatform); BuildIpa=true" Condition="'$(IsWatchApp)' == 'false' And '@(_WatchAppReferenceWithConfigurationExistent)' != '' And '$(_BuildReferencedExtensionProjects)' != 'true'"></MSBuild>
<!--Look for all *.dsym folders int the output path of the main app -->
<GetDirectories SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Path="$(DeviceSpecificOutputPath)" Pattern="*.dSYM">
<Output TaskParameter="Directories" ItemName="_DSYMDir" />
</GetDirectories>
<ItemGroup>
<_DSYMDir>
<DsymFileName>%(_DSYMDir.Filename)%(_DSYMDir.Extension)</DsymFileName>
</_DSYMDir>
</ItemGroup>
<!--Zip Dsym folders-->
<Zip SessionId="$(BuildSessionId)" Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true' And '@(_DSYMDir)' != ''" ToolExe="$(ZipExe)" ToolPath="$(ZipPath)" Recursive="true" Symlinks="true" Sources="@(_DSYMDir)" OutputFile="$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip" WorkingDirectory="$(DeviceSpecificOutputPath)" />
<CopyFileFromBuildServer Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true' And '@(_DSYMDir)' != ''" SessionId="$(BuildSessionId)" File="$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip" />
<Unzip Condition="Exists('$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip')" ZipFilePath="$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip" ExtractionPath="$(DeviceSpecificOutputPath)" />
<Delete Condition="'$(MtouchTargetsEnabled)' And '$(IsMacEnabled)' == 'true' And Exists('$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip')" SessionId="$(BuildSessionId)" Files="$(DeviceSpecificOutputPath)%(_DSYMDir.DsymFileName).zip" />
</Target>
<Target Name="_AfterCreateIpaForDistribution" Condition="'$(IsAppDistribution)' == 'true'" AfterTargets="CreateIpa" DependsOnTargets="_SaveIpaForDistributionMacPath;_SayGoodbye" />
<Target Name="_AfterValidateBundleForDistribution" Condition="'$(IsAppDistribution)' == 'true'" AfterTargets="ValidateAppStoreBundle" DependsOnTargets="_SayGoodbye" />
<Target Name="_AfterUploadBundleForDistribution" Condition="'$(IsAppDistribution)' == 'true'" AfterTargets="UploadAppStoreBundle" DependsOnTargets="_SayGoodbye" />
<Target Name="_SaveIpaForDistributionMacPath" Condition="'$(IsAppDistribution)' == 'true'" >
<WriteItemsToFile Items="$(IpaPackagePath)" ItemName="_IpaPackagePath" File="$(DeviceSpecificIntermediateOutputPath)IpaPackagePath" Overwrite="true" />
</Target>
<Target Name="_BeforeValidateAppStoreBundle" BeforeTargets="ValidateAppStoreBundle" DependsOnTargets="_ReadIpaForDistributionMacPath"/>
<Target Name="_BeforeUploadAppStoreBundle" BeforeTargets="UploadAppStoreBundle" DependsOnTargets="_ReadIpaForDistributionMacPath"/>
<Target Name="_ReadIpaForDistributionMacPath" >
<ReadItemsFromFile File="$(DeviceSpecificIntermediateOutputPath)IpaPackagePath" Condition="Exists('$(DeviceSpecificIntermediateOutputPath)IpaPackagePath')">
<Output TaskParameter="Items" ItemName="IpaPackagePath" />
</ReadItemsFromFile>
<PropertyGroup>
<FilePath>%(IpaPackagePath.Identity)</FilePath>
</PropertyGroup>
<Message Importance="high" Text="Resolved Path: $(IpaPackagePath)" />
</Target>
<Target Name="_SetMtouchProjectDirectory" AfterTargets="_SayHello" BeforeTargets="_CompileToNative">
<PropertyGroup>
<MtouchProjectDirectory>$(MacBuildPath)</MtouchProjectDirectory>
</PropertyGroup>
</Target>
<Target Name="_ResolveUniversalTypeIdentifiers" BeforeTargets="_CompileImageAssets" Condition="'$(IsMacEnabled)' == 'true'"
Inputs="@(ImageAsset);" Outputs="@(ImageAsset -> '$(DeviceSpecificIntermediateOutputPath)%(FileName)%(Extension).ResolveUTIs.stamp')">
<ItemGroup>
<_ResolveUTIOutputs Include="@(ImageAsset -> '$(DeviceSpecificIntermediateOutputPath)%(FileName)%(Extension).ResolveUTIs.stamp')" />
<FileWrites Include="@(_ResolveUTIOutputs)" />
</ItemGroup>
<ResolveUniversalTypeIdentifiers
Condition="'@(ImageAsset)' != ''"
SessionId="$(BuildSessionId)"
ImageAssets="@(ImageAsset)"
ProjectDir="$(MSBuildProjectDirectory)" />
<Touch AlwaysCreate="true" Files="@(_ResolveUTIOutputs)" />
</Target>
<!-- Copies files needed by _CopyResolvedFilesToPublishPreserveNewest to the sever -->
<Target Name="_CopyResolvedFilesToPublishPreserveNewestToServer" BeforeTargets="_CopyResolvedFilesToPublishPreserveNewest">
<ItemGroup>
<_ResolvedFileToPublishPreserveNewestToServer Include="@(_ResolvedFileToPublishPreserveNewest)">
<TargetPath>%(Identity)</TargetPath>
</_ResolvedFileToPublishPreserveNewestToServer>
</ItemGroup>
<CopyFilesToBuildServer
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
Files="@(_ResolvedFileToPublishPreserveNewestToServer)" />
</Target>
<!-- Copies files needed by _CopyResolvedFilesToPublishAlways to the sever -->
<Target Name="_CopyResolvedFilesToPublishAlwaysToServer" BeforeTargets="_CopyResolvedFilesToPublishAlways">
<ItemGroup>
<_ResolvedFileToPublishAlwaysToServer Include="@(_ResolvedFileToPublishAlways)">
<TargetPath>%(Identity)</TargetPath>
</_ResolvedFileToPublishAlwaysToServer>
</ItemGroup>
<CopyFilesToBuildServer
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
Files="@(_ResolvedFileToPublishAlwaysToServer)" />
</Target>
<!-- This overrides the NET SDK target, it does the same thing but we add the SessionId property so the copy is also executed remotely -->
<!-- https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L222-L250 -->
<Target Name="_CopyResolvedFilesToPublishPreserveNewest"
DependsOnTargets="_ComputeResolvedFilesToPublishTypes"
Inputs="@(_ResolvedFileToPublishPreserveNewest)"
Outputs="@(_ResolvedFileToPublishPreserveNewest->'$(PublishDir)%(RelativePath)')">
<!--
PreserveNewest means that we will only copy the source to the destination if the source is newer.
SkipUnchangedFiles is not used for that purpose because it will copy if the source and destination
differ by size too. Instead, this target uses inputs and outputs to only copy when the source is newer.
-->
<Copy Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
SourceFiles="@(_ResolvedFileToPublishPreserveNewest)"
DestinationFiles="@(_ResolvedFileToPublishPreserveNewest->'$(PublishDir)%(RelativePath)')"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<!-- This overrides the NET SDK target, it does the same thing but we add the SessionId property so the copy is also executed remotely -->
<!-- https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L252-L279 -->
<Target Name="_CopyResolvedFilesToPublishAlways" DependsOnTargets="_ComputeResolvedFilesToPublishTypes">
<!--
Use SkipUnchangedFiles to prevent unnecessary file copies. The copy will occur if the
destination doesn't exist, the source is newer than the destination, or if the source and
destination differ by file size.
-->
<Copy Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
SourceFiles = "@(_ResolvedFileToPublishAlways)"
DestinationFiles="@(_ResolvedFileToPublishAlways->'$(PublishDir)%(RelativePath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
</Copy>
</Target>
<Target Name="_UpdateDebugType" BeforeTargets="CoreCompile">
<PropertyGroup>
<DebugType Condition="'$(DebugType)' == 'full'">portable</DebugType>
</PropertyGroup>
</Target>
<!-- Overrides Core SDK target to remote the ILLink execution -->
<!-- https://github.com/dotnet/sdk/blob/cdf57465e1cba9e44b5c9a76a403d41b1b8f178c/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ILLink.targets#L76-L132 -->
<Target Name="_RunILLink"
DependsOnTargets="_ComputeManagedAssemblyToLink;PrepareForILLink"
Inputs="$(MSBuildAllProjects);@(ManagedAssemblyToLink);@(TrimmerRootDescriptor);@(ReferencePath)"
Outputs="$(_LinkSemaphore)">
<PropertyGroup>
<!-- We need to use netX.Y because when building from VS it sets MSBuildRuntimeType to Core and will pick net472 (which doesn't contain the illink assembly) -->
<_RemoteILLinkPath>$(ILLinkTasksAssembly.Replace('$(NetCoreRoot)', '$(_DotNetRootRemoteDirectory)').Replace('net472', 'net$(BundledNETCoreAppTargetFrameworkVersion)').Replace('$([System.IO.Path]::GetFileName('$(ILLinkTasksAssembly)'))', 'illink.dll'))</_RemoteILLinkPath>
</PropertyGroup>
<!-- Include Debug symbols as input so those are copied to the server -->
<ItemGroup>
<!-- @(_PDBToLink) comes from the _ComputeManagedAssemblyToLink target, which is a dependency of this target and is included in Microsoft.NET.ILLink.targets -->
<!-- @(_PDBToLink) should contain the current assembly pdb and the project reference pdbs -->
<_ILLinkDebugSymbols Include="@(_PDBToLink)" />
</ItemGroup>
<Delete SessionId="$(BuildSessionId)" Files="@(_LinkedResolvedFileToPublishCandidate)" />
<Xamarin.iOS.Tasks.ILLink
SessionId="$(BuildSessionId)"
AssemblyPaths="@(ManagedAssemblyToLink)"
ReferenceAssemblyPaths="@(ReferencePath)"
RootAssemblyNames="@(TrimmerRootAssembly)"
TrimMode="$(TrimMode)"
DefaultAction="$(TrimmerDefaultAction)"
RemoveSymbols="$(TrimmerRemoveSymbols)"
FeatureSettings="@(_TrimmerFeatureSettings)"
CustomData="@(_TrimmerCustomData)"
BeforeFieldInit="$(_TrimmerBeforeFieldInit)"
OverrideRemoval="$(_TrimmerOverrideRemoval)"
UnreachableBodies="$(_TrimmerUnreachableBodies)"
UnusedInterfaces="$(_TrimmerUnusedInterfaces)"
IPConstProp="$(_TrimmerIPConstProp)"
Sealer="$(_TrimmerSealer)"
Warn="$(ILLinkWarningLevel)"
NoWarn="$(NoWarn)"
TreatWarningsAsErrors="$(ILLinkTreatWarningsAsErrors)"
WarningsAsErrors="$(WarningsAsErrors)"
WarningsNotAsErrors="$(WarningsNotAsErrors)"
SingleWarn="$(TrimmerSingleWarn)"
CustomSteps="@(_TrimmerCustomSteps)"
RootDescriptorFiles="@(TrimmerRootDescriptor)"
OutputDirectory="$(IntermediateLinkDir)"
DumpDependencies="$(_TrimmerDumpDependencies)"
ExtraArgs="$(_ExtraTrimmerArgs)"
ToolExe="$(_DotNetHostFileName)"
ToolPath="$(_DotNetHostDirectory)"
ILLinkPath="$(_RemoteILLinkPath)"
LinkerItemsDirectory="$(_LinkerItemsDirectory)"
DebugSymbols="@(_ILLinkDebugSymbols)"
ContinueOnError="ErrorAndContinue">
<Output TaskParameter="ExitCode" PropertyName="_ILLinkExitCode" />
<Output TaskParameter="LinkedItems" ItemName="_XamarinLinkedItems" />
<Output TaskParameter="LinkerOutputItems" ItemName="_XamarinLinkerItems" />
</Xamarin.iOS.Tasks.ILLink>
<Touch Files="$(_LinkSemaphore)" AlwaysCreate="true" Condition=" '$(_ILLinkExitCode)' == '0' " />
</Target>
<!-- Override NET.Sdk Run target to run Exec remotely -->
<!-- https://github.com/dotnet/sdk/blob/bc0563507d23a20e71087b03cfa50a5b42b03f06/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L869-L872 -->
<Target Name="Run">
<Exec SessionId="$(BuildSessionId)" Command="$(RunCommand) $(RunArguments)" WorkingDirectory="$(RunWorkingDirectory)"/>
</Target>
<PropertyGroup>
<_PrepareRunDependsOn>
_SetShouldDisconnect;
$(_PrepareRunDependsOn);
</_PrepareRunDependsOn>
</PropertyGroup>
<Target Name="DisconnectAfterRun" AfterTargets="Run" DependsOnTargets="_SayGoodbye" />
<!-- Allows providing SDK-specific target overrides -->
<PropertyGroup>
<XamarinAppleSdkTargets>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Xamarin.Apple.Sdk.targets'))\Xamarin.Apple.Sdk.targets</XamarinAppleSdkTargets>
</PropertyGroup>
<Import Project="$(XamarinAppleSdkTargets)" Condition="'$(XamarinAppleSdkTargetsImported)' != 'true' And Exists('$(XamarinAppleSdkTargets)')" />
</Project>