-
Notifications
You must be signed in to change notification settings - Fork 534
/
Copy pathXamarin.Android.Tooling.targets
94 lines (85 loc) · 5.95 KB
/
Xamarin.Android.Tooling.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
<!--
***********************************************************************************************
Xamarin.Android.Tooling.targets
This file contains any calls to the <ResolveSdks/> or
<ResolveJdkJvmPath/> MSBuild tasks. It is imported and used by
"legacy" Xamarin.Android projects, binding projects, and .NET 5
projects.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.Android.Tasks.ResolveSdks" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.ResolveJdkJvmPath" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<PropertyGroup>
<_SetLatestTargetFrameworkVersionDependsOnTargets Condition=" '$(_AndroidIsBindingProject)' == 'True'">
_ResolveSdks;
_ResolveAndroidTooling;
</_SetLatestTargetFrameworkVersionDependsOnTargets>
<_SetLatestTargetFrameworkVersionDependsOnTargets Condition=" '$(_AndroidIsBindingProject)' != 'True'">
_ResolveSdks;
_ResolveAndroidTooling;
_InjectAaptDependencies;
</_SetLatestTargetFrameworkVersionDependsOnTargets>
</PropertyGroup>
<Target Name="_SetLatestTargetFrameworkVersion" DependsOnTargets="$(_SetLatestTargetFrameworkVersionDependsOnTargets)">
<PropertyGroup>
<TargetFrameworkMoniker Condition=" '$(TargetFrameworkProfile)' == '' ">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)</TargetFrameworkMoniker>
<TargetFrameworkMoniker Condition=" '$(TargetFrameworkProfile)' != '' ">$(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion),Profile=$(TargetFrameworkProfile)</TargetFrameworkMoniker>
<NuGetTargetMoniker>$(TargetFrameworkMoniker)</NuGetTargetMoniker>
<TargetFrameworkMonikerAssemblyAttributesPath>$(IntermediateOutputPath)$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
<!-- These references are implicitly defined in .NET 5 -->
<Reference Include="$(_JavaInteropReferences)" Condition=" '$(UsingAndroidNETSdk)' != 'True' " />
</ItemGroup>
</Target>
<PropertyGroup Condition=" '$(UsingAndroidNETSdk)' == 'True' ">
<_ResolveSdksDependsOnTargets>ResolveTargetingPackAssets</_ResolveSdksDependsOnTargets>
</PropertyGroup>
<PropertyGroup Condition=" '$(UsingAndroidNETSdk)' != 'True' ">
<_ResolveSdksDependsOnTargets>_GetReferenceAssemblyPaths</_ResolveSdksDependsOnTargets>
</PropertyGroup>
<Target Name="_ResolveSdks" DependsOnTargets="$(_ResolveSdksDependsOnTargets)">
<!-- When using .NET 5, provide a list of paths to the Android and NETCore targeting pack directories, e.g.
`packages\microsoft.android.ref\10.0.100-ci.master.22\ref\net5.0\` and
`C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0-preview.6.20264.1\ref\net5.0\`
See https://github.com/dotnet/sdk/blob/9eeb58e24af894597a534326156d09173d9f0f91/src/Tasks/Microsoft.NET.Build.Tasks/ResolveTargetingPackAssets.cs#L56
-->
<ItemGroup Condition=" '$(UsingAndroidNETSdk)' == 'True' ">
<_ResolveSdksFrameworkRefAssemblyPaths Include="@(Reference->'$([System.String]::Copy('%(RootDir)%(Directory)').TrimEnd('\'))')" Condition=" '%(Reference.FrameworkReferenceName)' != '' " />
</ItemGroup>
<PropertyGroup>
<_AndroidAllowMissingSdkTooling Condition=" '$(_AndroidAllowMissingSdkTooling)' == '' ">False</_AndroidAllowMissingSdkTooling>
<_XATargetFrameworkDirectories Condition=" '$(UsingAndroidNETSdk)' == 'True' ">@(_ResolveSdksFrameworkRefAssemblyPaths->Distinct())</_XATargetFrameworkDirectories>
</PropertyGroup>
<ResolveSdks
ContinueOnError="$(_AndroidAllowMissingSdkTooling)"
CommandLineToolsVersion="$(AndroidCommandLineToolsVersion)"
AndroidSdkPath="$(AndroidSdkDirectory)"
AndroidNdkPath="$(AndroidNdkDirectory)"
JavaSdkPath="$(JavaSdkDirectory)"
MinimumSupportedJavaVersion="$(MinimumSupportedJavaVersion)"
LatestSupportedJavaVersion="$(LatestSupportedJavaVersion)"
ReferenceAssemblyPaths="$(_XATargetFrameworkDirectories)">
<Output TaskParameter="CommandLineToolsPath" PropertyName="_AndroidToolsDirectory" />
<Output TaskParameter="AndroidNdkPath" PropertyName="AndroidNdkDirectory" Condition=" '$(AndroidNdkDirectory)' == '' " />
<Output TaskParameter="AndroidSdkPath" PropertyName="AndroidSdkDirectory" Condition=" '$(AndroidSdkDirectory)' == '' " />
<Output TaskParameter="JavaSdkPath" PropertyName="JavaSdkDirectory" Condition=" '$(JavaSdkDirectory)' == '' " />
<Output TaskParameter="AndroidNdkPath" PropertyName="_AndroidNdkDirectory" />
<Output TaskParameter="AndroidSdkPath" PropertyName="_AndroidSdkDirectory" />
<Output TaskParameter="JavaSdkPath" PropertyName="_JavaSdkDirectory" />
<Output TaskParameter="MonoAndroidToolsPath" PropertyName="MonoAndroidToolsDirectory" />
<Output TaskParameter="MonoAndroidBinPath" PropertyName="MonoAndroidBinDirectory" />
<Output TaskParameter="MonoAndroidLibPath" PropertyName="MonoAndroidLibDirectory" />
<Output TaskParameter="AndroidBinUtilsPath" PropertyName="AndroidBinUtilsDirectory" Condition=" '$(AndroidBinUtilsDirectory)' == '' " />
</ResolveSdks>
<ResolveJdkJvmPath
JavaSdkPath="$(_JavaSdkDirectory)"
MinimumSupportedJavaVersion="$(MinimumSupportedJavaVersion)"
LatestSupportedJavaVersion="$(LatestSupportedJavaVersion)"
Condition=" '$(DesignTimeBuild)' != 'True' And '$(_AndroidIsBindingProject)' != 'True' And '$(AndroidGenerateJniMarshalMethods)' == 'True' And '$(JdkJvmPath)' == '' ">
<Output TaskParameter="JdkJvmPath" PropertyName="JdkJvmPath" />
</ResolveJdkJvmPath>
</Target>
</Project>