diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 2690ef12a13..7b91ddeb5cb 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -2352,6 +2352,7 @@ because xbuild doesn't support framework reference assemblies. ;@(_ShrunkFrameworkAssemblies) ;@(_AndroidNativeLibraryForFastDev) ;@(_DexFileForFastDevInput) + ;@(_ApplicationSharedLibrary) ;$(_AndroidBuildPropertiesCache) ;$(_AdbPropertiesCache) ;$(_PackagedResources) diff --git a/tests/MSBuildDeviceIntegration/Tests/FastDevTest.cs b/tests/MSBuildDeviceIntegration/Tests/FastDevTest.cs index d9a7e199966..46fa0f491be 100644 --- a/tests/MSBuildDeviceIntegration/Tests/FastDevTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/FastDevTest.cs @@ -38,6 +38,49 @@ public void FastDevSimpleBuild () b.Dispose (); } + [Test] + public void FastDeployUpdatesTypeMapAfterAssemblyEdit () + { + var proj = new XamarinAndroidApplicationProject { + PackageName = "com.xamarin.fastdeploy_typemap", + }; + proj.SetDefaultTargetDevice (); + proj.SetProperty ("_AndroidFastDevStrategy", "FastDeploy"); + proj.MainActivity = proj.DefaultMainActivity + .Replace ("//${AFTER_ONCREATE}", "StartActivity (new Android.Content.Intent (this, typeof (SecondActivity)));") + .Replace ("//${AFTER_MAINACTIVITY}", """ + [Activity (Label = "Fast Deploy Result")] + public sealed class SecondActivity : Activity + { + } + """); + + using var builder = CreateApkBuilder (); + Assert.IsTrue (builder.Install (proj), "Initial install should have succeeded."); + AssertSecondActivityStarts ("initial-launch.log"); + + proj.MainActivity += "// Incremental C# edit."; + proj.Touch ("MainActivity.cs"); + Assert.IsTrue (builder.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "Incremental install should have succeeded."); + AssertSecondActivityStarts ("incremental-launch.log"); + Assert.IsTrue (builder.Uninstall (proj), "Uninstall should have succeeded."); + + void AssertSecondActivityStarts (string logFileName) + { + ClearAdbLogcat (); + AdbStartActivity ($"{proj.PackageName}/{proj.JavaPackageName}.MainActivity"); + Assert.IsTrue ( + WaitForActivityToStart ( + proj.PackageName, + "SecondActivity", + Path.Combine (Root, builder.ProjectDirectory, logFileName), + ActivityStartTimeoutInSeconds + ), + "SecondActivity should have started." + ); + } + } + [Test] public void TargetsSkipped ([Values(false, true)] bool useManagedResourceGenerator) { @@ -140,7 +183,7 @@ public void SkipFastDevAlreadyInstalledFile () proj.Touch ("MainActivity.cs"); // make sure that the fastdev log tells that the relevant dll is updated but NOT for others. Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded."); - Assert.IsFalse (b.Output.IsApkInstalled, "app apk was installed"); + Assert.IsTrue (b.Output.IsApkInstalled, "app apk was not installed"); Assert.IsTrue (b.LastBuildOutput.Any (l => l.Contains ("UnnamedProject.dll") && l.Contains ("NotifySync CopyFile")), "app dll not uploaded"); var assemblies = new[] {