-
Notifications
You must be signed in to change notification settings - Fork 533
/
Xamarin.Android.Legacy.targets
747 lines (687 loc) · 37.3 KB
/
Xamarin.Android.Legacy.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
<!--
***********************************************************************************************
Xamarin.Android.Legacy.targets
This file contains MSBuild targets for "legacy" Xamarin.Android
projects. .NET 5 projects will not import this file.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AndroidBoundExceptionType Condition=" '$(AndroidBoundExceptionType)' == '' ">Java</AndroidBoundExceptionType>
<AndroidGenerateResourceDesigner Condition=" '$(AndroidGenerateResourceDesigner)' == '' ">True</AndroidGenerateResourceDesigner>
</PropertyGroup>
<PropertyGroup Condition=" '$(AndroidBuildApplicationPackage)' == 'True' And '$(AndroidApplication)' == 'True' ">
<_PostBuildTargets>
_CopyPackage;
_Sign
</_PostBuildTargets>
</PropertyGroup>
<!-- Application projects -->
<PropertyGroup Condition=" '$(AndroidApplication)' == 'True' And '$(_AndroidIsBindingProject)' != 'True' ">
<BuildDependsOn>
_ValidateLinkMode;
_CheckNonIdealConfigurations;
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForBuild;
_CategorizeAndroidLibraries;
_CreatePropertiesCache;
_CleanIntermediateIfNeeded;
_CheckProjectItems;
_CheckForContent;
_CheckTargetFramework;
_CheckForObsoleteFrameworkAssemblies;
_RemoveLegacyDesigner;
_ValidateAndroidPackageProperties;
$(BuildDependsOn);
_CompileDex;
$(_AfterCompileDex);
$(_PostBuildTargets)
</BuildDependsOn>
<_BeforeIncrementalClean>
_PrepareAssemblies;
_CompileDex;
$(_AfterCompileDex);
_AddFilesToFileWrites;
</_BeforeIncrementalClean>
<_PackageForAndroidDependsOn>
SetWearAppTargetToPackageForAndroid;
Build;
_CopyPackage;
</_PackageForAndroidDependsOn>
</PropertyGroup>
<!-- Class library projects -->
<PropertyGroup Condition=" '$(AndroidApplication)' != 'True' And '$(_AndroidIsBindingProject)' != 'True' ">
<BuildDependsOn>
_ValidateLinkMode;
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForBuild;
_CategorizeAndroidLibraries;
_CreatePropertiesCache;
_CleanIntermediateIfNeeded;
_AddAndroidDefines;
_CreateNativeLibraryArchive;
_AddAndroidEnvironmentToCompile;
_CheckForContent;
_CheckTargetFramework;
_CheckForObsoleteFrameworkAssemblies;
_RemoveLegacyDesigner;
_ValidateAndroidPackageProperties;
$(BuildDependsOn);
</BuildDependsOn>
<_BeforeIncrementalClean>
_AddFilesToFileWrites;
</_BeforeIncrementalClean>
</PropertyGroup>
<!-- Application *and* Class library projects -->
<PropertyGroup Condition=" '$(_AndroidIsBindingProject)' != 'True' ">
<CoreBuildDependsOn>
$([MSBuild]::Unescape($(CoreBuildDependsOn.Replace('IncrementalClean;', '$(_BeforeIncrementalClean);IncrementalClean;'))))
</CoreBuildDependsOn>
<CompileDependsOn>
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForCompile;
_AddAndroidDefines;
_IncludeLayoutBindingSources;
$(CompileDependsOn);
</CompileDependsOn>
<CoreCompileDependsOn>
UpdateGeneratedFiles;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
<CoreResolveReferencesDependsOn>
_SeparateAppExtensionReferences;
_PrepareWearApplication;
$(ResolveReferencesDependsOn);
_AddAndroidCustomMetaData;
</CoreResolveReferencesDependsOn>
<ResolveReferencesDependsOn>
$(CoreResolveReferencesDependsOn);
UpdateAndroidInterfaceProxies;
UpdateAndroidResources;
</ResolveReferencesDependsOn>
<DeferredBuildDependsOn>
$(DeferredBuildDependsOn);
UpdateAndroidResources;
</DeferredBuildDependsOn>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
_CollectMonoAndroidOutputs;
</PrepareForRunDependsOn>
<CleanDependsOn>
$(CleanDependsOn);
_CleanMonoAndroidIntermediateDir;
_CleanAndroidBuildPropertiesCache;
</CleanDependsOn>
<_PrepareBuildApkDependsOnTargets>
_SetLatestTargetFrameworkVersion;
_GetLibraryImports;
_RemoveRegisterAttribute;
_ResolveAssemblies;
_ResolveSatellitePaths;
_CreatePackageWorkspace;
_CopyConfigFiles;
_ConvertPdbFiles;
_LinkAssemblies;
_GenerateJavaStubs;
_ManifestMerger;
_ConvertCustomView;
$(_AfterConvertCustomView);
$(AfterGenerateAndroidManifest);
_GenerateEnvironmentFiles;
_CompileJava;
_CreateApplicationSharedLibraries;
_CompileDex;
$(_AfterCompileDex);
_CreateBaseApk;
_PrepareAssemblies;
_ResolveSatellitePaths;
_CheckApkPerAbiFlag;
_LintChecks;
_IncludeNativeSystemLibraries;
_CheckGoogleSdkRequirements;
_AndroidAot;
</_PrepareBuildApkDependsOnTargets>
<_UpdateAndroidResourcesDependsOn>
$(CoreResolveReferencesDependsOn);
_CreatePropertiesCache;
_CheckForDeletedResourceFile;
_ComputeAndroidResourcePaths;
_UpdateAndroidResgen;
_CreateManagedLibraryResourceArchive;
</_UpdateAndroidResourcesDependsOn>
<GetAndroidDependenciesDependsOn>
_BeforeGetAndroidDependencies;
_SetLatestTargetFrameworkVersion;
$(GetAndroidDependenciesDependsOn);
</GetAndroidDependenciesDependsOn>
</PropertyGroup>
<!-- Binding projects -->
<PropertyGroup Condition=" '$(_AndroidIsBindingProject)' == 'True' ">
<BuildDependsOn>
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForBuild;
_CategorizeAndroidLibraries;
AddLibraryJarsToBind;
$(BuildDependsOn);
BuildDocumentation;
</BuildDependsOn>
<CompileDependsOn>
_SetupMSBuildAllProjects;
_SetupDesignTimeBuildForCompile;
AddLibraryJarsToBind;
$(CompileDependsOn);
</CompileDependsOn>
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
_SetAndroidGenerateManagedBindings;
AddBindingsToCompile;
AddEmbeddedJarsAsResources;
AddEmbeddedReferenceJarsAsResources;
_CreateNativeLibraryArchive;
</ResolveReferencesDependsOn>
<CleanDependsOn>
$(CleanDependsOn);
CleanBindingsOutput;
CleanLibraryProjectIntermediaries;
CleanNativeLibraryIntermediaries;
</CleanDependsOn>
<ExportJarToXmlDependsOnTargets>
_ResolveMonoAndroidSdks;
_ExtractLibraryProjectImports;
_GetLibraryImports;
_ExtractJavaDocJars;
_GenerateJavaDocFromSourceJars;
_ExportJarToXml;
</ExportJarToXmlDependsOnTargets>
<_ResolveLibraryProjectsDependsOn>
_CreateBindingResourceArchive;
</_ResolveLibraryProjectsDependsOn>
</PropertyGroup>
<UsingTask TaskName="Xamarin.Android.Tasks.CheckGoogleSdkRequirements" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.ConvertDebuggingFiles" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.CreateLibraryResourceArchive" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.CreateManagedLibraryResourceArchive" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.CreateNativeLibraryArchive" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.Legacy.ValidateJavaVersion" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.Legacy.ResolveAndroidTooling" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.LinkAssemblies" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<Target Name="_CheckTargetFramework">
<Warning Code="XA0109" Text="Unsupported or invalid %24(TargetFrameworkVersion) value of 'v4.5'. Please update your Project Options." Condition=" '$(TargetFrameworkVersion)' == 'v4.5' "/>
</Target>
<Target Name="_GetReferenceAssemblyPaths">
<GetReferenceAssemblyPaths
TargetFrameworkMoniker="$(TargetFrameworkIdentifier),Version=v1.0"
RootPath="$(TargetFrameworkRootPath)">
<Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_XATargetFrameworkDirectories" />
</GetReferenceAssemblyPaths>
</Target>
<!--
NOTE:
This target runs during Restore, and there is no $(RestoreDependsOn) property.
There appears to be no other way to do this other than use BeforeTargets.
-->
<Target Name="_SetLatestTargetFrameworkVersionForPackageReference"
Condition=" '$(AndroidUseLatestPlatformSdk)' == 'True' "
BeforeTargets="_GetRestoreTargetFrameworksOutput"
DependsOnTargets="_SetLatestTargetFrameworkVersion">
</Target>
<Target Name="_ResolveAndroidTooling">
<ValidateJavaVersion
Condition=" '$(DesignTimeBuild)' != 'True' Or '$(AndroidUseManagedDesignTimeResourceGenerator)' != 'True' "
ContinueOnError="$(_AndroidAllowMissingSdkTooling)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
AndroidSdkBuildToolsVersion="$(AndroidSdkBuildToolsVersion)"
JavaSdkPath="$(_JavaSdkDirectory)"
JavaToolExe="$(JavaToolExe)"
JavacToolExe="$(JavacToolExe)"
LatestSupportedJavaVersion="$(LatestSupportedJavaVersion)"
MinimumSupportedJavaVersion="$(MinimumSupportedJavaVersion)">
<Output TaskParameter="JdkVersion" PropertyName="_JdkVersion" />
<Output TaskParameter="MinimumRequiredJdkVersion" PropertyName="_DefaultJdkVersion" />
</ValidateJavaVersion>
<ResolveAndroidTooling
ContinueOnError="$(_AndroidAllowMissingSdkTooling)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
AndroidApiLevel="$(AndroidApiLevel)"
AndroidApplication="$(AndroidApplication)"
AndroidSdkPath="$(_AndroidSdkDirectory)"
AndroidSdkBuildToolsVersion="$(AndroidSdkBuildToolsVersion)"
CommandLineToolsVersion="$(AndroidCommandLineToolsVersion)"
UseLatestAndroidPlatformSdk="$(AndroidUseLatestPlatformSdk)"
AndroidUseAapt2="$(AndroidUseAapt2)"
AotAssemblies="$(AotAssemblies)"
Aapt2ToolPath="$(Aapt2ToolPath)"
SequencePointsMode="$(_AndroidSequencePointsMode)"
ProjectFilePath="$(MSBuildProjectFullPath)"
LintToolPath="$(LintToolPath)"
ZipAlignPath="$(ZipAlignToolPath)">
<Output TaskParameter="TargetFrameworkVersion" PropertyName="TargetFrameworkVersion" />
<Output TaskParameter="AndroidApiLevel" PropertyName="_AndroidApiLevel" Condition="'$(_AndroidApiLevel)' == ''" />
<Output TaskParameter="AndroidApiLevelName" PropertyName="_AndroidApiLevelName" />
<Output TaskParameter="AndroidSdkBuildToolsPath" PropertyName="AndroidSdkBuildToolsPath" Condition="'$(AndroidSdkBuildToolsPath)' == ''" />
<Output TaskParameter="AndroidSdkBuildToolsBinPath" PropertyName="AndroidSdkBuildToolsBinPath" Condition="'$(AndroidSdkBuildToolsBinPath)' == ''" />
<Output TaskParameter="ZipAlignPath" PropertyName="ZipAlignToolPath" Condition="'$(ZipAlignToolPath)' == ''" />
<Output TaskParameter="AndroidSequencePointsMode" PropertyName="_SequencePointsMode" Condition="'$(_SequencePointsMode)' == ''" />
<Output TaskParameter="LintToolPath" PropertyName="LintToolPath" Condition="'$(LintToolPath)' == ''" />
<Output TaskParameter="Aapt2Version" PropertyName="_Aapt2Version" />
<Output TaskParameter="Aapt2ToolPath" PropertyName="Aapt2ToolPath" Condition="'$(Aapt2ToolPath)' == ''" />
</ResolveAndroidTooling>
</Target>
<Target Name="_ResolveAssemblies">
<!--- Remove the ImplicitlyExpandDesignTimeFacades assemblies. We have already build the app there are not required for packaging -->
<ItemGroup>
<FilteredAssemblies
Include="$(OutDir)$(TargetFileName)"
Condition="Exists ('$(OutDir)$(TargetFileName)')"
/>
<FilteredAssemblies
Include="@(ReferenceCopyLocalPaths)"
Condition="'%(ReferenceCopyLocalPaths.ResolvedFrom)' != 'ImplicitlyExpandDesignTimeFacades' And '%(ReferenceCopyLocalPaths.Extension)' == '.dll' And '%(ReferenceCopyLocalPaths.RelativeDir)' == '' And Exists('%(ReferenceCopyLocalPaths.Identity)') "
/>
<FilteredAssemblies
Include="@(_ReferenceDependencyPaths)"
Condition="'%(_ReferenceDependencyPaths.ResolvedFrom)' != 'ImplicitlyExpandDesignTimeFacades' And Exists('%(_ReferenceDependencyPaths.Identity)') "
/>
<FilteredAssemblies
Include="@(_ReferencePath)"
Condition="'%(ReferencePath.ResolvedFrom)' != 'ImplicitlyExpandDesignTimeFacades' And Exists('%(_ReferencePath.Identity)') "
/>
</ItemGroup>
<!-- Find all the assemblies this app requires -->
<ResolveAssemblies
Assemblies="@(FilteredAssemblies->Distinct())"
I18nAssemblies="$(MandroidI18n)"
LinkMode="$(AndroidLinkMode)"
ProjectFile="$(MSBuildProjectFullPath)"
TargetFrameworkVersion="$(TargetFrameworkVersion)"
ProjectAssetFile="$(ProjectLockFile)"
TargetMoniker="$(NuGetTargetMoniker)"
ReferenceAssembliesDirectory="$(TargetFrameworkDirectory)">
<Output TaskParameter="ResolvedAssemblies" ItemName="ResolvedAssemblies" />
<Output TaskParameter="ResolvedUserAssemblies" ItemName="ResolvedUserAssemblies" />
<Output TaskParameter="ResolvedFrameworkAssemblies" ItemName="ResolvedFrameworkAssemblies" />
<Output TaskParameter="ResolvedSymbols" ItemName="ResolvedSymbols" />
<Output TaskParameter="ResolvedDoNotPackageAttributes" ItemName="_ResolvedDoNotPackageAttributes" />
</ResolveAssemblies>
<Hash ItemsToHash="@(ResolvedAssemblies)">
<Output TaskParameter="HashResult" PropertyName="_ResolvedUserAssembliesHash" />
</Hash>
<WriteLinesToFile
File="$(_ResolvedUserAssembliesHashFile)"
Lines="$(_ResolvedUserAssembliesHash)"
Overwrite="true"
WriteOnlyWhenDifferent="true"
/>
<ItemGroup>
<FileWrites Include="$(_ResolvedUserAssembliesHashFile)" />
</ItemGroup>
</Target>
<Target Name="_CheckGoogleSdkRequirements"
Condition="Exists('$(IntermediateOutputPath)android\AndroidManifest.xml') And '$(AndroidEnableGooglePlayStoreChecks)' == 'true' ">
<CheckGoogleSdkRequirements
TargetFrameworkVersion="$(TargetFrameworkVersion)"
ManifestFile="$(IntermediateOutputPath)android\AndroidManifest.xml"
/>
</Target>
<Target Name="_CollectConfigFiles">
<GetFilesThatExist
Files="@(ResolvedAssemblies->'%(identity).config')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedConfigFiles" />
</GetFilesThatExist>
</Target>
<Target Name="_CopyConfigFiles"
Inputs="@(_ResolvedConfigFiles)"
Outputs="$(_AndroidStampDirectory)_CopyConfigFiles.stamp"
DependsOnTargets="_CollectConfigFiles">
<CopyIfChanged
SourceFiles="@(_ResolvedConfigFiles)"
DestinationFiles="@(_ResolvedConfigFiles->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')"
/>
<Touch Files="$(_AndroidStampDirectory)_CopyConfigFiles.stamp" AlwaysCreate="True" />
</Target>
<Target Name="_CollectMdbFiles"
DependsOnTargets="_CollectPdbFiles">
<GetFilesThatExist
Files="@(ResolvedAssemblies->'%(RootDir)%(Directory)%(Filename)%(Extension).mdb')"
IgnoreFiles="@(_ResolvedPortablePdbFiles->'%(RootDir)%(Directory)%(Filename).dll.mdb')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedMdbFiles" />
</GetFilesThatExist>
</Target>
<Target Name="_CollectPdbFiles">
<CollectPdbFiles
ResolvedAssemblies="@(ResolvedAssemblies->'%(RootDir)%(Directory)%(Filename).pdb')">
<Output TaskParameter="PdbFiles" ItemName="_ResolvedPdbFiles" />
<Output TaskParameter="PortablePdbFiles" ItemName="_ResolvedPortablePdbFiles" />
</CollectPdbFiles>
<ItemGroup>
<_ConvertedMdbFiles Include="@(_ResolvedPdbFiles->'%(RootDir)%(Directory)%(Filename).dll.mdb')" />
</ItemGroup>
</Target>
<Target Name="_ConvertPdbFiles"
Inputs="@(_ResolvedPdbFiles)"
Outputs="@(_ConvertedMdbFiles)"
DependsOnTargets="_CollectPdbFiles">
<ConvertDebuggingFiles Files="@(_ResolvedPdbFiles)" />
<Touch Files="@(_ConvertedMdbFiles)" ContinueOnError="true" />
<ItemGroup>
<!-- NOTE: @(_ResolvedPortablePdbFiles) are valid -->
<_DeprecatedSymbols Include="@(_ResolvedMdbFiles);@(_ResolvedPdbFiles)" />
</ItemGroup>
<AndroidWarning Code="XA0125"
ResourceName="XA0125"
FormatArguments="%(_DeprecatedSymbols.FileName)%(_DeprecatedSymbols.Extension)"
Condition=" '%(_DeprecatedSymbols.Identity)' != '' "
/>
<ItemGroup>
<FileWrites Include="@(_ConvertedMdbFiles)" />
</ItemGroup>
</Target>
<Target Name="ConvertDebuggingFiles"
Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' And Exists ('$(_IntermediatePdbFile)') And '$(OS)' == 'Windows_NT'"
DependsOnTargets="_ConvertDebuggingFiles"
/>
<Target Name="_ConvertDebuggingFiles"
Inputs="$(OutDir)$(TargetFileName);$(_IntermediatePdbFile)"
Outputs="$(OutDir)$(TargetFileName).mdb"
DependsOnTargets="_ValidateAndroidPackageProperties">
<ConvertDebuggingFiles Files="$(OutDir)$(TargetFileName)" />
<Touch Files="$(OutDir)$(TargetFileName).mdb" />
<ItemGroup>
<FileWrites Include="$(OutDir)$(TargetFileName).mdb" />
</ItemGroup>
</Target>
<Target Name="_AddAndroidEnvironmentToCompile">
<ItemGroup>
<EmbeddedResource Include="@(AndroidEnvironment)">
<LogicalName>__AndroidEnvironment__%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="AddEmbeddedJarsAsResources" DependsOnTargets="GenerateBindings">
<ItemGroup>
<EmbeddedResource Include="@(EmbeddedJar)">
<LogicalName>%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="AddEmbeddedReferenceJarsAsResources" DependsOnTargets="GenerateBindings">
<ItemGroup>
<EmbeddedResource Include="@(EmbeddedReferenceJar)">
<LogicalName>__reference__%(Filename)%(Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="_CreateNativeLibraryArchive"
Condition=" '$(AndroidApplication)' != 'true' And '@(EmbeddedNativeLibrary->Count())' != '0' "
Inputs="@(EmbeddedNativeLibrary)"
Outputs="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip">
<CreateNativeLibraryArchive
OutputDirectory="$(IntermediateOutputPath)$(_NativeLibraryImportsDirectoryName)"
EmbeddedNativeLibraries="@(EmbeddedNativeLibrary)"
/>
<Touch Files="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip" AlwaysCreate="true" />
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip" />
<EmbeddedResource Include="$(IntermediateOutputPath)__AndroidNativeLibraries__.zip">
<LogicalName>__AndroidNativeLibraries__.zip</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="_CreateManagedLibraryResourceArchive"
Condition=" '$(AndroidApplication)' != 'true' And '$(_AndroidIsBindingProject)' != 'true' "
Inputs="@(_AndroidResourceDest);@(AndroidAsset);@(AndroidJavaLibrary);@(AndroidJavaSource);@(_AndroidResourceDestRemovedFiles)"
Outputs="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip">
<CreateManagedLibraryResourceArchive
OutputDirectory="$(IntermediateOutputPath)$(_LibraryProjectImportsDirectoryName)"
ResourceDirectory="$(MonoAndroidResDirIntermediate)"
AndroidAssets="@(AndroidAsset)"
MonoAndroidAssetsPrefix="$(MonoAndroidAssetsPrefix)"
AndroidJavaSources="@(AndroidJavaSource)"
AndroidJavaLibraries="@(AndroidJavaLibrary)"
AndroidResourcesInThisExactProject="@(_AndroidResourceDest)"
FlatArchivesDirectory="$(_AndroidLibraryFlatArchivesDirectory)"
RemovedAndroidResourceFiles="@(_AndroidResourceDestRemovedFiles)"
/>
<Touch Files="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip" AlwaysCreate="true" />
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip" />
<EmbeddedResource Include="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip">
<LogicalName>__AndroidLibraryProjects__.zip</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="_CreateBindingResourceArchive"
Condition=" '$(_AndroidIsBindingProject)' == 'true' "
Inputs="@(LibraryProjectProperties);@(LibraryProjectZip)"
Outputs="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip">
<CreateLibraryResourceArchive
OutputDirectory="$(IntermediateOutputPath)$(_LibraryProjectImportsDirectoryName)"
OutputJarsDirectory="$(IntermediateOutputPath)library_project_jars"
OutputAnnotationsDirectory="$(IntermediateOutputPath)library_project_annotations"
LibraryProjectPropertiesFiles="@(LibraryProjectProperties)"
LibraryProjectZipFiles="@(LibraryProjectZip)"
/>
<ItemGroup Condition="Exists ('$(IntermediateOutputPath)__AndroidLibraryProjects__.zip')">
<FileWrites Include="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip" />
<EmbeddedResource Include="$(IntermediateOutputPath)__AndroidLibraryProjects__.zip">
<LogicalName>__AndroidLibraryProjects__.zip</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="_IncludeNativeSystemLibraries">
<PropertyGroup>
<_Assemblies>@(_ResolvedFrameworkAssemblies)</_Assemblies>
<_TargetInterpreterPrefix Condition=" '$(AndroidUseInterpreter)' != 'False' ">interpreter-</_TargetInterpreterPrefix>
<_AndroidDebugNativeLibraries Condition=" '$(_AndroidDebugNativeLibraries)' == '' ">False</_AndroidDebugNativeLibraries>
</PropertyGroup>
<SplitProperty Value="$(AndroidEmbedProfilers)" Condition=" '$(AndroidEmbedProfilers)' != '' ">
<Output TaskParameter="Output" ItemName="_EmbedProfilers" />
</SplitProperty>
<ItemGroup>
<_TargetArchitecture Include="$(_Android32bitArchitectures);$(_Android64bitArchitectures)" />
<_TargetLibDir Include="$(MSBuildThisFileDirectory)lib\%(_TargetArchitecture.Identity)" Condition=" Exists('$(MSBuildThisFileDirectory)lib\%(_TargetArchitecture.Identity)') "/>
<_TargetLibInterpreterDir Include="$(MSBuildThisFileDirectory)lib\$(_TargetInterpreterPrefix)%(_TargetArchitecture.Identity)" Condition=" Exists('$(MSBuildThisFileDirectory)lib\$(_TargetInterpreterPrefix)%(_TargetArchitecture.Identity)') "/>
<AndroidNativeLibrary Include="%(_TargetLibDir.Identity)\libsqlite3_xamarin.so" Condition="$(_Assemblies.Contains('Mono.Data.Sqlite.dll'))" />
<AndroidNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libMonoPosixHelper.so" Condition="$(_Assemblies.Contains('Mono.Posix.dll')) and '$(_AndroidDebugNativeLibraries)' != 'True' " />
<AndroidNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libMonoPosixHelper.d.so" Condition="$(_Assemblies.Contains('Mono.Posix.dll')) and '$(_AndroidDebugNativeLibraries)' == 'True' " ArchiveFileName="libMonoPosixHelper.so" />
<AndroidNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-native.so" Condition=" '$(_AndroidDebugNativeLibraries)' != 'True' " />
<AndroidNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-native.d.so" Condition=" '$(_AndroidDebugNativeLibraries)' == 'True' " ArchiveFileName="libmono-native.so" />
<AndroidNativeLibrary Include="%(_TargetLibDir.Identity)\libxamarin-debug-app-helper.so" Condition=" '$(AndroidUseDebugRuntime)' == 'True' And '$(_AndroidCheckedBuild)' == '' "/>
<AndroidNativeLibrary Include="%(_TargetLibDir.Identity)\libxamarin-debug-app-helper-checked+$(_AndroidCheckedBuild).so" Condition=" '$(AndroidUseDebugRuntime)' == 'True' And '$(_AndroidCheckedBuild)' != '' " ArchiveFileName="libxamarin-debug-app-helper.so" />
<_AndroidNativeLibraryForFastDev Condition=" '$(_InstantRunEnabled)' == 'True' And '$(AndroidUseDebugRuntime)' == 'True' " Include="%(_TargetLibInterpreterDir.Identity)\libmono-native.so" />
<_AndroidNativeLibraryForFastDev Condition=" '$(_InstantRunEnabled)' == 'True' And '$(AndroidUseDebugRuntime)' == 'True' And '$(_AndroidCheckedBuild)' == '' " Include="%(_TargetLibDir.Identity)\libxamarin-debug-app-helper.so" />
<_AndroidNativeLibraryForFastDev Condition=" '$(_InstantRunEnabled)' == 'True' And '$(AndroidUseDebugRuntime)' == 'True' And '$(_AndroidCheckedBuild)' != '' " Include="%(_TargetLibDir.Identity)\libxamarin-debug-app-helper-checked+$(_AndroidCheckedBuild).so" ArchiveFileName="libxamarin-debug-app-helper.so" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libmono-android.debug.so" Condition=" '$(AndroidIncludeDebugSymbols)' == 'True' And '$(_AndroidCheckedBuild)' == '' " ArchiveFileName="libmonodroid.so" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libmono-android-checked+$(_AndroidCheckedBuild).debug.so" Condition=" '$(AndroidIncludeDebugSymbols)' == 'True' And '$(_AndroidCheckedBuild)' != '' " ArchiveFileName="libmonodroid.so" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libmono-android.release.so" Condition=" '$(AndroidIncludeDebugSymbols)' != 'True' And '$(_AndroidCheckedBuild)' == '' " ArchiveFileName="libmonodroid.so" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libmono-android-checked+$(_AndroidCheckedBuild).release.so" Condition=" '$(AndroidIncludeDebugSymbols)' != 'True' And '$(_AndroidCheckedBuild)' != '' " ArchiveFileName="libmonodroid.so" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libxa-internal-api.so" Condition=" '$(_AndroidCheckedBuild)' == ''" />
<FrameworkNativeLibrary Include="%(_TargetLibDir.Identity)\libxa-internal-api-checked+$(_AndroidCheckedBuild).so" Condition=" '$(_AndroidCheckedBuild)' != '' " ArchiveFileName="libxa-internal-api.so" />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-btls-shared.so" Condition=" '$(_AndroidDebugNativeLibraries)' != 'True' " />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-btls-shared.d.so" Condition=" '$(_AndroidDebugNativeLibraries)' == 'True' " ArchiveFileName="libmono-btls-shared.so" />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-profiler-aot.so" Condition=" @(_EmbedProfilers->Count()) > 0 and (@(_EmbedProfilers->AnyHaveMetadataValue('Identity', 'aot')) or @(_EmbedProfilers->AnyHaveMetadataValue('Identity', 'all'))) " />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmono-profiler-log.so" Condition=" '$(AndroidIncludeDebugSymbols)' == 'True' or (@(_EmbedProfilers->Count()) > 0 and (@(_EmbedProfilers->AnyHaveMetadataValue('Identity', 'log')) or @(_EmbedProfilers->AnyHaveMetadataValue('Identity', 'all')))) " />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmonosgen-2.0.so" Condition=" '$(_AndroidDebugNativeLibraries)' != 'True' " />
<FrameworkNativeLibrary Include="%(_TargetLibInterpreterDir.Identity)\libmonosgen-2.0.d.so" Condition=" '$(_AndroidDebugNativeLibraries)' == 'True' " ArchiveFileName="libmonosgen-2.0.so" />
</ItemGroup>
</Target>
<PropertyGroup>
<_PrepareAssembliesDependsOnTargets>
_ResolveAssemblies;
_ResolveSatellitePaths;
_CreatePackageWorkspace;
_CopyConfigFiles;
_ConvertPdbFiles;
_LinkAssemblies;
</_PrepareAssembliesDependsOnTargets>
</PropertyGroup>
<Target Name="_PrepareAssemblies"
DependsOnTargets="$(_PrepareAssembliesDependsOnTargets)">
<!--
Update our assembly lists to the copies for linking. We also
need to verify they still exist, because linking will delete
them if they aren't used.
-->
<GetFilesThatExist
Condition=" '$(AndroidLinkMode)' != 'None' "
Files="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedAssemblies" />
</GetFilesThatExist>
<GetFilesThatExist
Condition=" '$(AndroidLinkMode)' != 'None' "
Files="@(ResolvedSymbols->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedSymbols" />
</GetFilesThatExist>
<GetFilesThatExist
Condition=" '$(AndroidLinkMode)' != 'None'"
Files="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedUserAssemblies" />
</GetFilesThatExist>
<GetFilesThatExist
Condition=" '$(AndroidLinkMode)' != 'None' "
Files="@(ResolvedFrameworkAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')">
<Output TaskParameter="FilesThatExist" ItemName="_ResolvedFrameworkAssemblies" />
</GetFilesThatExist>
<ItemGroup Condition=" '$(AndroidLinkMode)' == 'None' ">
<_ResolvedAssemblies Include="@(ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')" />
<_ResolvedSymbols Include="@(ResolvedSymbols->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')" />
<_ResolvedUserAssemblies Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')" />
<_ResolvedFrameworkAssemblies Include="@(ResolvedFrameworkAssemblies->'$(MonoAndroidIntermediateAssemblyDir)%(Filename)%(Extension)')" />
</ItemGroup>
<ItemGroup Condition=" ('$(AndroidLinkMode)' == 'None' Or '$(AndroidIncludeDebugSymbols)' == 'true') ">
<_ShrunkAssemblies Include="@(_ResolvedAssemblies)" />
<_ShrunkUserAssemblies Include="@(_ResolvedUserAssemblies)" />
<_ShrunkFrameworkAssemblies Include="@(_ResolvedFrameworkAssemblies)" />
</ItemGroup>
<ItemGroup Condition=" '$(AndroidLinkMode)' != 'None' And '$(AndroidIncludeDebugSymbols)' != 'true' ">
<_ShrunkAssemblies Include="@(_ResolvedAssemblies->'$(MonoAndroidIntermediateAssemblyDir)shrunk\%(Filename)%(Extension)')" />
<_ShrunkUserAssemblies Include="@(_ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssemblyDir)shrunk\%(Filename)%(Extension)')" />
<_ShrunkFrameworkAssemblies Include="@(_ResolvedFrameworkAssemblies->'$(MonoAndroidIntermediateAssemblyDir)shrunk\%(Filename)%(Extension)')" />
</ItemGroup>
<ItemGroup>
<_ResolvedUserMonoAndroidAssemblies
Include="@(_ResolvedUserAssemblies)"
Condition=" '%(_ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' Or '%(_ResolvedUserAssemblies.HasMonoAndroidReference)' == 'true' "
/>
</ItemGroup>
</Target>
<Target Name="_LinkAssemblies"
DependsOnTargets="_ResolveAssemblies;_CreatePackageWorkspace;$(_BeforeLinkAssemblies);_GenerateJniMarshalMethods;_LinkAssembliesNoShrink;_LinkAssembliesShrink"
/>
<Target Name="_LinkAssembliesShrink"
Condition="'$(AndroidLinkMode)' != 'None'"
Inputs="@(ResolvedUserAssemblies);@(LinkDescription);$(_AndroidBuildPropertiesCache)"
Outputs="$(_AndroidLinkFlag)">
<PropertyGroup>
<_MainAssembly Condition=" '$(AndroidGenerateJniMarshalMethods)' != 'True' ">$(TargetPath)</_MainAssembly>
<_MainAssembly Condition=" '$(AndroidGenerateJniMarshalMethods)' == 'True' ">$(_JniMarshalMethodsOutputDir)$(TargetFileName)</_MainAssembly>
</PropertyGroup>
<ItemGroup Condition=" '$(AndroidGenerateJniMarshalMethods)' != 'True' ">
<_AssembliesToLink Include="@(ResolvedAssemblies)" />
</ItemGroup>
<ItemGroup Condition=" '$(AndroidGenerateJniMarshalMethods)' == 'True' ">
<_PossibleAssembliesToLink Include="@(ResolvedAssemblies)">
<JniAssembly>$(_JniMarshalMethodsOutputDir)%(Filename)%(Extension)</JniAssembly>
</_PossibleAssembliesToLink>
<_AssembliesToLink Condition="Exists(%(_PossibleAssembliesToLink.JniAssembly))" Include="%(_PossibleAssembliesToLink.JniAssembly)" />
<_AssembliesToLink Condition="!Exists(%(_PossibleAssembliesToLink.JniAssembly))" Include="%(_PossibleAssembliesToLink.Identity)" />
</ItemGroup>
<CreateProperty
Condition=" '$(AndroidLinkTool)' != '' "
Value="$(IntermediateOutputPath)proguard\proguard_project_references.cfg">
<Output TaskParameter="Value" PropertyName="_ProguardProjectConfiguration" />
</CreateProperty>
<MakeDir Condition=" '$(AndroidLinkTool)' != '' " Directories="$(IntermediateOutputPath)proguard" />
<LinkAssemblies
MainAssembly="$(_MainAssembly)"
OutputDirectory="$(MonoAndroidIntermediateAssemblyDir)"
I18nAssemblies="$(MandroidI18n)"
LinkMode="$(AndroidLinkMode)"
LinkSkip="$(AndroidLinkSkip)"
LinkDescriptions="@(LinkDescription)"
ProguardConfiguration="$(_ProguardProjectConfiguration)"
AddKeepAlives="$(AndroidAddKeepAlives)"
LinkResources="$(AndroidLinkResources)"
PreserveJniMarshalMethods="$(AndroidGenerateJniMarshalMethods)"
EnableProguard="$(AndroidEnableProguard)"
Deterministic="$(Deterministic)"
DumpDependencies="$(LinkerDumpDependencies)"
ResolvedAssemblies="@(_AssembliesToLink)"
HttpClientHandlerType="$(AndroidHttpClientHandlerType)"
TlsProvider="$(AndroidTlsProvider)"
/>
<!-- We have to use a flag instead of normal outputs because linking can delete unused assemblies -->
<Touch Files="$(_AndroidLinkFlag)" AlwaysCreate="true" />
<ItemGroup>
<FileWrites Include="$(_AndroidLinkFlag)" />
<FileWrites Include="$(MonoAndroidIntermediateAssemblyDir)*" />
</ItemGroup>
</Target>
<!-- Legacy AOT support that runs before _BuildApkEmbed -->
<Target Name="_AndroidAot"
Condition=" '$(AotAssemblies)' == 'true' or '$(BundleAssemblies)' == 'true' "
Inputs="$(_BuildApkEmbedInputs)"
Outputs="$(_AndroidStampDirectory)_AndroidAot.stamp">
<PropertyGroup>
<_StartupAotProfile Condition="'%(ResolvedAssemblies.Filename)' == 'Xamarin.Forms.Platform.Android'">startup-xf.aotprofile</_StartupAotProfile>
<_StartupAotProfile Condition="'$(_StartupAotProfile)' == ''">startup.aotprofile</_StartupAotProfile>
</PropertyGroup>
<ItemGroup Condition="'$(AndroidUseDefaultAotProfile)' != 'False'">
<AndroidAotProfile Include="$(MSBuildThisFileDirectory)$(_StartupAotProfile)" />
</ItemGroup>
<SplitProperty Value="$(AndroidAotProfiles)" Condition="'$(AndroidAotProfiles)' != ''">
<Output TaskParameter="Output" ItemName="_AotProfiles" />
</SplitProperty>
<ItemGroup Condition="'$(AndroidEnableProfiledAot)' == 'True'">
<_AotProfiles Include="@(AndroidAotProfile)" />
</ItemGroup>
<Aot
Condition="'$(AotAssemblies)' == 'True'"
AndroidAotMode="$(AndroidAotMode)"
AndroidNdkDirectory="$(AndroidNdkDirectory)"
AndroidBinUtilsDirectory="$(AndroidBinUtilsDirectory)"
AndroidApiLevel="$(_AndroidApiLevel)"
ManifestFile="$(IntermediateOutputPath)android\AndroidManifest.xml"
SupportedAbis="@(_BuildTargetAbis)"
AndroidSequencePointsMode="$(_SequencePointsMode)"
AotAdditionalArguments="$(AndroidAotAdditionalArguments)"
ExtraAotOptions="$(AndroidExtraAotOptions)"
TargetName="$(TargetName)"
ResolvedAssemblies="@(_ShrunkAssemblies)"
AotOutputDirectory="$(_AndroidAotBinDirectory)"
IntermediateAssemblyDir="$(MonoAndroidIntermediateAssemblyDir)"
LinkMode="$(AndroidLinkMode)"
AdditionalNativeLibraryReferences="@(_AdditionalNativeLibraryReferences)"
YieldDuringToolExecution="$(YieldDuringToolExecution)"
EnableLLVM="$(EnableLLVM)"
Profiles="@(_AotProfiles)"
StripLibraries="$(_AndroidAotStripLibraries)">
<Output TaskParameter="NativeLibrariesReferences" ItemName="_AdditionalNativeLibraryReferences" />
</Aot>
<ItemGroup Condition=" '$(AndroidAotMode)' == 'Hybrid' And '$(AotAssemblies)' == 'True' ">
<_CilStripAssemblies Include="@(_ShrunkAssemblies)" Condition=" '%(FileName)' != 'Mono.Android' " />
</ItemGroup>
<!-- Strip the IL code of the resolved managed assemblies -->
<CilStrip
Condition=" '$(AndroidAotMode)' == 'Hybrid' And '$(AotAssemblies)' == 'True' "
AndroidAotMode="$(AndroidAotMode)"
ToolPath="$(_MonoAndroidToolsDirectory)"
StampFile="$(_AndroidStampDirectory)_AndroidAot.stamp"
ResolvedAssemblies="@(_CilStripAssemblies)"
/>
<!-- Bundle the assemblies into native libraries in the apk -->
<MakeBundleNativeCodeExternal
Condition="'$(BundleAssemblies)' == 'True'"
KeepTemp="$(AndroidMakeBundleKeepTemporaryFiles)"
AndroidNdkDirectory="$(_AndroidNdkDirectory)"
Assemblies="@(_ShrunkAssemblies);@(_AndroidResolvedSatellitePaths)"
IncludePath="$(MonoAndroidIncludeDirectory)"
SupportedAbis="@(_BuildTargetAbis)"
TempOutputPath="$(IntermediateOutputPath)"
ToolPath="$(_MonoAndroidToolsDirectory)"
BundleApiPath="$(MSBuildThisFileDirectory)\mkbundle-api.h">
<Output TaskParameter="OutputNativeLibraries" PropertyName="_BundleResultNativeLibraries" />
</MakeBundleNativeCodeExternal>
<Touch Files="$(_AndroidStampDirectory)_AndroidAot.stamp" AlwaysCreate="true" />
</Target>
</Project>