Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] skip _CleanIntermediateIfNuGetsChange o…
Browse files Browse the repository at this point in the history
…n first build (#2184)

Fixes: #2183
Context: #2177
Context: #1878
Context: dd36614
Context: http://work.devdiv.io/661455

We are seeing reports of issues related to Visual Studio for Mac
displaying "Updating Android Resources..." in the title bar, and a
build running at the same time.

This is effectively running two commands at the same time:

	msbuild YourAndroid.csproj /t:UpdateAndroidResources
	msbuild YourAndroid.csproj /t:Build

In the case such as Issue #2183, we get the failure:

	Task "RemoveDirFixed"
	    Xamarin.Android.Common.targets(3042,2): error : Directory /Users/builder/agent/_work/r1/a/XQA.VSMac/XQA.VisualStudioMac/TestResults/26ff4d25/TestAndroidEnableAOTEnterprise/Temp/DroidApp/DroidApp/obj/Release/lp/ is not empty

In this case, the error is coming from the
`_CleanIntermediateIfNuGetsChange` target, which has an issue we can
improve.  The target is *meant* to only run when NuGets change, but
is currently running on a first build.

If we skip the call to the `_CleanMonoAndroidIntermediateDir` target
if `$(_AndroidNuGetStampFile)` does not exist, then our
`_CleanIntermediateIfNuGetsChange` target will only clean files in
later builds when NuGets change.

I've not found anything we can do for the root cause of the
Visual Studio for Mac issue, but this will help on initial builds.
  • Loading branch information
jonathanpeppers authored and jonpryor committed Sep 19, 2018
1 parent 9e4ec78 commit c1567d8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<Target Name="_CleanIntermediateIfNuGetsChange" DependsOnTargets="_BeforeCleanIntermediateIfNuGetsChange"
Inputs="$(_NuGetAssetsFile)"
Outputs="$(_AndroidNuGetStampFile)">
<CallTarget Targets="_CleanMonoAndroidIntermediateDir" />
<CallTarget Targets="_CleanMonoAndroidIntermediateDir" Condition="Exists('$(_AndroidNuGetStampFile)')" />
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
<Touch Files="$(_AndroidNuGetStampFile)" AlwaysCreate="true" />
<ItemGroup>
Expand Down

0 comments on commit c1567d8

Please sign in to comment.