diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs index d5672b7af1e..b548fff2265 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/IncrementalBuildTest.cs @@ -318,5 +318,29 @@ public Class2 () } } } + + [Test] + public void CopyIntermediateAssemblies () + { + var target = "_CopyIntermediateAssemblies"; + var proj = new XamarinFormsAndroidApplicationProject (); + using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) { + Assert.IsTrue (b.Build (proj), "first build should succeed"); + Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should *not* be skipped!"); + + var assembly = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, proj.ProjectName + ".dll"); + FileAssert.Exists (assembly); + File.SetLastWriteTimeUtc (assembly, DateTime.UtcNow); + File.SetLastAccessTimeUtc (assembly, DateTime.UtcNow); + + //NOTE: second build, target will run because inputs changed + Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "second build should succeed"); + Assert.IsFalse (b.Output.IsTargetSkipped (target), $"`{target}` should *not* be skipped on second build!"); + + //NOTE: third build, it should certainly *not* run! there are no changes + Assert.IsTrue (b.Build (proj, doNotCleanupOnUpdate: true, saveProject: false), "third build should succeed"); + Assert.IsTrue (b.Output.IsTargetSkipped (target), $"`{target}` should be skipped on third build!"); + } + } } } diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 90a94a3b858..1ee9058e103 100755 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -1974,8 +1974,8 @@ because xbuild doesn't support framework reference assemblies. + + + + +