From 6cb7d00b7fc39fc969ee366bb5ccfd3b19ad34ff Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Thu, 18 Apr 2024 14:10:16 +0100 Subject: [PATCH 1/6] fix up tests --- .external | 2 +- Xamarin.Android.code-workspace | 3 +- .../stage-msbuild-emulator-tests.yaml | 2 +- .../yaml-templates/stage-msbuild-tests.yaml | 2 +- .../Tasks/ProcessAssemblies.cs | 5 +++ .../Utilities/DeviceTest.cs | 4 +++ .../Xamarin.Android.Common.targets | 4 --- .../Tests/DebuggingTest.cs | 25 ++++++++++++++- .../Tests/InstallTests.cs | 32 +++++++++++++------ 9 files changed, 60 insertions(+), 19 deletions(-) diff --git a/.external b/.external index 39511b205a8..bce054a5836 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:main@93ab95e18077d56d9d55ce7b4069a534e2dea35e +xamarin/monodroid:allowaabfastdev@a52595ad5c9b3bf85e13ec1268f0a2eb532014b4 diff --git a/Xamarin.Android.code-workspace b/Xamarin.Android.code-workspace index 327ad56b9d4..217de4789b6 100644 --- a/Xamarin.Android.code-workspace +++ b/Xamarin.Android.code-workspace @@ -5,6 +5,7 @@ } ], "settings": { - "nxunitExplorer.logpanel": true + "nxunitExplorer.logpanel": true, + "java.compile.nullAnalysis.mode": "disabled" } } \ No newline at end of file diff --git a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml index f2c23e9a2bf..4e71b44222e 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml @@ -4,7 +4,7 @@ parameters: stageName: msbuilddevice_tests job_name: 'mac_dotnetdevice_tests' dependsOn: mac_build - agent_count: 8 + agent_count: 12 stageCondition: succeeded() stagePrefix: '' xaSourcePath: $(System.DefaultWorkingDirectory) diff --git a/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml b/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml index d20e1549812..434de192f42 100644 --- a/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml +++ b/build-tools/automation/yaml-templates/stage-msbuild-tests.yaml @@ -22,7 +22,7 @@ stages: testOS: macOS jobName: mac_msbuild_tests jobDisplayName: macOS > Tests > MSBuild - agentCount: 8 + agentCount: 14 xaSourcePath: ${{ parameters.xaSourcePath }} repositoryAlias: ${{ parameters.repositoryAlias }} commit: ${{ parameters.commit }} diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs index 02ce62f6b87..3fe70459ef7 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs @@ -112,7 +112,9 @@ void SetAssemblyAbiMetadata (ITaskItem assembly, ITaskItem? symbol) void SetMetadataForAssemblies (List output, Dictionary symbols) { + Log.LogDebugMessage ($"DEBUG!SetMetadataForAssemblies: Start of Loop"); foreach (ITaskItem assembly in InputAssemblies) { + Log.LogDebugMessage ($"DEBUG!SetMetadataForAssemblies: {assembly.ItemSpec}"); if (DesignTimeBuild && !File.Exists (assembly.ItemSpec)) { // Designer builds don't produce assemblies, so library and main application DLLs might not // be there and would later cause an error when the `_CopyAssembliesForDesigner` task runs @@ -130,6 +132,7 @@ void SetMetadataForAssemblies (List output, Dictionary - "namespace Library1 { public class Class1 { public static int foo = 0; } }" + TextContent = () => "namespace Library1 { public class Class1 { public static int foo = 500; } }" }; var lib1 = new XamarinAndroidLibraryProject () { ProjectName = "Library1", @@ -509,7 +514,7 @@ public void IncrementalFastDeployment () }; var class2src = new BuildItem.Source ("Class2.cs") { - TextContent = () => "namespace Library2 { public class Class2 { public static int foo = 0; } }" + TextContent = () => "namespace Library2 { public class Class2 { public static int foo = 40; } }" }; var lib2 = new DotNetStandard { ProjectName = "Library2", @@ -527,16 +532,21 @@ public void IncrementalFastDeployment () new BuildItem ("ProjectReference", "..\\Library2\\Library2.csproj"), }, }; + app.SetProperty ("AndroidPackageFormat", packageFormat); // Set up library projects var rootPath = Path.Combine (Root, "temp", TestName); - using (var lb1 = CreateDllBuilder (Path.Combine (rootPath, lib1.ProjectName))) + using (var lb1 = CreateDllBuilder (Path.Combine (rootPath, lib1.ProjectName))) { + lb1.BuildLogFile = "build.log"; Assert.IsTrue (lb1.Build (lib1), "First library build should have succeeded."); - using (var lb2 = CreateDllBuilder (Path.Combine (rootPath, lib2.ProjectName))) + } + using (var lb2 = CreateDllBuilder (Path.Combine (rootPath, lib2.ProjectName))) { + lb2.BuildLogFile = "build.log"; Assert.IsTrue (lb2.Build (lib2), "Second library build should have succeeded."); + } long lib1FirstBuildSize = new FileInfo (Path.Combine (rootPath, lib1.ProjectName, lib1.OutputPath, "Library1.dll")).Length; - + using (var builder = CreateApkBuilder (Path.Combine (rootPath, app.ProjectName))) { builder.Verbosity = LoggerVerbosity.Detailed; builder.ThrowOnBuildFailure = false; @@ -560,13 +570,15 @@ public void IncrementalFastDeployment () File.SetLastWriteTimeUtc (file, DateTime.UtcNow); } - class1src.TextContent = () => "namespace Library1 { public class Class1 { public static int foo = 100; } }"; + class1src.TextContent = () => "namespace Library1 { public class Class1 { public static int foo = 1; } }"; class1src.Timestamp = DateTime.UtcNow.AddSeconds(1); - using (var lb1 = CreateDllBuilder (Path.Combine (rootPath, lib1.ProjectName))) + using (var lb1 = CreateDllBuilder (Path.Combine (rootPath, lib1.ProjectName))) { + lb1.BuildLogFile = "build2.log"; Assert.IsTrue (lb1.Build (lib1), "Second library build should have succeeded."); + } long lib1SecondBuildSize = new FileInfo (Path.Combine (rootPath, lib1.ProjectName, lib1.OutputPath, "Library1.dll")).Length; - Assert.AreEqual (lib1FirstBuildSize, lib1SecondBuildSize, "Library2.dll was not the same size."); + Assert.AreEqual (lib1FirstBuildSize, lib1SecondBuildSize, "Library1.dll was not the same size."); builder.BuildLogFile = "install3.log"; Assert.IsTrue (builder.Install (app, doNotCleanupOnUpdate: true, saveProject: false), "Third install should have succeeded."); From 68c07f0256259f1ab406affaa5d43987f0f83433 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 29 May 2024 15:33:39 +0100 Subject: [PATCH 2/6] remove issue --- tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs index 25b559adb45..ed6cdb17972 100755 --- a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs @@ -332,7 +332,6 @@ public override void OnCreate () }, new object[] { /* embedAssemblies */ false, - /* fastDevType */ "Assemblies", /* allowDeltaInstall */ false, /* user */ null, /* packageFormat */ "aab", @@ -347,7 +346,6 @@ public override void OnCreate () }, new object[] { /* embedAssemblies */ false, - /* fastDevType */ "Assemblies", /* allowDeltaInstall */ false, /* user */ DeviceTest.GuestUserName, /* packageFormat */ "aab", From 5c8afd4e4fb6b48bff24893da0d5904d87cd1591 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Thu, 30 May 2024 15:24:18 +0100 Subject: [PATCH 3/6] Fix DeviceAbi selection --- tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs index ed6cdb17972..b8b13c423f0 100755 --- a/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs +++ b/tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs @@ -407,9 +407,8 @@ public Foo () app.SetProperty ("AndroidPackageFormat", packageFormat); app.MainPage = app.MainPage.Replace ("InitializeComponent ();", "InitializeComponent (); new Foo ();"); app.AddReference (lib); - var abis = new [] { "x86", DeviceAbi }; + var abis = new [] { DeviceAbi }; app.SetRuntimeIdentifiers (abis); - //app.SetAndroidSupportedAbis (DeviceAbi); app.SetProperty (KnownProperties._AndroidAllowDeltaInstall, allowDeltaInstall.ToString ()); app.SetDefaultTargetDevice (); using (var libBuilder = CreateDllBuilder (Path.Combine (path, lib.ProjectName))) From 7da51ffff924f1c18e677a7dcd089b8a4e2a78fb Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 3 Jun 2024 08:26:16 +0100 Subject: [PATCH 4/6] Bump monodroid --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index bce054a5836..672d6c7f4f2 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:allowaabfastdev@a52595ad5c9b3bf85e13ec1268f0a2eb532014b4 +xamarin/monodroid:allowaabfastdev@ab08fd9d3c53d4ecb797c74e4bcf8dbcbe25b90d From b26f712b5403fb747fff68510110cf3d0448b523 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 10 Jun 2024 08:07:22 +0100 Subject: [PATCH 5/6] Bump monodroid --- .external | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.external b/.external index 672d6c7f4f2..579f13b883b 100644 --- a/.external +++ b/.external @@ -1 +1 @@ -xamarin/monodroid:allowaabfastdev@ab08fd9d3c53d4ecb797c74e4bcf8dbcbe25b90d +xamarin/monodroid:main@c6aae9e5a154cfbf2c3a94e046fa2c747c3b82e2 From 5d0a9da4d34c12a78ad0ac341232aeb95ac3df4c Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 10 Jun 2024 08:10:07 +0100 Subject: [PATCH 6/6] Remove logging --- src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs b/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs index 3fe70459ef7..426dce71b71 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs @@ -112,9 +112,7 @@ void SetAssemblyAbiMetadata (ITaskItem assembly, ITaskItem? symbol) void SetMetadataForAssemblies (List output, Dictionary symbols) { - Log.LogDebugMessage ($"DEBUG!SetMetadataForAssemblies: Start of Loop"); foreach (ITaskItem assembly in InputAssemblies) { - Log.LogDebugMessage ($"DEBUG!SetMetadataForAssemblies: {assembly.ItemSpec}"); if (DesignTimeBuild && !File.Exists (assembly.ItemSpec)) { // Designer builds don't produce assemblies, so library and main application DLLs might not // be there and would later cause an error when the `_CopyAssembliesForDesigner` task runs @@ -132,7 +130,6 @@ void SetMetadataForAssemblies (List output, Dictionary