diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs index 5a135444ca7..ca698cf584a 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs @@ -137,34 +137,30 @@ public void BuildAotApplicationWithSpecialCharactersInProject (string testName, new object[] { /* supportedAbis */ "arm64-v8a", /* enableLLVM */ false, - /* usesAssemblyBlobs */ false, }, new object[] { /* supportedAbis */ "armeabi-v7a;x86", /* enableLLVM */ true, - /* usesAssemblyBlobs */ true, }, new object[] { /* supportedAbis */ "armeabi-v7a;arm64-v8a;x86;x86_64", /* enableLLVM */ false, - /* usesAssemblyBlobs */ true, }, new object[] { /* supportedAbis */ "armeabi-v7a;arm64-v8a;x86;x86_64", /* enableLLVM */ true, - /* usesAssemblyBlobs */ false, }, }; [Test] [TestCaseSource (nameof (AotChecks))] - public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAbis, bool enableLLVM, bool usesAssemblyBlobs) + public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAbis, bool enableLLVM) { if (IsWindows) Assert.Ignore ("https://github.com/dotnet/runtime/issues/88625"); var abisSanitized = supportedAbis.Replace (";", "").Replace ("-", "").Replace ("_", ""); - var path = Path.Combine ("temp", string.Format ("BuildAotNdk AndÜmläüts_{0}_{1}_{2}", abisSanitized, enableLLVM, usesAssemblyBlobs)); + var path = Path.Combine ("temp", string.Format ("BuildAotNdk AndÜmläüts_{0}_{1}", abisSanitized, enableLLVM)); var proj = new XamarinAndroidApplicationProject () { IsRelease = true, AotAssemblies = true, @@ -174,7 +170,6 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath); proj.SetRuntimeIdentifiers (supportedAbis.Split (';')); proj.SetProperty ("EnableLLVM", enableLLVM.ToString ()); - proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ()); bool checkMinLlvmPath = enableLLVM && (supportedAbis == "armeabi-v7a" || supportedAbis == "x86"); if (checkMinLlvmPath) { // Set //uses-sdk/@android:minSdkVersion so that LLVM uses the right libc.so @@ -195,7 +190,7 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs); + var helper = new ArchiveAssemblyHelper (apk); Assert.IsTrue (helper.Exists ($"assemblies/{abi}/UnnamedProject.dll"), $"{abi}/UnnamedProject.dll should be in {proj.PackageName}-Signed.apk"); using (var zipFile = ZipHelper.OpenZip (apk)) { Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile, @@ -215,13 +210,13 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb [Test] [TestCaseSource (nameof (AotChecks))] - public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableLLVM, bool usesAssemblyBlobs) + public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableLLVM) { if (IsWindows) Assert.Ignore ("https://github.com/dotnet/runtime/issues/88625"); var abisSanitized = supportedAbis.Replace (";", "").Replace ("-", "").Replace ("_", ""); - var path = Path.Combine ("temp", string.Format ("BuildAot AndÜmläüts_{0}_{1}_{2}", abisSanitized, enableLLVM, usesAssemblyBlobs)); + var path = Path.Combine ("temp", string.Format ("BuildAot AndÜmläüts_{0}_{1}", abisSanitized, enableLLVM)); var proj = new XamarinAndroidApplicationProject () { IsRelease = true, AotAssemblies = true, @@ -229,7 +224,6 @@ public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableL }; proj.SetRuntimeIdentifiers (supportedAbis.Split (';')); proj.SetProperty ("EnableLLVM", enableLLVM.ToString ()); - proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ()); using (var b = CreateApkBuilder (path)) { b.ThrowOnBuildFailure = false; Assert.IsTrue (b.Build (proj), "Build should have succeeded."); @@ -240,7 +234,7 @@ public void BuildAotApplicationAndÜmläüts (string supportedAbis, bool enableL var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs); + var helper = new ArchiveAssemblyHelper (apk); Assert.IsTrue (helper.Exists ($"assemblies/{abi}/UnnamedProject.dll"), $"{abi}/UnnamedProject.dll should be in {proj.PackageName}-Signed.apk"); using (var zipFile = ZipHelper.OpenZip (apk)) { Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile, diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs index f30f2f2388d..40b233b3a59 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs @@ -16,97 +16,81 @@ public partial class BuildTest : BaseTest /* runtimeIdentifiers */ "android-arm", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ true, }, new object [] { /* runtimeIdentifiers */ "android-arm64", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-x86", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-x64", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ true, }, new object [] { /* runtimeIdentifiers */ "android-arm", /* isRelease */ true, /* aot */ true, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm", /* isRelease */ true, /* aot */ true, - /* usesAssemblyStore */ true, }, new object [] { /* runtimeIdentifiers */ "android-arm64", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86;android-x64", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86;android-x64", /* isRelease */ false, /* aot */ false, - /* usesAssemblyStore */ true, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86;android-x64", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ false, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86;android-x64", /* isRelease */ true, /* aot */ false, - /* usesAssemblyStore */ true, }, new object [] { /* runtimeIdentifiers */ "android-arm;android-arm64;android-x86;android-x64", /* isRelease */ true, /* aot */ true, - /* usesAssemblyStore */ false, }, }; diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index 47602ce7249..0f205d00bd2 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -26,7 +26,7 @@ public partial class BuildTest : BaseTest [Category ("SmokeTests")] [TestCaseSource (nameof (DotNetBuildSource))] [NonParallelizable] // On MacOS, parallel /restore causes issues - public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bool usesAssemblyStore) + public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot) { var proj = new XamarinAndroidApplicationProject { IsRelease = isRelease, @@ -63,7 +63,6 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo }; proj.MainActivity = proj.DefaultMainActivity.Replace (": Activity", ": AndroidX.AppCompat.App.AppCompatActivity") .Replace ("//${AFTER_ONCREATE}", @"button.Text = Resource.CancelButton;"); - proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyStore.ToString ()); proj.SetProperty ("RunAOTCompilation", aot.ToString ()); proj.OtherBuildItems.Add (new AndroidItem.InputJar ("javaclasses.jar") { BinaryContent = () => ResourceData.JavaSourceJarTestJar, @@ -158,7 +157,7 @@ public void DotNetBuild (string runtimeIdentifiers, bool isRelease, bool aot, bo bool expectEmbeddedAssembies = !(TestEnvironment.CommercialBuildAvailable && !isRelease); var apkPath = Path.Combine (outputPath, $"{proj.PackageName}-Signed.apk"); FileAssert.Exists (apkPath); - var helper = new ArchiveAssemblyHelper (apkPath, usesAssemblyStore, rids); + var helper = new ArchiveAssemblyHelper (apkPath, rids); helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.dll", shouldContainEntry: expectEmbeddedAssembies); helper.AssertContainsEntry ($"assemblies/{proj.ProjectName}.pdb", shouldContainEntry: !TestEnvironment.CommercialBuildAvailable && !isRelease); helper.AssertContainsEntry ($"assemblies/Mono.Android.dll", shouldContainEntry: expectEmbeddedAssembies); @@ -262,7 +261,6 @@ public void CheckAssemblyCounts (bool isRelease, bool aot) var abis = new [] { "armeabi-v7a", "x86" }; proj.SetRuntimeIdentifiers (abis); - proj.SetProperty (proj.ActiveConfigurationProperties, "AndroidUseAssemblyStore", "True"); using (var b = CreateApkBuilder ()) { Assert.IsTrue (b.Build (proj), "Build should have succeeded."); @@ -279,7 +277,7 @@ public void CheckAssemblyCounts (bool isRelease, bool aot) } string apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - var helper = new ArchiveAssemblyHelper (apk, useAssemblyStores: true); + var helper = new ArchiveAssemblyHelper (apk); foreach (string abi in abis) { AndroidTargetArch arch = MonoAndroidHelper.AbiToTargetArch (abi); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs index 058269ceaa4..b11f4e11da7 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest2.cs @@ -154,7 +154,6 @@ public void BuildReleaseArm64 ([Values (false, true)] bool forms) proj.AotAssemblies = false; // Release defaults to Profiled AOT for .NET 6 proj.SetAndroidSupportedAbis ("arm64-v8a"); proj.SetProperty ("LinkerDumpDependencies", "True"); - proj.SetProperty ("AndroidUseAssemblyStore", "False"); var flavor = (forms ? "XForms" : "Simple") + "DotNet"; var apkDescFilename = $"BuildReleaseArm64{flavor}.apkdesc"; @@ -319,7 +318,7 @@ public void XA1037PropertyDeprecatedWarning (string property, string value, bool XamarinAndroidProject proj = isBindingProject ? new XamarinAndroidBindingProject () : new XamarinAndroidApplicationProject (); proj.IsRelease = isRelease; proj.SetProperty (property, value); - + using (ProjectBuilder b = isBindingProject ? CreateDllBuilder (Path.Combine ("temp", TestName)) : CreateApkBuilder (Path.Combine ("temp", TestName))) { Assert.IsTrue (b.Build (proj), "Build should have succeeded."); Assert.IsTrue (StringAssertEx.ContainsText (b.LastBuildOutput, $"The '{property}' MSBuild property is deprecated and will be removed"), @@ -1369,7 +1368,7 @@ public Class2 () }; string apkPath = Path.Combine (outputPath, proj.PackageName + "-Signed.apk"); - var helper = new ArchiveAssemblyHelper (apkPath, useAssemblyStores: false, proj.GetRuntimeIdentifiers ().ToArray ()); + var helper = new ArchiveAssemblyHelper (apkPath, proj.GetRuntimeIdentifiers ().ToArray ()); foreach (string abi in proj.GetRuntimeIdentifiersAsAbis ()) { foreach ((string fileName, bool existsInBin) in fileNames) { EnsureFilesAreTheSame (intermediate, existsInBin ? outputPath : null, fileName, abi, helper, uncompressIfNecessary: fileName.EndsWith (".dll", StringComparison.Ordinal)); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs index 170261f1a59..18579fcf949 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs @@ -58,7 +58,7 @@ public void CheckR8InfoMessagesToNotBreakTheBuild () [Test] [NonParallelizable] // Commonly fails NuGet restore - public void CheckIncludedAssemblies ([Values (false, true)] bool usesAssemblyStores) + public void CheckIncludedAssemblies () { var proj = new XamarinAndroidApplicationProject { IsRelease = true @@ -68,7 +68,6 @@ public void CheckIncludedAssemblies ([Values (false, true)] bool usesAssemblySto AndroidTargetArch.Arm, }; - proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyStores.ToString ()); proj.SetRuntimeIdentifiers (supportedArches); proj.PackageReferences.Add (new Package { Id = "Humanizer.Core", @@ -111,7 +110,7 @@ public void CheckIncludedAssemblies ([Values (false, true)] bool usesAssemblySto Assert.IsTrue (b.Build (proj), "build should have succeeded."); var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - var helper = new ArchiveAssemblyHelper (apk, usesAssemblyStores); + var helper = new ArchiveAssemblyHelper (apk); List existingFiles; List missingFiles; List additionalFiles; diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs index f9be89306ae..f1d928e57cc 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs @@ -261,21 +261,20 @@ public void WarnAboutAppDomains ([Values (true, false)] bool isRelease) } [Test] - public void RemoveDesigner ([Values (true, false)] bool useAssemblyStore) + public void RemoveDesigner () { var proj = new XamarinAndroidApplicationProject { IsRelease = true, }; proj.SetProperty ("AndroidEnableAssemblyCompression", "False"); proj.SetProperty ("AndroidLinkResources", "True"); - proj.SetProperty ("AndroidUseAssemblyStore", useAssemblyStore.ToString ()); string assemblyName = proj.ProjectName; using var b = CreateApkBuilder (); Assert.IsTrue (b.Build (proj), "build should have succeeded."); var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); FileAssert.Exists (apk); - var helper = new ArchiveAssemblyHelper (apk, useAssemblyStore); + var helper = new ArchiveAssemblyHelper (apk); foreach (string abi in proj.GetRuntimeIdentifiersAsAbis ()) { Assert.IsTrue (helper.Exists ($"assemblies/{abi}/{assemblyName}.dll"), $"{assemblyName}.dll should exist in apk!"); @@ -297,7 +296,7 @@ public void RemoveDesigner ([Values (true, false)] bool useAssemblyStore) } [Test] - public void LinkDescription ([Values (true, false)] bool useAssemblyStore) + public void LinkDescription () { string assembly_name = "System.Console"; string linker_xml = ""; @@ -312,7 +311,6 @@ public void LinkDescription ([Values (true, false)] bool useAssemblyStore) }; // So we can use Mono.Cecil to open assemblies directly proj.SetProperty ("AndroidEnableAssemblyCompression", "False"); - proj.SetProperty ("AndroidUseAssemblyStore", useAssemblyStore.ToString ()); using (var b = CreateApkBuilder ()) { Assert.IsTrue (b.Build (proj), "first build should have succeeded."); @@ -331,7 +329,7 @@ public void LinkDescription ([Values (true, false)] bool useAssemblyStore) var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk"); FileAssert.Exists (apk); - var helper = new ArchiveAssemblyHelper (apk, useAssemblyStore); + var helper = new ArchiveAssemblyHelper (apk); foreach (string abi in proj.GetRuntimeIdentifiersAsAbis ()) { Assert.IsTrue (helper.Exists ($"assemblies/{abi}/{assembly_name}.dll"), $"{assembly_name}.dll should exist in apk!"); } diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ArchiveAssemblyHelper.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ArchiveAssemblyHelper.cs index 73541abf637..664ad0a3ff1 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ArchiveAssemblyHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/ArchiveAssemblyHelper.cs @@ -27,20 +27,18 @@ public class ArchiveAssemblyHelper readonly string archivePath; readonly string assembliesRootDir; - bool useAssemblyStores; bool haveMultipleRids; List archiveContents; public string ArchivePath => archivePath; - public ArchiveAssemblyHelper (string archivePath, bool useAssemblyStores = true, string[] rids = null) + public ArchiveAssemblyHelper (string archivePath, string[] rids = null) { if (String.IsNullOrEmpty (archivePath)) { throw new ArgumentException ("must not be null or empty", nameof (archivePath)); } this.archivePath = archivePath; - this.useAssemblyStores = useAssemblyStores; haveMultipleRids = rids != null && rids.Length > 1; string extension = Path.GetExtension (archivePath) ?? String.Empty; @@ -57,13 +55,7 @@ public ArchiveAssemblyHelper (string archivePath, bool useAssemblyStores = true, public Stream? ReadEntry (string path, AndroidTargetArch arch = AndroidTargetArch.None, bool uncompressIfNecessary = false) { - Stream? ret; - if (useAssemblyStores) { - ret = ReadStoreEntry (path, arch, uncompressIfNecessary); - } else { - ret = ReadZipEntry (path, arch, uncompressIfNecessary); - } - + Stream? ret = ReadStoreEntry (path, arch, uncompressIfNecessary); if (ret == null) { return null; } @@ -117,29 +109,6 @@ public ArchiveAssemblyHelper (string archivePath, bool useAssemblyStores = true, return payload; } - Stream? ReadZipEntry (string path, AndroidTargetArch arch, bool uncompressIfNecessary) - { - List? potentialEntries = TransformArchiveAssemblyPath (path, arch); - if (potentialEntries == null || potentialEntries.Count == 0) { - return null; - } - - using var zip = ZipHelper.OpenZip (archivePath); - foreach (string assemblyPath in potentialEntries) { - if (!zip.ContainsEntry (assemblyPath)) { - continue; - } - - ZipEntry entry = zip.ReadEntry (assemblyPath); - var ret = new MemoryStream (); - entry.Extract (ret); - ret.Flush (); - return ret; - } - - return null; - } - Stream? ReadStoreEntry (string path, AndroidTargetArch arch, bool uncompressIfNecessary) { string name = Path.GetFileNameWithoutExtension (path); @@ -199,11 +168,6 @@ public List ListArchiveContents (string storeEntryPrefix = DefaultAssemb } archiveContents = entries; - if (!useAssemblyStores) { - Console.WriteLine ("Not using assembly stores"); - return entries; - } - Console.WriteLine ($"Creating AssemblyStoreExplorer for archive '{archivePath}'"); (IList? explorers, string? errorMessage) = AssemblyStoreExplorer.Open (archivePath); @@ -448,11 +412,7 @@ public void Contains (ICollection fileNames, out List existingFi throw new ArgumentException ("must not be empty", nameof (fileNames)); } - if (useAssemblyStores) { - StoreContains (fileNames, out existingFiles, out missingFiles, out additionalFiles, targetArches); - } else { - ArchiveContains (fileNames, out existingFiles, out missingFiles, out additionalFiles, targetArches); - } + StoreContains (fileNames, out existingFiles, out missingFiles, out additionalFiles, targetArches); } List GetSupportedArches (IEnumerable? runtimeIdentifiers) diff --git a/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs b/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs index 7f5229a514f..570f2325676 100644 --- a/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs +++ b/tests/MSBuildDeviceIntegration/Tests/BundleToolTests.cs @@ -10,22 +10,15 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] - [TestFixtureSource(nameof(FixtureArgs))] [Category ("XamarinBuildDownload")] public class BundleToolTests : DeviceTest { - static readonly object[] FixtureArgs = { - new object[] { false }, - new object[] { true }, - }; - static readonly string [] Abis = new [] { "armeabi-v7a", "arm64-v8a", "x86", "x86_64" }; XamarinAndroidLibraryProject lib; XamarinAndroidApplicationProject app; ProjectBuilder libBuilder, appBuilder; string intermediate; string bin; - bool usesAssemblyBlobs; // Disable split by language const string BuildConfig = @"{ @@ -46,11 +39,6 @@ public class BundleToolTests : DeviceTest } }"; - public BundleToolTests (bool usesAssemblyBlobs) - { - this.usesAssemblyBlobs = usesAssemblyBlobs; - } - [OneTimeSetUp] public void OneTimeSetUp () { @@ -68,8 +56,6 @@ public void OneTimeSetUp () } }; - lib.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ()); - var bytes = new byte [1024]; app = new XamarinFormsMapsApplicationProject { IsRelease = true, @@ -96,7 +82,6 @@ public void OneTimeSetUp () app.SetProperty (app.ReleaseProperties, "AndroidPackageFormat", "aab"); app.SetAndroidSupportedAbis (Abis); app.SetProperty ("AndroidBundleConfigurationFile", "buildConfig.json"); - app.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ()); libBuilder = CreateDllBuilder (Path.Combine (path, lib.ProjectName), cleanupOnDispose: true); Assert.IsTrue (libBuilder.Build (lib), "Library build should have succeeded."); @@ -127,9 +112,9 @@ public void OneTimeTearDown () appBuilder?.Dispose (); } - string [] ListArchiveContents (string archive, bool usesAssembliesBlob) + string [] ListArchiveContents (string archive) { - var helper = new ArchiveAssemblyHelper (archive, usesAssembliesBlob); + var helper = new ArchiveAssemblyHelper (archive); List entries = helper.ListArchiveContents (); entries.Sort (); return entries.ToArray (); @@ -139,7 +124,7 @@ string [] ListArchiveContents (string archive, bool usesAssembliesBlob) public void BaseZip () { var baseZip = Path.Combine (intermediate, "android", "bin", "base.zip"); - var contents = ListArchiveContents (baseZip, usesAssemblyBlobs); + var contents = ListArchiveContents (baseZip); var expectedFiles = new List { "dex/classes.dex", "manifest/AndroidManifest.xml", @@ -162,28 +147,17 @@ public void BaseZip () foreach (var abi in Abis) { // All assemblies are in per-abi directories now - if (usesAssemblyBlobs) { - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Java.Interop.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Mono.Android.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Localization.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib-es-Localization.resources.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_UnnamedProject.dll.so"); - } else { - expectedFiles.Add ($"lib/{abi}/lib_Java.Interop.dll.so"); - expectedFiles.Add ($"lib/{abi}/lib_Mono.Android.dll.so"); - expectedFiles.Add ($"lib/{abi}/lib_Localization.dll.so"); - expectedFiles.Add ($"lib/{abi}/lib-es-Localization.resources.dll.so"); - expectedFiles.Add ($"lib/{abi}/lib_UnnamedProject.dll.so"); - } + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Java.Interop.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Mono.Android.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Localization.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib-es-Localization.resources.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_UnnamedProject.dll.so"); expectedFiles.Add ($"lib/{abi}/libmonodroid.so"); expectedFiles.Add ($"lib/{abi}/libmonosgen-2.0.so"); expectedFiles.Add ($"lib/{abi}/libxamarin-app.so"); - if (usesAssemblyBlobs) { - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_System.Private.CoreLib.dll.so"); - } else { - expectedFiles.Add ($"lib/{abi}/lib_System.Private.CoreLib.dll.so"); - } + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_System.Private.CoreLib.dll.so"); + expectedFiles.Add ($"lib/{abi}/libSystem.IO.Compression.Native.so"); expectedFiles.Add ($"lib/{abi}/libSystem.Native.so"); } @@ -197,7 +171,7 @@ public void AppBundle () { var aab = Path.Combine (intermediate, "android", "bin", $"{app.PackageName}.aab"); FileAssert.Exists (aab); - var contents = ListArchiveContents (aab, usesAssemblyBlobs); + var contents = ListArchiveContents (aab); var expectedFiles = new List { "base/dex/classes.dex", "base/manifest/AndroidManifest.xml", @@ -222,28 +196,17 @@ public void AppBundle () foreach (var abi in Abis) { // All assemblies are in per-abi directories now - if (usesAssemblyBlobs) { - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Java.Interop.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Mono.Android.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Localization.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib-es-Localization.resources.dll.so"); - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_UnnamedProject.dll.so"); - } else { - expectedFiles.Add ($"base/lib/{abi}/lib_Java.Interop.dll.so"); - expectedFiles.Add ($"base/lib/{abi}/lib_Mono.Android.dll.so"); - expectedFiles.Add ($"base/lib/{abi}/lib_Localization.dll.so"); - expectedFiles.Add ($"base/lib/{abi}/lib-es-Localization.resources.dll.so"); - expectedFiles.Add ($"base/lib/{abi}/lib_UnnamedProject.dll.so"); - } + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Java.Interop.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Mono.Android.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_Localization.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib-es-Localization.resources.dll.so"); + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_UnnamedProject.dll.so"); expectedFiles.Add ($"base/lib/{abi}/libmonodroid.so"); expectedFiles.Add ($"base/lib/{abi}/libmonosgen-2.0.so"); expectedFiles.Add ($"base/lib/{abi}/libxamarin-app.so"); - if (usesAssemblyBlobs) { - expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_System.Private.CoreLib.dll.so"); - } else { - expectedFiles.Add ($"base/lib/{abi}/lib_System.Private.CoreLib.dll.so"); - } + expectedFiles.Add ($"{blobEntryPrefix}{abi}/lib_System.Private.CoreLib.dll.so"); + expectedFiles.Add ($"base/lib/{abi}/libSystem.IO.Compression.Native.so"); expectedFiles.Add ($"base/lib/{abi}/libSystem.Native.so"); } @@ -257,7 +220,7 @@ public void AppBundleSigned () { var aab = Path.Combine (bin, $"{app.PackageName}-Signed.aab"); FileAssert.Exists (aab); - var contents = ListArchiveContents (aab, usesAssembliesBlob: false); + var contents = ListArchiveContents (aab); Assert.IsTrue (StringAssertEx.ContainsText (contents, "META-INF/MANIFEST.MF"), $"{aab} is not signed!"); } @@ -271,11 +234,11 @@ public void ApkSet () FileAssert.Exists (aab); // Expecting: splits/base-arm64_v8a.apk, splits/base-master.apk, splits/base-xxxhdpi.apk // This are split up based on: abi, base, and dpi - var contents = ListArchiveContents (aab, usesAssembliesBlob: false).Where (a => a.EndsWith (".apk", StringComparison.OrdinalIgnoreCase)).ToArray (); + var contents = ListArchiveContents (aab).Where (a => a.EndsWith (".apk", StringComparison.OrdinalIgnoreCase)).ToArray (); Assert.AreEqual (3, contents.Length, "Expecting three APKs!"); // Language split has been removed by the bundle configuration file, and therefore shouldn't be present - var languageSplitContent = ListArchiveContents (aab, usesAssemblyBlobs).Where (a => a.EndsWith ("-en.apk", StringComparison.OrdinalIgnoreCase)).ToArray (); + var languageSplitContent = ListArchiveContents (aab).Where (a => a.EndsWith ("-en.apk", StringComparison.OrdinalIgnoreCase)).ToArray (); Assert.AreEqual (0, languageSplitContent.Length, "Found language split apk in bundle, but disabled by bundle configuration file!"); using (var stream = new MemoryStream ()) @@ -289,13 +252,9 @@ public void ApkSet () ".bar", ".wav", ".data", + ".blob", }; - if (usesAssemblyBlobs) { - uncompressed.Add (".blob"); - } else { - uncompressed.Add (".dll"); - } using (var baseApk = ZipArchive.Open (stream)) { foreach (var file in baseApk) { foreach (var ext in uncompressed) { diff --git a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj index 6d3fbc7f627..5be74cdf706 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj @@ -19,7 +19,6 @@ armeabi-v7a;x86 arm64-v8a;x86 True - False true <_AndroidCheckedBuild Condition=" '$(UseASAN)' != '' ">asan <_AndroidCheckedBuild Condition=" '$(UseUBSAN)' != '' ">ubsan