Skip to content

Commit

Permalink
[build] fix Windows build on a fresh machine (dotnet#1132)
Browse files Browse the repository at this point in the history
We discovered the build fails on Windows if you:
- wipe out `~\android-toolchain`
- `git clean -dxf`
- `msbuild Xamarin.Android.sln /t:Prepare`
- Or just have a fresh machine

We need to reorder the steps of what happens in `PrepareWindows.targets`:
1. `git submodule update`
2. build `xa-prep-tasks`, which gets `.nuget\NuGet.exe`
2. `nuget restore`
3. build `android-toolchain` , which is the missing step that installs the Android SDK
4. proceed with everything else

Without step no. 3, the missing Android SDK that gets installed to
`~\android-toolchain` causes the `<JdkInfo />` task to fail.
  • Loading branch information
jonathanpeppers authored and jonpryor committed Dec 21, 2017
1 parent 59cfa5d commit 3bfafea
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions build-tools/scripts/PrepareWindows.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
<Target Name="Prepare">
<Exec Command="git submodule update --init --recursive" WorkingDirectory="$(_TopDir)" />
<MSBuild Projects="$(MSBuildThisFileDirectory)..\xa-prep-tasks\xa-prep-tasks.csproj" />
<Exec Command="$(_NuGet) restore Xamarin.Android.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore Xamarin.Android-Tests.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\Java.Interop\Java.Interop.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\LibZipSharp\libZipSharp.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\xamarin-android-tools\Xamarin.Android.Tools.sln" WorkingDirectory="$(_TopDir)" />
<MSBuild Projects="$(MSBuildThisFileDirectory)..\android-toolchain\android-toolchain.mdproj" />
<JdkInfo
AndroidSdkPath="$(AndroidSdkDirectory)"
AndroidNdkPath="$(AndroidNdkDirectory)"
Expand All @@ -28,10 +34,5 @@
DestinationFile="$(_TopDir)\Configuration.OperatingSystem.props"
Replacements="@JAVA_HOME@=$(_JavaSdkDirectory)"
/>
<Exec Command="$(_NuGet) restore Xamarin.Android.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore Xamarin.Android-Tests.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\Java.Interop\Java.Interop.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\LibZipSharp\libZipSharp.sln" WorkingDirectory="$(_TopDir)" />
<Exec Command="$(_NuGet) restore external\xamarin-android-tools\Xamarin.Android.Tools.sln" WorkingDirectory="$(_TopDir)" />
</Target>
</Project>

0 comments on commit 3bfafea

Please sign in to comment.