-
Notifications
You must be signed in to change notification settings - Fork 514
/
Xamarin.Shared.Sdk.targets
1729 lines (1522 loc) · 95.8 KB
/
Xamarin.Shared.Sdk.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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Use single-project MSBuild properties to generate the application manifest by default -->
<GenerateApplicationManifest Condition="'$(GenerateApplicationManifest)' == ''">true</GenerateApplicationManifest>
<Version Condition="'$(GenerateApplicationManifest)' == 'true' and '$(ApplicationDisplayVersion)' != ''">$(ApplicationDisplayVersion)</Version>
</PropertyGroup>
<UsingTask TaskName="Xamarin.MacDev.Tasks.CompileNativeCode" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.FilterStaticFrameworks" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.FindAotCompiler" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.InstallNameTool" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.LinkNativeCode" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.SymbolStrip" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.MergeAppBundles" AssemblyFile="$(_XamarinTaskAssembly)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.ILStrip" AssemblyFile="$(_XamarinTaskAssembly)" />
<!-- Project types and how do we distinguish between them
OutputType Custom variable
==================================================================
iOS Executable Project Exe
iOS App Extension Project Library IsAppExtension
iOS Binding Project Library IsBindingProject
iOS Class Library Project Library
tvOS Executable Project Exe
tvOS App Extension Project Library IsAppExtension
tvOS Binding Project Library IsBindingProject
tvOS Class Library Project Library
watchOS App Project Library IsWatchOSApp
watchOS App Extension Project Library IsAppExtension
watchOS Binding Project Library IsBindingProject
watchOS Class Library Project Library
macOS Executable Project Exe
macOS App Extension Project Library IsAppExtension
macOS Binding Project Library IsBindingProject
macOS Class Library Project Library
-->
<PropertyGroup>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'iOS' And '$(OutputType)' == 'Exe'">iOSExecutableProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'iOS' And '$(OutputType)' == 'Library' And '$(IsAppExtension)' != ''">iOSAppExtensionProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'iOS' And '$(OutputType)' == 'Library' And '$(IsBindingProject)' != ''">iOSBindingProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'iOS' And '$(OutputType)' == 'Library'">iOSClassLibrary</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'tvOS' And '$(OutputType)' == 'Exe'">tvOSExecutableProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'tvOS' And '$(OutputType)' == 'Library' And '$(IsAppExtension)' != ''">tvOSAppExtensionProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'tvOS' And '$(OutputType)' == 'Library' And '$(IsBindingProject)' != ''">tvOSBindingProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'tvOS' And '$(OutputType)' == 'Library'">tvOSClassLibrary</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'watchOS' And '$(IsWatchOSApp)' != ''">watchOSAppProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'watchOS' And '$(IsAppExtension)' != ''">watchOSAppExtensionProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'watchOS' And '$(IsBindingProject)' != ''">watchOSBindingProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'watchOS'">watchOSClassLibrary</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'macOS' And '$(OutputType)' == 'Exe'">macOSExecutableProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'macOS' And '$(OutputType)' == 'Library' And '$(IsAppExtension)' != ''">macOSAppExtensionProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'macOS' And '$(OutputType)' == 'Library' And '$(IsBindingProject)' != ''">macOSBindingProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'macOS' And '$(OutputType)' == 'Library'">macOSClassLibrary</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'MacCatalyst' And '$(OutputType)' == 'Exe'">MacCatalystExecutableProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'MacCatalyst' And '$(OutputType)' == 'Library' And '$(IsAppExtension)' != ''">MacCatalystAppExtensionProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'MacCatalyst' And '$(OutputType)' == 'Library' And '$(IsBindingProject)' != ''">MacCatalystBindingProject</_ProjectType>
<_ProjectType Condition="'$(_ProjectType)' == '' And '$(_PlatformName)' == 'MacCatalyst' And '$(OutputType)' == 'Library'">MacCatalystClassLibrary</_ProjectType>
</PropertyGroup>
<!-- Automatically supply project capabilities for IDE use -->
<ItemGroup>
<ProjectCapability Include="Apple" />
<ProjectCapability Include="Mobile" />
<ProjectCapability Include="IOSApplication" Condition="'$(_ProjectType)' == 'iOSExecutableProject'" />
<ProjectCapability Include="IOSAppExtension" Condition="'$(_ProjectType)' == 'iOSAppExtensionProject'" />
<ProjectCapability Include="IOSBinding" Condition="'$(_ProjectType)' == 'iOSBindingProject'" />
<ProjectCapability Include="IOSClassLibrary" Condition="'$(_ProjectType)' == 'iOSClassLibrary'" />
<ProjectCapability Include="TvOSApplication" Condition="'$(_ProjectType)' == 'tvOSExecutableProject'" />
<ProjectCapability Include="TvOSAppExtension" Condition="'$(_ProjectType)' == 'tvOSAppExtensionProject'" />
<ProjectCapability Include="TvOSBinding" Condition="'$(_ProjectType)' == 'tvOSBindingProject'" />
<ProjectCapability Include="TvOSClassLibrary" Condition="'$(_ProjectType)' == 'tvOSClassLibrary'" />
<ProjectCapability Include="WatchOSApplication" Condition="'$(_ProjectType)' == 'watchOSAppProject'" />
<ProjectCapability Include="WatchOSAppExtension" Condition="'$(_ProjectType)' == 'watchOSAppExtensionProject'" />
<ProjectCapability Include="WatchOSBinding" Condition="'$(_ProjectType)' == 'watchOSBindingProject'" />
<ProjectCapability Include="WatchOSClassLibrary" Condition="'$(_ProjectType)' == 'watchOSClassLibrary'" />
<ProjectCapability Include="MacOSApplication" Condition="'$(_ProjectType)' == 'macOSExecutableProject'" />
<ProjectCapability Include="MacOSAppExtension" Condition="'$(_ProjectType)' == 'macOSAppExtensionProject'" />
<ProjectCapability Include="MacOSBinding" Condition="'$(_ProjectType)' == 'macOSBindingProject'" />
<ProjectCapability Include="MacOSClassLibrary" Condition="'$(_ProjectType)' == 'macOSClassLibrary'" />
<ProjectCapability Include="MacCatalystApplication" Condition="'$(_ProjectType)' == 'MacCatalystExecutableProject'" />
<ProjectCapability Include="MacCatalystAppExtension" Condition="'$(_ProjectType)' == 'MacCatalystAppExtensionProject'" />
<ProjectCapability Include="MacCatalystBinding" Condition="'$(_ProjectType)' == 'MacCatalystBindingProject'" />
<ProjectCapability Include="MacCatalystClassLibrary" Condition="'$(_ProjectType)' == 'MacCatalystClassLibrary'" />
<ProjectCapability Condition="'$(_KeepLaunchProfiles)' != 'true'" Remove="LaunchProfiles" />
</ItemGroup>
<PropertyGroup>
<!-- Add a property that specifies the name of the platform assembly for each platform -->
<_PlatformAssemblyName>Microsoft.$(_PlatformName)</_PlatformAssemblyName>
<!-- We have to set DebuggerSupport before importing Microsoft.NET.Sdk -->
<!-- That means we have to set _BundlerDebug before that, because DebuggerSupport depends on it -->
<!-- Xamarin.Mac: use MmpDebug (this differs from the old-style logic, which checks $(DebugSymbols) as well) -->
<_BundlerDebug Condition="'$(_BundlerDebug)' == '' And '$(_PlatformName)' == 'macOS'">$(MmpDebug)</_BundlerDebug>
<!-- Xamarin.iOS: Use MtouchDebug -->
<_BundlerDebug Condition="'$(_BundlerDebug)' == '' And '$(_PlatformName)' != 'macOS'">$(MtouchDebug)</_BundlerDebug>
<!-- Otherwise the default is true if we're building a Debug configuration -->
<_BundlerDebug Condition="'$(_BundlerDebug)' == '' And '$(Configuration)' == 'Debug'">true</_BundlerDebug>
<!-- As a last resort, the default is false for all platforms -->
<_BundlerDebug Condition="'$(_BundlerDebug)' == ''">false</_BundlerDebug>
<!-- On the other hand, we want the linker to link away debug support in the actual code unless we're building for Debug -->
<DebuggerSupport Condition="'$(DebuggerSupport)' == ''">$(_BundlerDebug)</DebuggerSupport>
<!--
Other runtime libraries feature switches defaults
Available feature switches: https://github.com/dotnet/runtime/blob/master/docs/workflow/trimming/feature-switches.md
-->
<CustomResourceTypesSupport Condition="'$(CustomResourceTypesSupport)' == ''">false</CustomResourceTypesSupport>
<EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization Condition="'$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)' == ''">false</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
<EnableUnsafeBinaryFormatterSerialization Condition="'$(EnableUnsafeBinaryFormatterSerialization)' == ''">false</EnableUnsafeBinaryFormatterSerialization>
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">false</EventSourceSupport>
<HttpActivityPropagationSupport Condition="'$(HttpActivityPropagationSupport)' == ''">false</HttpActivityPropagationSupport>
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == '' And '$(_BundlerDebug)' != 'true'">true</UseSystemResourceKeys>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == '' And '$(_BundlerDebug)' == 'true'">false</UseSystemResourceKeys>
<UseNativeHttpHandler Condition="'$(_PlatformName)' != 'macOS' And '$(UseNativeHttpHandler)' == ''">true</UseNativeHttpHandler>
<AutoreleasePoolSupport Condition="'$(AutoreleasePoolSupport)' == ''">true</AutoreleasePoolSupport>
<_AggressiveAttributeTrimming Condition="'$(_AggressiveAttributeTrimming)' == ''">true</_AggressiveAttributeTrimming>
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">false</NullabilityInfoContextSupport>
<BuiltInComInteropSupport Condition="'$(BuiltInComInteropSupport)' == ''">false</BuiltInComInteropSupport>
<!-- Verify DI trimmability at development-time, but turn the validation off for production/trimmed builds. -->
<VerifyDependencyInjectionOpenGenericServiceTrimmability Condition="'$(VerifyDependencyInjectionOpenGenericServiceTrimmability)' == '' And '$(_BundlerDebug)' != 'true'">false</VerifyDependencyInjectionOpenGenericServiceTrimmability>
<VerifyDependencyInjectionOpenGenericServiceTrimmability Condition="'$(VerifyDependencyInjectionOpenGenericServiceTrimmability)' == ''">true</VerifyDependencyInjectionOpenGenericServiceTrimmability>
<!-- We don't need to generate reference assemblies for apps or app extensions -->
<ProduceReferenceAssembly Condition="'$(ProduceReferenceAssembly)' == '' And ('$(OutputType)' == 'Exe' Or '$(IsAppExtension)' == 'true')">false</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup>
<_GlobalizationDataFile Condition="'$(_PlatformName)' != 'macOS' And '$(InvariantGlobalization)' != 'true' And '$(_GlobalizationDataFile)' == ''">icudt.dat</_GlobalizationDataFile>
</PropertyGroup>
<PropertyGroup>
<TargetPlatformSupported Condition=" '$(TargetPlatformIdentifier)' == '$(_PlatformName)' ">true</TargetPlatformSupported>
</PropertyGroup>
<!-- Default item includes (globs and implicit references) -->
<Import Project="Xamarin.Shared.Sdk.DefaultItems.targets" />
<!-- dotnet publish -->
<Import Project="Xamarin.Shared.Sdk.Publish.targets" />
<!-- This is a hack until we get the TFM values for real from the .NET build logic -->
<PropertyGroup>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'iOS'">ios</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'tvOS'">tvos</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'watchOS'">watchos</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'macOS'">macos</_TargetFrameworkPlatform>
<_TargetFrameworkPlatform Condition="'$(_PlatformName)' == 'MacCatalyst'">maccatalyst</_TargetFrameworkPlatform>
<_ComputedTargetFrameworkMoniker Condition=" '$(_TargetFrameworkPlatform)' != '' ">$(TargetFrameworkMoniker),Profile=$(_TargetFrameworkPlatform)</_ComputedTargetFrameworkMoniker>
</PropertyGroup>
<!-- Inject our custom logic into *DependsOn variables -->
<PropertyGroup>
<!-- single-rid build -->
<BuildDependsOn Condition="'$(RuntimeIdentifiers)' == '' And '$(_IsMultiRidBuild)' != 'true'">
_ComputePublishTrimmed;
BuildOnlySettings;
_CollectBundleResources;
_PackLibraryResources;
_UnpackLibraryResources;
$(BuildDependsOn);
_CreateAppBundle;
Codesign;
CreateIpa;
_CreateInstaller;
Archive;
</BuildDependsOn>
<!-- inner build for multi-rid build -->
<BuildDependsOn Condition="'$(_IsMultiRidBuild)' == 'true'">
_ComputePublishTrimmed;
BuildOnlySettings;
_CollectBundleResources;
_PackLibraryResources;
_UnpackLibraryResources;
$(BuildDependsOn);
_CreateAppBundle;
</BuildDependsOn>
<!-- outer build for multi-rid build -->
<BuildDependsOn Condition="'$(RuntimeIdentifiers)' != ''">
_CollectBundleResources;
_RunRidSpecificBuild;
_CompileEntitlements;
_DetectAppManifest;
_ReadAppManifest;
_WriteAppManifest;
_CopyResourcesToBundle;
_CreateMergedAppBundle;
Codesign;
CreateIpa;
_CreateInstaller;
Archive;
</BuildDependsOn>
<!-- We re-use ComputeFilesToPublish & CopyFilesToPublishDirectory to copy files to the .app -->
<!-- ComputeFilesToPublish will run ILLink -->
<!-- single-rid build (either plain single, or inner build for multi-rid build) -->
<!-- Note - _ComputeStripAssemblyIL must be before _StripAssemblyIL as msbuild DependsOn do not execute before Conditions are evaluated -->
<CreateAppBundleDependsOn Condition="'$(RuntimeIdentifiers)' == ''">
$(CreateAppBundleDependsOn);
_CopyResourcesToBundle;
_CompileCoreMLModels;
_CreatePkgInfo;
_SmeltMetal;
_TemperMetal;
_CompileEntitlements;
_DetectAppManifest;
_ReadAppManifest;
_WriteAppManifest;
_ResolveAppExtensionReferences;
_ExtendAppExtensionReferences;
_ComputeLinkerArguments;
_ComputeFrameworkFilesToPublish;
_ComputeDynamicLibrariesToPublish;
ComputeFilesToPublish;
_ComputeStripAssemblyIL;
_StripAssemblyIL;
_LoadLinkerOutput;
_CompileNativeExecutable;
_LinkNativeExecutable;
_ComputePublishLocation;
CopyFilesToPublishDirectory;
_CopyDirectoriesToBundle;
_CopyAppExtensionsToBundle;
</CreateAppBundleDependsOn>
<!-- not inner build for multi-rid build (single-rid build or outer build for multi-rid build) -->
<CreateAppBundleDependsOn Condition="'$(_PlatformName)' != 'macOS' And '$(_IsMultiRidBuild)' != 'true'">
_CreateDebugSettings;
_CreateDebugConfiguration;
$(CreateAppBundleDependsOn);
</CreateAppBundleDependsOn>
<!-- outer build for multi-rid build -->
<CreateAppBundleDependsOn Condition="'$(RuntimeIdentifiers)' != ''">
$(CreateAppBundleDependsOn);
_CompileEntitlements;
_CreateMergedAppBundle;
</CreateAppBundleDependsOn>
</PropertyGroup>
<!-- PublishTrimmed must be calculated as part of a target because IsMacEnabled on Windows will be set after connecting to the Mac -->
<Target Name="_ComputePublishTrimmed">
<PropertyGroup>
<_MustTrim Condition="'$(_MustTrim)' == '' And '$(RuntimeIdentifier)' != '' And ($(_ProjectType.EndsWith('ExecutableProject')) Or $(_ProjectType.EndsWith('AppExtensionProject'))) And '$(IsMacEnabled)' == 'true'">true</_MustTrim>
<PublishTrimmed Condition="'$(PublishTrimmed)' == '' And '$(_MustTrim)' == 'true'">true</PublishTrimmed>
</PropertyGroup>
<Error Condition="'$(_MustTrim)' == 'true' And '$(PublishTrimmed)' != 'true'" Text="$(_PlatformName) projects must build with PublishTrimmed=true. Current value: $(PublishTrimmed)." />
</Target>
<Target Name="_WarnRuntimeIdentifiersClash" Condition="'$(_RuntimeIdentifiersClashMessage)' != ''">
<Warning Text="$(_RuntimeIdentifiersClashMessage)" />
</Target>
<!-- If we have multiple runtime identifiers, then we need to run an inner build for each of them -->
<Target Name="_BuildRidSpecificAppBundle"
DependsOnTargets="Build"
Returns="@(_AssemblyPublishDirectory)"
>
<ItemGroup>
<_AssemblyPublishDirectory Include="$(_AppBundlePath)">
<RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier>
<TargetArchitectures>$(TargetArchitectures)</TargetArchitectures>
</_AssemblyPublishDirectory>
</ItemGroup>
</Target>
<Target Name="_RunRidSpecificBuild" Condition="'$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == ''" DependsOnTargets="_DetectSdkLocations;_GenerateBundleName">
<ItemGroup>
<!-- Convert RuntimeIdentifiers (a property) to an item group -->
<_RuntimeIdentifiersAsItems Include="$(RuntimeIdentifiers)" Condition=" '$(RuntimeIdentifiers)' != '' " />
<_RuntimeIdentifiersAsItems Update="@(_RuntimeIdentifiersAsItems)">
<!-- Platform = "rid-arch".Substring (0, "rid-arch".IndexOf ('-')) -->
<Platform>$([System.String]::new('%(Identity)').Substring(0, $([System.String]::new('%(Identity)').IndexOf ('-'))))</Platform>
</_RuntimeIdentifiersAsItems>
<!-- Verify that we're not mixing simulator + device RIDs in a single build -->
<_RuntimeIdentifierPlatforms Include="@(_RuntimeIdentifiersAsItems -> '%(Platform)')" />
<_RuntimeIdentifierDistinctPlatforms Include="@(_RuntimeIdentifierPlatforms->Distinct())" />
</ItemGroup>
<!-- Show an error if we're mixing simulator + device RIDs in a single build -->
<Error Condition="@(_RuntimeIdentifierDistinctPlatforms->Count()) > 1" Text="Building for all the runtime identifiers '$(RuntimeIdentifiers)' at the same time isn't possible, because they represent different platform variations." />
<PropertyGroup>
<_RidSpecificProperties>
_IsMultiRidBuild=true;
RuntimeIdentifiers=;
_ProcessedBundleResourcesPath=$(_ProcessedBundleResourcesPath);
_ProcessedContentPath=$(_ProcessedContentPath);
_ProcessedImageAssetsPath=$(_ProcessedImageAssetsPath);
_ProcessedInterfaceDefinitionsPath=$(_ProcessedInterfaceDefinitionsPath);
_ProcessedSceneKitAssetsPath=$(_ProcessedSceneKitAssetsPath);
_ProcessedColladaAssetsPath=$(_ProcessedColladaAssetsPath);
_ProcessedTextureAtlasesPath=$(_ProcessedTextureAtlasesPath);
_ProcessedCoreMLModelsPath=$(_ProcessedCoreMLModelsPath);
</_RidSpecificProperties>
</PropertyGroup>
<!-- Execute the inner builds -->
<MSBuild
Projects="$(MSBuildProjectFile)"
Targets="_BuildRidSpecificAppBundle"
Properties="RuntimeIdentifier=%(_RuntimeIdentifiersAsItems.Identity);$(_RidSpecificProperties)">
<Output TaskParameter="TargetOutputs" ItemName="_AssemblyPublishDirectories" />
</MSBuild>
<!-- Set the RID-specific subdirectory as metadata -->
<ItemGroup>
<_AssemblyPublishDirectories>
<SpecificSubDirectory>.xamarin/%(RuntimeIdentifier)</SpecificSubDirectory>
</_AssemblyPublishDirectories>
<_AssemblyPublishInputs Include="@(_AssemblyPublishDirectories -> '%(Identity)/**')" />
</ItemGroup>
</Target>
<Target Name="_CreateMergedAppBundle"
Inputs="@(_AssemblyPublishInputs)"
Outputs="$(DeviceSpecificIntermediateOutputPath)$(_AppBundleName).mergestamp"
DependsOnTargets="_RunRidSpecificBuild"
>
<ItemGroup>
<!-- If we're creating a runtimeconfig.json file, then the resulting binary runtimeconfig.bin file can be put in the architecture-specific subdirectory -->
<_ArchitectureSpecificFiles Include="$(_RuntimeConfigurationFile)" Condition="'$(GenerateRuntimeConfigurationFiles)' != ''" />
<!-- The globalization data file can be put in the architecture-specific subdirectory -->
<_ArchitectureSpecificFiles Include="$(_GlobalizationDataFile)" Condition="'$(_GlobalizationDataFile)' != ''" />
</ItemGroup>
<MergeAppBundles
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
ArchitectureSpecificFiles="@(_ArchitectureSpecificFiles)"
IgnoreFiles="$(_AppBundleManifestRelativePath)Info.plist"
InputAppBundles="@(_AssemblyPublishDirectories)"
OutputAppBundle="$(_AppBundlePath)"
SdkDevPath="$(_SdkDevPath)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
/>
<Touch
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
AlwaysCreate="true"
Files="$(DeviceSpecificIntermediateOutputPath)$(_AppBundleName).mergestamp"
>
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>
</Target>
<Target Name="_ComputeMonoComponents" Condition="'$(UseMonoRuntime)' == 'true' And '$(_LibMonoLinkMode)' == 'static'" BeforeTargets="_MonoSelectRuntimeComponents" DependsOnTargets="_ComputeVariables">
<!-- https://github.com/dotnet/runtime/blob/main/docs/design/mono/components.md -->
<ItemGroup>
<_MonoComponent Include="hot_reload" Condition="'$(MtouchInterpreter)' == 'true'" />
<_MonoComponent Include="debugger" Condition="'$(_BundlerDebug)' == 'true'" />
<_MonoComponent Include="diagnostics_tracing" Condition="'$(_BundlerDebug)' == 'true'" />
</ItemGroup>
</Target>
<Target Name="_ComputeMonoLibraries" Condition="'$(UseMonoRuntime)' == 'true'" DependsOnTargets="_ComputeMonoComponents;_MonoSelectRuntimeComponents">
<!-- We only include any mono components when linking with mono statically. The components are already included in the dynamic versions of Mono (both the dylib and the framework) -->
<ItemGroup Condition="'$(_LibMonoLinkMode)' == 'static'">
<!-- Remove files mono told us not to link with -->
<_MonoLibrary Remove="@(_MonoRuntimeComponentDontLink -> '$(_MonoRuntimePackPath)native/%(Identity)')" />
<!-- Add files mono told us to link with -->
<_MonoLibrary Include="@(_MonoRuntimeComponentLink -> '$(_MonoRuntimePackPath)native/%(Identity)')" />
</ItemGroup>
</Target>
<PropertyGroup>
<_ComputeLinkerArgumentsDependsOn>
_ComputeLinkMode;
_ComputeFrameworkVariables;
_ComputeFrameworkAssemblies;
ComputeResolvedFilesToPublishList;
_ParseBundlerArguments;
_ComputeVariables;
_CreateRuntimeConfiguration;
_ComputeMonoLibraries;
_FindAotCompiler;
_DetectAppManifest;
_ReadAppManifest;
_WriteAppManifest;
</_ComputeLinkerArgumentsDependsOn>
</PropertyGroup>
<Target Name="_ComputeLinkerArguments" DependsOnTargets="$(_ComputeLinkerArgumentsDependsOn)">
<!-- Validate the linker mode -->
<Error Text="Invalid link mode: '$(_LinkMode)'. Valid link modes are: 'None', 'SdkOnly' and 'Full'" Condition="'$(_LinkMode)' != 'None' And '$(_LinkMode)' != 'SdkOnly' And '$(_LinkMode)' != 'Full' And '$(_LinkMode)' != 'TrimMode'" />
<!-- it's invariant or it's one of the ICU data files, not both -->
<Error Text="Can not set values for both InvariantGlobalization '$(InvariantGlobalization)' and _GlobalizationDataFile '$(_GlobalizationDataFile)'" Condition="'$(_GlobalizationDataFile)' != '' And '$(InvariantGlobalization)' == 'true'" />
<PropertyGroup>
<!-- Pass the custom options to our custom steps -->
<_CustomLinkerOptionsFile>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)custom-linker-options.txt'))</_CustomLinkerOptionsFile>
<_CustomLinkerOptionsFile Condition="'$(BuildSessionId)' != ''">$(IntermediateOutputPath)custom-linker-options.txt</_CustomLinkerOptionsFile>
<!-- The directory where the linker puts *.items files that will be loaded in the _LoadLinkerOutput target -->
<_LinkerItemsDirectory>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)linker-items'))</_LinkerItemsDirectory>
<_LinkerItemsDirectory Condition="'$(BuildSessionId)' != ''">$(IntermediateOutputPath)linker-items</_LinkerItemsDirectory>
<!-- A temporary output directory for our linker steps -->
<_LinkerCacheDirectory>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)linker-cache'))</_LinkerCacheDirectory>
<_LinkerCacheDirectory Condition="'$(BuildSessionId)' != ''">$(IntermediateOutputPath)linker-cache</_LinkerCacheDirectory>
<_XamarinRuntime Condition="'$(UseMonoRuntime)' == 'true'">MonoVM</_XamarinRuntime>
<_XamarinRuntime Condition="'$(UseMonoRuntime)' != 'true'">CoreCLR</_XamarinRuntime>
<!-- TrimMode specifies what the linker will do with framework assemblies -->
<TrimMode Condition="'$(_LinkMode)' == 'TrimMode'">$(TrimMode)</TrimMode>
<TrimMode Condition="'$(_LinkMode)' == 'None'">copy</TrimMode> <!-- Don't use 'copyused', because that might still end up saving some assemblies, and if that's the platform assembly, it may break the partial static registrar -->
<TrimMode Condition="'$(_LinkMode)' == 'SdkOnly' Or '$(_LinkMode)' == 'Full'">link</TrimMode>
<!-- For Full link mode we also need to set TrimMode for all non-framework assemblies. This is done further below -->
<!-- Determine if any assemblies are actually trimmed, or if we're in a "Don't link" scenario -->
<!-- We're in a "Don't link" scenario if both of the following are true:
1. The global TrimMode property is set to 'copy'
2. No assembly has the TrimMode metadata (unless it's set to 'copy')
-->
<_AssembliesWithCustomTrimMode>@(ManagedAssemblyToLink->HasMetadataValue('TrimMode')->Count())</_AssembliesWithCustomTrimMode>
<_AssembliesWithCopyTrimMode>@(ManagedAssemblyToLink->WithMetadataValue('TrimMode', 'copy')->Count())</_AssembliesWithCopyTrimMode>
<_AreAnyAssembliesTrimmed Condition="'$(_AreAnyAssembliesTrimmed)' == '' And '$(TrimMode)' == 'copy' And '$(_AssembliesWithCustomTrimMode)' == '$(_AssembliesWithCopyTrimMode)'">false</_AreAnyAssembliesTrimmed>
<_AreAnyAssembliesTrimmed Condition="'$(_AreAnyAssembliesTrimmed)' == ''">true</_AreAnyAssembliesTrimmed>
<_CustomLinkerOptions>
AreAnyAssembliesTrimmed=$(_AreAnyAssembliesTrimmed)
AssemblyName=$(AssemblyName).dll
AOTCompiler=$(_AOTCompiler)
AOTOutputDirectory=$(_AOTOutputDirectory)
AppBundleManifestPath=$(_AppBundleManifestPath)
CacheDirectory=$(_LinkerCacheDirectory)
@(_BundlerDlsym -> 'Dlsym=%(Identity)')
Debug=$(_BundlerDebug)
DeploymentTarget=$(_MinimumOSVersion)
@(_CustomLinkFlags -> 'CustomLinkFlags=%(Identity)')
EnableSGenConc=$(EnableSGenConc)
@(_BundlerEnvironmentVariables -> 'EnvironmentVariable=%(Identity)=%(Value)')
@(_XamarinFrameworkAssemblies -> 'FrameworkAssembly=%(Filename)')
GlobalizationDataFile=$(_GlobalizationDataFile)
Interpreter=$(MtouchInterpreter)
IntermediateLinkDir=$(IntermediateLinkDir)
InvariantGlobalization=$(InvariantGlobalization)
ItemsDirectory=$(_LinkerItemsDirectory)
IsAppExtension=$(IsAppExtension)
IsSimulatorBuild=$(_SdkIsSimulator)
LibMonoLinkMode=$(_LibMonoLinkMode)
LibXamarinLinkMode=$(_LibXamarinLinkMode)
MarshalManagedExceptionMode=$(_MarshalManagedExceptionMode)
MarshalObjectiveCExceptionMode=$(_MarshalObjectiveCExceptionMode)
@(_MonoLibrary -> 'MonoLibrary=%(Identity)')
MtouchFloat32=$(MtouchFloat32)
Optimize=$(_BundlerOptimize)
PartialStaticRegistrarLibrary=$(_LibPartialStaticRegistrar)
Platform=$(_PlatformName)
PlatformAssembly=$(_PlatformAssemblyName).dll
RelativeAppBundlePath=$(_RelativeAppBundlePath)
Registrar=$(_BundlerRegistrar)
RuntimeConfigurationFile=$(_RuntimeConfigurationFile)
SdkDevPath=$(_SdkDevPath)
SdkRootDirectory=$(_XamarinSdkRootDirectory)
SdkVersion=$(_SdkVersion)
TargetArchitectures=$(TargetArchitectures)
TargetFramework=$(_ComputedTargetFrameworkMoniker)
UseLlvm=$(MtouchUseLlvm)
Verbosity=$(_BundlerVerbosity)
XamarinRuntime=$(_XamarinRuntime)
</_CustomLinkerOptions>
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --custom-data "LinkerOptionsFile=$(_CustomLinkerOptionsFile)"</_ExtraTrimmerArgs>
<_ExtraTrimmerArgs Condition="'$(TrimMode)' == 'copy' And '$(MarkCopiedAssemblies)' != 'true'">$(_ExtraTrimmerArgs) --custom-data DisableMarkingOfCopyAssemblies=true</_ExtraTrimmerArgs>
<!-- Verbose output, so that we get something to stdout when something goes wrong -->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --verbose</_ExtraTrimmerArgs>
<!--
Always process symbols files, even in release mode, because
the AOT compiler uses the symbol files to create DWARF debug
information.
FIXME: At some point we should set the DebuggerSupport
property so that the linker can remove debugging support when
in release mode, but the linker doesn't seem quite ready for
this yet (ref: https://github.com/dotnet/sdk/pull/12144).
-->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) -b</_ExtraTrimmerArgs>
<!--
The linker will treat type checks as a constant value (false),
if the type in question is not instantiated, but we're
instantiating types using reflection, which the linker can't
see. The result is that the
CIKernel_BasicTest/CIKernel_TestFromPrograms tests in
monotouch-test fail.
So here we disable this particular linker optimization.
Ref: https://github.com/mono/linker/pull/1595
Ref: https://discord.com/channels/732297728826277939/751137004007456849/776033084431925268
-->
<_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --disable-opt unusedtypechecks</_ExtraTrimmerArgs>
<!-- If a release build and the app is not extensible (no interpreter or JIT/code-loading for macOS) then the sealer optimization can be used -->
<_ExtraTrimmerArgs Condition="'$(_BundlerDebug)' != 'true' And '$(MtouchInterpreter)' == '' And '$(_RunAotCompiler)' == 'true' And '$(_PlatformName)' != 'macOS'">$(_ExtraTrimmerArgs) --enable-opt sealer</_ExtraTrimmerArgs>
<!-- Set linker feature flags for device/simulator builds -->
<_ExtraTrimmerArgs Condition="('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS') And '$(_SdkIsSimulator)' == 'true'">$(_ExtraTrimmerArgs) --feature ObjCRuntime.Runtime.Arch.IsSimulator true</_ExtraTrimmerArgs>
<_ExtraTrimmerArgs Condition="('$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS') And '$(_SdkIsSimulator)' != 'true'">$(_ExtraTrimmerArgs) --feature ObjCRuntime.Runtime.Arch.IsSimulator false</_ExtraTrimmerArgs>
<!-- We always want the linker to process debug symbols, even when building in Release mode, because the AOT compiler uses the managed debug symbols to output DWARF debugging symbols -->
<TrimmerRemoveSymbols Condition="'$(TrimmerRemoveSymbols)' == ''">false</TrimmerRemoveSymbols>
<!-- Linker -->
<_AdditionalTaskAssemblyDirectory>$(_XamarinSdkRootDirectoryOnMac)tools/dotnet-linker/</_AdditionalTaskAssemblyDirectory>
<_AdditionalTaskAssembly>$(_AdditionalTaskAssemblyDirectory)dotnet-linker.dll</_AdditionalTaskAssembly>
</PropertyGroup>
<ItemGroup>
<!-- Mark all assemblies to be linked if we're linking all assemblies -->
<ResolvedFileToPublish
Update="@(ResolvedFileToPublish)"
Condition="'$(_LinkMode)' == 'Full' And '%(ResolvedFileToPublish.Extension)' == '.dll' And '%(ResolvedFileToPublish.AssetType)' != 'native'"
>
<TrimMode>link</TrimMode>
</ResolvedFileToPublish>
<!-- Mark our entry assembly as a root assembly. -->
<TrimmerRootAssembly Include="@(ResolvedFileToPublish)" Condition="'%(ResolvedFileToPublish.Filename)' == '$(AssemblyName)' And '%(ResolvedFileToPublish.Extension)' == '.dll'" />
<!--
pre-mark custom steps
-->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.SetupStep" />
<!-- Load the list of assemblies loaded by the linker. -->
<!-- This would not be needed if LinkContext.GetAssemblies () was exposed to us. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.Linker.CollectAssembliesStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.CoreTypeMapStep" />
<!-- The final decision to remove/keep the dynamic registrar must be done before the linking step -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.RegistrarRemovalTrackingStep" />
<!-- TODO: these steps should probably run after mark. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.PreMarkDispatcher" />
<!--
IMarkHandlers which run during Mark
-->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.PreserveBlockCodeHandler" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.OptimizeGeneratedCodeHandler" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.BackingFieldDelayHandler" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.MarkIProtocolHandler" />
<!-- MarkDispatcher substeps will run for all marked assemblies. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.MarkDispatcher" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.PreserveSmartEnumConversionsHandler" />
<!--
post-sweep custom steps
-->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" AfterStep="SweepStep" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.PostSweepDispatcher" />
<!--
pre-output custom steps
-->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="OutputStep" Type="Xamarin.Linker.Steps.ListExportedSymbols" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="OutputStep" Type="Xamarin.Linker.LoadNonSkippedAssembliesStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="OutputStep" Type="Xamarin.Linker.ExtractBindingLibrariesStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="OutputStep" Type="Xamarin.Linker.Steps.PreOutputDispatcher" />
<!--
post-output steps
-->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.Linker.RegistrarStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.GenerateMainStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.GenerateReferencesStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.GatherFrameworksStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.Linker.ComputeNativeBuildFlagsStep" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.Linker.ComputeAOTArguments" />
<!-- Must be the last step. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" Type="Xamarin.Linker.DoneStep" />
<!-- _BundlerXmlDefinitions comes from any -xml arguments to mtouch/mmp -->
<TrimmerRootDescriptor Include="@(_BundlerXmlDefinitions)" />
<!-- LinkDescription can be defined in the user's csproj -->
<TrimmerRootDescriptor Include="@(LinkDescription)" />
</ItemGroup>
<!-- Create the file with our custom linker options -->
<WriteLinesToFile SessionId="$(BuildSessionId)" File="$(_CustomLinkerOptionsFile)" Lines="$(_CustomLinkerOptions)" Overwrite="true" />
</Target>
<PropertyGroup>
<_ComputeFrameworkFilesToPublishDependsOn>
$(_ComputeFrameworkFilesToPublishDependsOn);
_DecompressAppleFrameworks;
_CollectDecompressedAppleFrameworks;
_DecompressAppleBindingResourcePackages;
_CollectDecompressedAppleBindingResourcePackages;
_ExpandNativeReferences;
_ComputeVariables;
_LoadLinkerOutput;
</_ComputeFrameworkFilesToPublishDependsOn>
</PropertyGroup>
<!-- Look in the _FrameworkNativeReference items for frameworks that need to be added to the app bundle, and add all those frameworks to _FrameworkToPublish -->
<Target Name="_ComputeFrameworkFilesToPublish" DependsOnTargets="$(_ComputeFrameworkFilesToPublishDependsOn)">
<ItemGroup>
<!-- Collect the list of frameworks to publish from _FrameworkNativeReference. The ExtractBindingLibrariesStep in the linker and
the _DecompressAppleFrameworks and _DecompressAppleBindingResourcePackages targets might also add frameworks to _FrameworkToPublish -->
<_FrameworkToPublish Include="@(_FrameworkNativeReference)" Condition="'%(_FrameworkNativeReference.Kind)' == 'Framework' And '%(_FrameworkNativeReference.CopyToAppBundle)' != 'false'" />
<!-- Set TargetDirectory and SourceDirectory for all frameworks we have to publish -->
<_FrameworkToPublish Update="@(_FrameworkToPublish)">
<TargetDirectory>$(_RelativePublishDir)$(_AppBundleFrameworksDir)\%(Filename).framework</TargetDirectory>
<SourceDirectory>%(RootDir)%(Directory)</SourceDirectory>
</_FrameworkToPublish>
</ItemGroup>
<!-- Figure out which frameworks are really dynamic libraries, and only publish those -->
<FilterStaticFrameworks
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
FrameworkToPublish="@(_FrameworkToPublish)"
>
<Output TaskParameter="FrameworkToPublish" ItemName="_FilteredFrameworkToPublish" />
</FilterStaticFrameworks>
<ItemGroup>
<_DirectoriesToPublish Include="@(_FilteredFrameworkToPublish)" />
</ItemGroup>
</Target>
<Target Name="_CopyDirectoriesToBundle"
DependsOnTargets="_CollectDecompressedPlugins;_ComputeFrameworkFilesToPublish"
Inputs="@(_DirectoriesToPublish)"
Outputs="@(_DirectoriesToPublish -> '%(TargetDirectory)/%(Filename)')"
>
<!-- We specifically do *not* use the publishing logic in .NET to (ResolvedFileToPublish) copy whole directories to the app bundle, because symlinks aren't handled correctly.
In particular, MSBuild can't handle symlinks to directories: https://github.com/dotnet/msbuild/issues/6821.
So we have a custom item group (_DirectoriesToPublish), which we copy ourselves.
-->
<Ditto
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
ToolExe="$(DittoExe)"
ToolPath="$(DittoPath)"
Source="%(_DirectoriesToPublish.SourceDirectory)"
Destination="%(_DirectoriesToPublish.TargetDirectory)"
TouchDestinationFiles="true"
/>
</Target>
<!-- Look in the NativeReference items for dylibs that need to be added to the app bundle, and add all those frameworks to ResolvedFileToPublish (as separate files) -->
<Target Name="_ComputeDynamicLibrariesToPublish" DependsOnTargets="_ExpandNativeReferences;_ComputeVariables;_LoadLinkerOutput;_ReidentifyDynamicLibraries">
<ItemGroup>
<!-- Support a 'CopyToAppBundle' metadata that can be set to 'false' to avoid copying a framework to the app bundle -->
<_DynamicLibraryToPublish Include="@(_FileNativeReference)" Condition="'%(_FileNativeReference.Kind)' == 'Dynamic' And '%(_FileNativeReference.CopyToAppBundle)' != 'false'">
<RelativePath>$(_DylibPublishDir)\%(Filename)%(Extension)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</_DynamicLibraryToPublish>
<!-- Add all the dynamic libraries to ResolvedFileToPublish -->
<ResolvedFileToPublish Include="@(_DynamicLibraryToPublish)">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
<Target Name="_ComputeStripAssemblyIL" Condition=" '$(EnableAssemblyILStripping)' == '' " DependsOnTargets="_ComputeVariables;ComputeFilesToPublish">
<PropertyGroup>
<!-- Don't strip IL by default -->
<EnableAssemblyILStripping>false</EnableAssemblyILStripping>
<!-- Strip if we are AOT and Release -->
<EnableAssemblyILStripping Condition="'$(_RunAotCompiler)' == 'true' And '$(Configuration)' == 'Release'">true</EnableAssemblyILStripping>
<!-- Don't strip if we are running the interpreter -->
<EnableAssemblyILStripping Condition="'$(MtouchInterpreter)' != ''">false</EnableAssemblyILStripping>
</PropertyGroup>
</Target>
<!-- The DependsOnTargets here will not force EnableAssemblyILStripping to be calculated before the condition is evaulated. The order in CreateAppBundleDependsOn matters. -->
<Target Name="_StripAssemblyIL" Condition="'$(EnableAssemblyILStripping)' == 'true'" DependsOnTargets="_ComputeStripAssemblyIL">
<PropertyGroup>
<_StrippedAssemblyDirectory>$(DeviceSpecificIntermediateOutputPath)\stripped</_StrippedAssemblyDirectory>
</PropertyGroup>
<ItemGroup>
<_AssembliesToBeStripped Include="@(ResolvedFileToPublish)" Condition="'%(Extension)' == '.dll'">
<OutputPath Condition="'%(ResolvedFileToPublish.DestinationSubPath)' != ''">$(_StrippedAssemblyDirectory)\%(ResolvedFileToPublish.DestinationSubPath)</OutputPath>
<OutputPath Condition="'%(ResolvedFileToPublish.DestinationSubPath)' == ''">$(_StrippedAssemblyDirectory)\%(Filename)%(Extension)</OutputPath>
</_AssembliesToBeStripped>
<!-- Use forward slashes in OutputPath, otherwise ILStrip will create filenames that resemble the part of
the relative path of the item that uses backslashes, instead of writing the file to the location of the
relative path. -->
<_AssembliesToBeStripped>
<OutputPath>$([System.String]::Copy('%(OutputPath)').Replace('\', '/'))</OutputPath>
</_AssembliesToBeStripped>
<_AssemblyDirsToCreate Include="@(_AssembliesToBeStripped->'%(OutputPath)%(Directory)'->Distinct())"/>
</ItemGroup>
<MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="@(_AssemblyDirsToCreate)" />
<Xamarin.MacDev.Tasks.ILStrip Assemblies="@(_AssembliesToBeStripped)" SessionId="$(BuildSessionId)">
<Output TaskParameter="StrippedAssemblies" ItemName="_StrippedAssemblies" />
</Xamarin.MacDev.Tasks.ILStrip>
<ItemGroup>
<ResolvedFileToPublish Remove="@(_AssembliesToBeStripped)" />
<ResolvedFileToPublish Include="@(_StrippedAssemblies)" />
</ItemGroup>
</Target>
<Target Name="_LoadLinkerOutput" DependsOnTargets="ComputeFilesToPublish">
<!-- Load _MainFile -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_MainFile.items" Condition="Exists('$(_LinkerItemsDirectory)/_MainFile.items')">
<Output TaskParameter="Items" ItemName="_MainFile" />
</ReadItemsFromFile>
<!-- Load _MainLinkWith -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_MainLinkWith.items" Condition="Exists('$(_LinkerItemsDirectory)/_MainLinkWith.items')">
<Output TaskParameter="Items" ItemName="_MainLinkWith" />
</ReadItemsFromFile>
<!-- Load _LinkerFrameworks -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_LinkerFrameworks.items" Condition="Exists('$(_LinkerItemsDirectory)/_LinkerFrameworks.items')">
<Output TaskParameter="Items" ItemName="_LinkerFrameworks" />
</ReadItemsFromFile>
<!-- Load _BindingLibraryLinkWith -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_BindingLibraryLinkWith.items" Condition="Exists('$(_LinkerItemsDirectory)/_BindingLibraryLinkWith.items')">
<Output TaskParameter="Items" ItemName="_BindingLibraryLinkWith" />
</ReadItemsFromFile>
<!-- Load _AssemblyLinkerFlags -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_AssemblyLinkerFlags.items" Condition="Exists('$(_LinkerItemsDirectory)/_AssemblyLinkerFlags.items')">
<Output TaskParameter="Items" ItemName="_AssemblyLinkerFlags" />
</ReadItemsFromFile>
<!-- Load _MainLinkerFlags -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_MainLinkerFlags.items" Condition="Exists('$(_LinkerItemsDirectory)/_MainLinkerFlags.items')">
<Output TaskParameter="Items" ItemName="_MainLinkerFlags" />
</ReadItemsFromFile>
<!-- Load _BindingLibraryFrameworks -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_BindingLibraryFrameworks.items" Condition="Exists('$(_LinkerItemsDirectory)/_BindingLibraryFrameworks.items')">
<Output TaskParameter="Items" ItemName="_BindingLibraryFrameworks" />
</ReadItemsFromFile>
<!-- Load _RegistrarFile -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_RegistrarFile.items" Condition="Exists('$(_LinkerItemsDirectory)/_RegistrarFile.items')">
<Output TaskParameter="Items" ItemName="_RegistrarFile" />
</ReadItemsFromFile>
<!-- Load _ReferencesFile -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_ReferencesFile.items" Condition="Exists('$(_LinkerItemsDirectory)/_ReferencesFile.items')">
<Output TaskParameter="Items" ItemName="_ReferencesFile" />
</ReadItemsFromFile>
<!-- Load _ReferencesLinkerFlags -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_ReferencesLinkerFlags.items" Condition="Exists('$(_LinkerItemsDirectory)/_ReferencesLinkerFlags.items')">
<Output TaskParameter="Items" ItemName="_ReferencesLinkerFlags" />
</ReadItemsFromFile>
<!-- Load _AssembliesToAOT -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_AssembliesToAOT.items" Condition="Exists('$(_LinkerItemsDirectory)/_AssembliesToAOT.items')">
<Output TaskParameter="Items" ItemName="_AssembliesToAOT" />
</ReadItemsFromFile>
<!-- Load _FrameworkToPublish -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_FrameworkToPublish.items" Condition="Exists('$(_LinkerItemsDirectory)/_FrameworkToPublish.items')">
<Output TaskParameter="Items" ItemName="_FrameworkToPublish" />
</ReadItemsFromFile>
<!-- Load _DynamicLibraryToPublish -->
<ReadItemsFromFile SessionId="$(BuildSessionId)" File="$(_LinkerItemsDirectory)/_DynamicLibraryToPublish.items" Condition="Exists('$(_LinkerItemsDirectory)/_DynamicLibraryToPublish.items')">
<Output TaskParameter="Items" ItemName="_DynamicLibraryToPublish" />
</ReadItemsFromFile>
</Target>
<!-- Native code -->
<Target Name="_ComputeFrameworkVariables" DependsOnTargets="ResolveRuntimePackAssets">
<PropertyGroup>
<_PackageIdInfix Condition="'$(UseMonoRuntime)' == 'true'">Mono.</_PackageIdInfix>
<_MonoNugetPackageId>Microsoft.NETCore.App.Runtime.$(_PackageIdInfix)$(RuntimeIdentifier)</_MonoNugetPackageId>
<_XamarinNugetPackageId>Microsoft.$(_PlatformName).Runtime.$(RuntimeIdentifier)</_XamarinNugetPackageId>
</PropertyGroup>
<ItemGroup>
<!-- Look in the ResolvedFrameworkReference for our Microsoft.* package. This should only find a single package. -->
<_XamarinFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.Identity)' == 'Microsoft.$(_PlatformName)'" />
<_MonoFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.RuntimePackName)' == '$(_MonoNugetPackageId)'" />
</ItemGroup>
<PropertyGroup>
<_XamarinSdkRuntimePackDirectory>%(_XamarinFrameworkReference.RuntimePackPath)</_XamarinSdkRuntimePackDirectory>
<_XamarinRefPackageDirectory>%(_XamarinFrameworkReference.TargetingPackPath)</_XamarinRefPackageDirectory>
<_XamarinNativeLibraryDirectory>$(_XamarinSdkRuntimePackDirectory)/runtimes/$(RuntimeIdentifier)/native</_XamarinNativeLibraryDirectory>
<_XamarinIncludeDirectory>$(_XamarinSdkRuntimePackDirectory)/runtimes/$(RuntimeIdentifier)/native</_XamarinIncludeDirectory>
<_XamarinRefAssemblyDirectory>$(_XamarinRefPackageDirectory)/ref/net6.0/</_XamarinRefAssemblyDirectory>
<_XamarinRefAssemblyPath>$(_XamarinRefAssemblyDirectory)$(_PlatformAssemblyName).dll</_XamarinRefAssemblyPath>
<_LibPartialStaticRegistrar Condition="'$(UseMonoRuntime)' == 'true'">$(_XamarinNativeLibraryDirectory)/Microsoft.$(_PlatformName).registrar.a</_LibPartialStaticRegistrar>
<_LibPartialStaticRegistrar Condition="'$(UseMonoRuntime)' != 'true'">$(_XamarinNativeLibraryDirectory)/Microsoft.$(_PlatformName).registrar.coreclr.a</_LibPartialStaticRegistrar>
<_MonoRuntimePackPath>%(_MonoFrameworkReference.RuntimePackPath)/runtimes/$(RuntimeIdentifier)/</_MonoRuntimePackPath>
</PropertyGroup>
</Target>
<Target Name="_ComputeFrameworkAssemblies" DependsOnTargets="_ComputeVariables;ComputeResolvedFilesToPublishList">
<ItemGroup>
<!-- Define 'framework assembly' or 'sdk assembly' as assemblies that comes from the .NET BCL NuGet -->
<_XamarinFrameworkAssemblies Include="@(ResolvedFileToPublish)" Condition="'%(ResolvedFileToPublish.Extension)' == '.dll' And '%(ResolvedFileToPublish.NuGetPackageId)' == '$(_MonoNugetPackageId)'" />
</ItemGroup>
</Target>
<Target Name="_VerifyValidRuntime">
<Error Text="Only CoreCLR is supported on macOS. Set 'UseMonoRuntime=false' to use CoreCLR." Condition="'$(_PlatformName)' == 'macOS' And '$(UseMonoRuntime)' != 'false'" />
</Target>
<PropertyGroup>
<_ComputeVariablesDependsOn>
_VerifyValidRuntime;
_GenerateBundleName;
_ComputeFrameworkVariables;
</_ComputeVariablesDependsOn>
<!--
Don't execute ComputeResolvedFileToPublishList if we're in the
outer build of a multi-rid build, because there's nothing to
publish (except the merged app bundle, which we'll handle
ourselves).
-->
<_ComputeVariablesDependsOn Condition="'$(RuntimeIdentifiers)' == ''">$(_ComputeVariablesDependsOn);ComputeResolvedFilesToPublishList</_ComputeVariablesDependsOn>
</PropertyGroup>
<Target Name="_ComputeVariables" DependsOnTargets="$(_ComputeVariablesDependsOn)">
<PropertyGroup Condition="'$(_RunAotCompiler)' == ''">
<!-- Don't run the AOT compiler by default -->
<_RunAotCompiler>false</_RunAotCompiler>
<!-- We need it for device builds for mobile platforms -->
<_RunAotCompiler Condition="'$(_SdkIsSimulator)' != 'true' And '$(_PlatformName)' != 'macOS' And '$(_PlatformName)' != 'MacCatalyst'">true</_RunAotCompiler>
<!-- We need it if the interpreter is enabled, no matter where -->
<_RunAotCompiler Condition="'$(MtouchInterpreter)' != ''">true</_RunAotCompiler>
<!-- We need it for Mac Catalyst on arm64 -->
<_RunAotCompiler Condition="'$(RuntimeIdentifier)' == 'maccatalyst-arm64'">true</_RunAotCompiler>
<!-- We need it for iOS/tvOS simulator on arm64 -->
<_RunAotCompiler Condition="'$(RuntimeIdentifier)' == 'iossimulator-arm64' Or '$(RuntimeIdentifier)' == 'tvossimulator-arm64'">true</_RunAotCompiler>
</PropertyGroup>
<PropertyGroup>
<!-- Compute the absolute path to the publish directory. We only use this to compute the relative path of app bundle path relative to the publish directory -->
<!-- Take into account that 'PublishDir' may or may not be an absolute path to begin with -->
<_AbsolutePublishDir>$(PublishDir)</_AbsolutePublishDir>
<_AbsolutePublishDir Condition="!$([System.IO.Path]::IsPathRooted ('$(_AbsolutePublishDir)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(PublishDir)'))</_AbsolutePublishDir>
<!-- Compute the relative path to the publish directory ('PublishDir' is by default a relative path, but the developer might use an absolute path) -->
<_RelativePublishDir>$([MSBuild]::MakeRelative($(MSBuildProjectDirectory),$(_AbsolutePublishDir)))</_RelativePublishDir>
<_RelativePublishDir>$([MSBuild]::EnsureTrailingSlash($(_RelativePublishDir)))</_RelativePublishDir>
<!-- Compute the relative path of the app bundle relative to the publish directory. The _AppBundlePath is relative to the project directory, so to compute this we need to have both app bundle path and the publish directory as absolute paths first. -->
<_RelativeAppBundlePath>$([MSBuild]::MakeRelative($(_AbsolutePublishDir),$(MSBuildProjectDirectory)/$(_AppBundlePath)))</_RelativeAppBundlePath>
<_IntermediateNativeLibraryDir>$(IntermediateOutputPath)nativelibraries/</_IntermediateNativeLibraryDir>
<_IntermediateFrameworksDir>$(DeviceSpecificIntermediateOutputPath)frameworks</_IntermediateFrameworksDir>
<_IntermediateDecompressionDir>$(DeviceSpecificIntermediateOutputPath)decompressed</_IntermediateDecompressionDir>
<_NativeExecutableName>$(_AppBundleName)</_NativeExecutableName>
<_NativeExecutablePublishDir Condition="'$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS'">$(_RelativeAppBundlePath)\</_NativeExecutablePublishDir>
<_NativeExecutablePublishDir Condition="'$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst'">$(_RelativeAppBundlePath)\Contents\MacOS\</_NativeExecutablePublishDir>
<_AppBundleFrameworksDir Condition="'$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS'">$(_RelativeAppBundlePath)\Frameworks\</_AppBundleFrameworksDir>
<_AppBundleFrameworksDir Condition="'$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst'">$(_RelativeAppBundlePath)\Contents\Frameworks\</_AppBundleFrameworksDir>
<_AOTInputDirectory>$(_IntermediateNativeLibraryDir)aot-input/</_AOTInputDirectory>
<_AOTOutputDirectory>$(_IntermediateNativeLibraryDir)aot-output/</_AOTOutputDirectory>
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And ('$(ComputedPlatform)' != 'iPhone' Or '$(_PlatformName)' == 'macOS')">dylib</_LibMonoLinkMode>
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == ''">static</_LibMonoLinkMode>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'dylib'">dylib</_LibMonoExtension>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'static'">a</_LibMonoExtension>
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(ComputedPlatform)' != 'iPhone' And '$(_PlatformName)' != 'macOS'">dylib</_LibXamarinLinkMode>
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == ''">static</_LibXamarinLinkMode>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'dylib'">dylib</_LibXamarinExtension>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'static'">a</_LibXamarinExtension>
<_LibXamarinRuntime Condition="'$(UseMonoRuntime)' != 'true'">-coreclr</_LibXamarinRuntime>
<_LibXamarinDebug Condition="'$(_BundlerDebug)' == 'true'">-debug</_LibXamarinDebug>
<_LibXamarinName Condition="'$(_LibXamarinName)' == ''">libxamarin-dotnet$(_LibXamarinRuntime)$(_LibXamarinDebug).$(_LibXamarinExtension)</_LibXamarinName>
<_DylibRPath Condition="'$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS'">@executable_path</_DylibRPath>
<_DylibRPath Condition="'$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst'">@executable_path/../$(_CustomBundleName)/</_DylibRPath>
<_EmbeddedFrameworksRPath Condition="'$(_PlatformName)' == 'iOS' Or '$(_PlatformName)' == 'tvOS' Or '$(_PlatformName)' == 'watchOS'">@executable_path/Frameworks</_EmbeddedFrameworksRPath>
<_EmbeddedFrameworksRPath Condition="'$(_PlatformName)' == 'macOS' Or '$(_PlatformName)' == 'MacCatalyst'">@executable_path/../Frameworks/</_EmbeddedFrameworksRPath>
<_RuntimeConfigurationFile>runtimeconfig.bin</_RuntimeConfigurationFile>
</PropertyGroup>
<ItemGroup>
<!-- Select the native libraries from mono we need to link with and potentially copy into the app -->
<_MonoLibrary
Include="@(ResolvedFileToPublish)"
Condition=" '%(ResolvedFileToPublish.AssetType)' == 'native' And
'%(ResolvedFileToPublish.RuntimeIdentifier)' == '$(RuntimeIdentifier)' And
'%(ResolvedFileToPublish.Extension)' == '.$(_LibMonoExtension)' And
'%(ResolvedFileToPublish.NuGetPackageId)' == '$(_MonoNugetPackageId)'
"
/>
</ItemGroup>
</Target>
<!-- App bundle creation tasks -->
<Target Name="_CreateRuntimeConfiguration"
Inputs="$(ProjectRuntimeConfigFilePath)"
Outputs="$(_ParsedRuntimeConfigFilePath)"
DependsOnTargets="GenerateBuildRuntimeConfigurationFiles;_ComputePublishLocation"
>
<ItemGroup>
<!-- List all the properties passed to xamarin_bridge_vm_initialize in xamarin_vm_initialize (in runtime.m) -->
<_RuntimeConfigReservedProperties Include="APP_PATHS" />
<_RuntimeConfigReservedProperties Include="PINVOKE_OVERRIDE" />
<_RuntimeConfigReservedProperties Include="ICU_DAT_FILE_PATH" />
<_RuntimeConfigReservedProperties Include="TRUSTED_PLATFORM_ASSEMBLIES" />
<_RuntimeConfigReservedProperties Include="NATIVE_DLL_SEARCH_DIRECTORIES" />
<_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER" />
<_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY" />
</ItemGroup>
<RuntimeConfigParserTask
Condition="'$(GenerateRuntimeConfigurationFiles)' == 'true'"
RuntimeConfigFile="$(ProjectRuntimeConfigFilePath)"
OutputFile="$(_ParsedRuntimeConfigFilePath)"
RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)"
>
</RuntimeConfigParserTask>
<Warning Condition="'$(GenerateRuntimeConfigurationFiles)' != 'true'" Text="Some features may not work correctly, because the generation of the runtime configure file (*.runtimeconfig.json) has been disabled." />
</Target>
<Target Name="_FindAotCompiler" DependsOnTargets="_ComputeVariables">
<FindAotCompiler
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(_RunAotCompiler)' == 'true'"
MonoAotCrossCompiler="@(MonoAotCrossCompiler)"
RuntimeIdentifier="$(RuntimeIdentifier)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
<Output TaskParameter="AotCompiler" PropertyName="_AOTCompiler" />
</FindAotCompiler>
</Target>
<PropertyGroup>
<_AOTCompileDependsOn>
$(_AOTCompileDependsOn);
_ComputeVariables;
_FindAotCompiler;
_DetectAppManifest;
_ReadAppManifest;
_WriteAppManifest;
</_AOTCompileDependsOn>
</PropertyGroup>
<Target Name="_AOTCompile"
Condition="'$(_RunAotCompiler)' == 'true'"
DependsOnTargets="$(_AOTCompileDependsOn)"
Inputs="@(_AssembliesToAOT)"
Outputs="@(_AssembliesToAOT -> '%(ObjectFile)');@(_AssembliesToAOT -> '%(LLVMFile)');">
<AOTCompile
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
Assemblies="@(_AssembliesToAOT)"
AOTCompilerPath="$(_AOTCompiler)"
InputDirectory="$(_AOTInputDirectory)"
MinimumOSVersion="$(_MinimumOSVersion)"
OutputDirectory="$(_AOTOutputDirectory)\%(_AssembliesToAOT.Arch)"
SdkDevPath="$(_SdkDevPath)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
<Output TaskParameter="AssemblyFiles" ItemName="_AOTAssemblyFiles" />
<Output TaskParameter="FileWrites" ItemName="FileWrites" />
</AOTCompile>
<CompileNativeCode
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
CompileInfo="@(_AOTAssemblyFiles)"
MinimumOSVersion="$(_MinimumOSVersion)"
SdkDevPath="$(_SdkDevPath)"
SdkIsSimulator="$(_SdkIsSimulator)"
SdkRoot="$(_SdkRoot)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
</CompileNativeCode>
<ItemGroup Condition="'$(IsMacEnabled)' == 'true'">
<!-- Add the AOT-compiled output to the main executable -->
<_XamarinMainLibraries Include="@(_AssembliesToAOT -> '%(ObjectFile)')" />
<_XamarinMainLibraries Include="@(_AssembliesToAOT -> '%(LLVMFile)')" />
<!-- copy the aotdata files to the .app -->