Skip to content

Commit 6e7be95

Browse files
jonathanpeppersjonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] set $(AndroidSdkDirectory) if blank (#2225)
In d6009ef, I fixed an issue when `$(AndroidSdkDirectory)` is set to a non-existent directory. However, downstream in `monodroid`, there is a test project with an MSBuild target such as: <Exec Command="&quot;$(JavaSdkDirectory)\bin\javac&quot; -etc" /> `/p:JavaSdkDirectory` is not passed in here at the command line or imported, causing `/bin/javac` is attempted to be used, which doesn't work, as it doesn't exist. This brings up an important point. `$(AndroidSdkDirectory)`, `$(AndroidNdkDirectory)` and `$(JavaSdkDirectory)` were public properties that were set if blank, So we can't just remove them! There could be unknown projects, NuGet packages, etc. relying on them. I think the fix here is to set these properties if they are blank. Internally in xamarin-android's MSBuild targets, we should always use the private underscore-prefixed versions such as `$(_AndroidSdkDirectory)`.
1 parent e390702 commit 6e7be95

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,9 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
685685
AndroidNdkPath="$(AndroidNdkDirectory)"
686686
JavaSdkPath="$(JavaSdkDirectory)"
687687
ReferenceAssemblyPaths="$(_XATargetFrameworkDirectories)">
688+
<Output TaskParameter="AndroidNdkPath" PropertyName="AndroidNdkDirectory" Condition=" '$(AndroidNdkDirectory)' == '' " />
689+
<Output TaskParameter="AndroidSdkPath" PropertyName="AndroidSdkDirectory" Condition=" '$(AndroidSdkDirectory)' == '' " />
690+
<Output TaskParameter="JavaSdkPath" PropertyName="JavaSdkDirectory" Condition=" '$(JavaSdkDirectory)' == '' " />
688691
<Output TaskParameter="AndroidNdkPath" PropertyName="_AndroidNdkDirectory" />
689692
<Output TaskParameter="AndroidSdkPath" PropertyName="_AndroidSdkDirectory" />
690693
<Output TaskParameter="JavaSdkPath" PropertyName="_JavaSdkDirectory" />

0 commit comments

Comments
 (0)