Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 2fc217a

Browse files
committed
Restructure targets file for AndroidSdk dir eval
$AndroidSdkPath and $AndroidSdkDirectory weren’t being evaluated early enough to be used in properties (so the value would be blank). This works around that by evaluating conditions using the android sdk location later (eg: not putting the $AndroidSdkDirectory into a property which is then later used in a condition). Also, the full path now gets updated in the Task if the .aar file does exist in the android sdk.
1 parent 20cf701 commit 2fc217a

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

template.targets

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,15 @@
1010
<!-- Path to .aar file within the extracted contents of the cached download -->
1111
<_XbdAarFile_>m2repository\com\android\support\$AarKey$\$AarVersion$\$AarKey$-$AarVersion$.aar</_XbdAarFile_>
1212

13-
<!-- Path to .aar file within the Android SDK -->
14-
<_XbdAarFileInSdk_>$(AndroidSdkPath)\extras\android\$(_XbdAarFile_)</_XbdAarFileInSdk_>
13+
<!-- Full path to .aar file, assuming we had to download to the cache - we reset this later if it is in the sdk -->
14+
<_XbdAarFileFullPath_>$(XamarinBuildDownloadDir)\$(_XbdKey_)\$(_XbdAarFile_)</_XbdAarFileFullPath_>
1515

1616
<!-- Assembly name to embed .aar in -->
1717
<_XbdAssemblyName_>$XbdAssemblyName$</_XbdAssemblyName_>
1818
</PropertyGroup>
1919

20-
<!-- If the Android SDK does NOT have Support Libs installed -->
21-
<PropertyGroup Condition="!Exists('$(_XbdAarFileInSdk_)')">
22-
<_XbdAarFileFullPath_>$(XamarinBuildDownloadDir)$(_XbdKey_)\$(_XbdAarFile_)</_XbdAarFileFullPath_>
23-
</PropertyGroup>
24-
25-
<!-- If the Android SDK DOES have Support Libs installed -->
26-
<PropertyGroup Condition="Exists('$(_XbdAarFileInSdk_)')">
27-
<_XbdAarFileFullPath_>$(_XbdAarFileInSdk_)</_XbdAarFileFullPath_>
28-
</PropertyGroup>
29-
3020
<ItemGroup>
31-
<XamarinBuildDownload Include="$(_XbdKey_)" Condition="!Exists('$(_XbdAarFileInSdk_)')">
21+
<XamarinBuildDownload Include="$(_XbdKey_)" Condition="!Exists('$(AndroidSdkDirectory)\extras\android\$(_XbdAarFile_)')">
3222
<Url>$(_XbdUrl_)</Url>
3323
<Kind>Zip</Kind>
3424
<Sha1>$(_XbdSha1_)</Sha1>
@@ -40,6 +30,11 @@
4030
</ItemGroup>
4131

4232
<Target Name="_XbdRestoreItems_">
33+
<!-- Check if the aar file is in the android sdk already and change the path to use to it, if it's found -->
34+
<CreateProperty Value="$(AndroidSdkDirectory)\extras\android\$(_XbdAarFile_)" Condition="Exists('$(AndroidSdkDirectory)\extras\android\$(_XbdAarFile_)')">
35+
<Output PropertyName="_XbdAarFileFullPath_" TaskParameter="Value" />
36+
</CreateProperty>
37+
4338
<ItemGroup>
4439
<XamarinBuildDownloadRestoreAssemblyAar Include="$(_XbdAarFileFullPath_)">
4540
<LogicalName>__AndroidLibraryProjects__.zip</LogicalName>

0 commit comments

Comments
 (0)