Skip to content

Commit 34a3774

Browse files
dellis1972jonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] Dont clean the designtime folder (#1074)
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=60880 Turns out the design time build in Visual Studio does not clean up after itself.. ever. So we really should not be deleting the directory on a `Clean`. This commit move that code into is own internal target and updates the tests to reflect the changes.
1 parent 67dd3e5 commit 34a3774

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,8 +1862,10 @@ public void BuildInDesignTimeMode ([Values(false, true)] bool useManagedParser)
18621862
Assert.IsFalse (builder.Output.IsTargetSkipped ("_CreatePropertiesCache"), "target \"_CreatePropertiesCache\" should have been run.");
18631863
Assert.IsTrue (builder.Output.IsTargetSkipped ("_ResolveLibraryProjectImports"), "target \"_ResolveLibraryProjectImports\' should have been skipped.");
18641864
Assert.IsTrue (builder.Clean (proj), "Clean Should have succeeded");
1865+
builder.Target = "_CleanDesignTimeIntermediateDir";
1866+
Assert.IsTrue (builder.Build (proj), "_CleanDesignTimeIntermediateDir should have succeeded");
18651867
librarycache = Path.Combine (Root, path, proj.IntermediateOutputPath, "designtime", "libraryprojectimports.cache");
1866-
Assert.IsFalse (File.Exists (librarycache), $"'{librarycache}' should exist.");
1868+
Assert.IsFalse (File.Exists (librarycache), $"'{librarycache}' should not exist.");
18671869
}
18681870
}
18691871

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,6 +2611,10 @@ because xbuild doesn't support framework reference assemblies.
26112611
<RemoveDirFixed Directories="$(OutDir)$(_AndroidPackage).apk.mSYM" Condition=" '$(_AndroidPackage)' != '' And Exists ('$(OutDir)$(_AndroidPackage).apk.mSYM')" />
26122612
</Target>
26132613

2614+
<Target Name="_CleanDesignTimeIntermediateDir">
2615+
<RemoveDirFixed Directories="$(_AndroidDesignTimeResDirIntermediate)" Condition="Exists ('$(_AndroidDesignTimeResDirIntermediate)')" />
2616+
</Target>
2617+
26142618
<Target Name="_CleanGeneratedDeploymentFiles">
26152619
<CreateItem Include="$(IntermediateOutputPath)*.deployment">
26162620
<Output TaskParameter="Include" ItemName="_OutputDeploymentFiles" />
@@ -2636,7 +2640,6 @@ because xbuild doesn't support framework reference assemblies.
26362640
<RemoveDirFixed Directories="$(MonoAndroidIntermediate)proguard" Condition="Exists ('$(MonoAndroidIntermediate)proguard')" />
26372641
<RemoveDirFixed Directories="$(MonoAndroidIntermediateResourceCache)" Condition="Exists ('$(MonoAndroidIntermediateResourceCache)')" />
26382642
<RemoveDirFixed Directories="$(_AndroidAotBinDirectory)" Condition="Exists ('$(_AndroidAotBinDirectory)')" />
2639-
<RemoveDirFixed Directories="$(_AndroidDesignTimeResDirIntermediate)" Condition="Exists ('$(_AndroidDesignTimeResDirIntermediate)')" />
26402643
<Delete Files="$(IntermediateOutputPath)_dex_stamp" />
26412644
<Delete Files="$(MonoAndroidIntermediate)R.cs.flag" />
26422645
<Delete Files="$(MonoAndroidIntermediate)acw-map.txt" />

0 commit comments

Comments
 (0)