diff --git a/Configuration.props b/Configuration.props index 447a8fda27f..c0845f0c472 100644 --- a/Configuration.props +++ b/Configuration.props @@ -155,8 +155,7 @@ $([System.IO.Path]::PathSeparator) <_TestsAotName Condition=" '$(AotAssemblies)' == 'true' ">-Aot <_TestsProfiledAotName Condition=" '$(AndroidEnableProfiledAot)' == 'true' ">-Profiled - <_TestsBundleName Condition=" '$(BundleAssemblies)' == 'true' ">-Bundle - $(_TestsProfiledAotName)$(_TestsAotName)$(_TestsBundleName) + $(_TestsProfiledAotName)$(_TestsAotName) i686-w64-mingw32 diff --git a/Documentation/guides/messages/README.md b/Documentation/guides/messages/README.md index c32d917a755..235d1d866f9 100644 --- a/Documentation/guides/messages/README.md +++ b/Documentation/guides/messages/README.md @@ -134,6 +134,7 @@ or 'Help->Report a Problem' in Visual Studio for Mac. + [XA1031](xa1031.md): The 'AndroidHttpClientHandlerType' has an invalid value. + [XA1032](xa1032.md):Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting. + [XA1033](xa1033.md): Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting. ++ [XA1035](xa1035.md): The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties. ## XA2xxx: Linker diff --git a/Documentation/guides/messages/xa1035.md b/Documentation/guides/messages/xa1035.md new file mode 100644 index 00000000000..0f5299a2288 --- /dev/null +++ b/Documentation/guides/messages/xa1035.md @@ -0,0 +1,19 @@ +--- +title: Xamarin.Android warning XA1035 +description: XA1034 warning code +ms.date: 13/12/2022 +--- +# Xamarin.Android warning XA1035 + +## Example messages + +``` +The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties. +``` + +## Solution + +Edit your csproj directly and remove the 'BundleAssemblies' property. +`AndroidUseAssemblyStore` and `AndroidEnableAssemblyCompression` are +both enabled by default and, together, they implement behavior +equivalent to that of `BundleAssemblies`. diff --git a/Xamarin.Android-Tests.sln b/Xamarin.Android-Tests.sln index 0b732d451e6..d32380afde2 100644 --- a/Xamarin.Android-Tests.sln +++ b/Xamarin.Android-Tests.sln @@ -34,10 +34,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.FixJavaAbst EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.JcwGen-Tests", "tests\CodeGen-Binding\Xamarin.Android.JcwGen-Tests\Xamarin.Android.JcwGen-Tests.csproj", "{9479B71F-19FE-48F9-AB3F-AE764D76038A}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeGen-MkBundle", "CodeGen-MkBundle", "{93CBCEB8-8B64-420C-950C-BCE9CC8C6032}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.MakeBundle-Tests", "tests\CodeGen-MkBundle\Xamarin.Android.MakeBundle-Tests\Xamarin.Android.MakeBundle-Tests.csproj", "{A0B2692E-9FBE-4157-9526-7145F07F2C5A}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ResolveImports", "ResolveImports", "{E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.BindingResolveImportLib1", "tests\ResolveImports\Xamarin.Android.BindingResolveImportLib1\Xamarin.Android.BindingResolveImportLib1.csproj", "{2A0519DF-0DDA-45F7-AC3C-E2992748D364}" @@ -151,10 +147,6 @@ Global {9479B71F-19FE-48F9-AB3F-AE764D76038A}.Debug|Any CPU.Build.0 = Debug|Any CPU {9479B71F-19FE-48F9-AB3F-AE764D76038A}.Release|Any CPU.ActiveCfg = Release|Any CPU {9479B71F-19FE-48F9-AB3F-AE764D76038A}.Release|Any CPU.Build.0 = Release|Any CPU - {A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Release|Any CPU.Build.0 = Release|Any CPU {2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -269,7 +261,6 @@ Global {7B9D9F32-973F-49CF-A8F8-05BDFC75556C} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4} {B7476528-C166-40BF-931F-EAEB02247879} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4} {9479B71F-19FE-48F9-AB3F-AE764D76038A} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4} - {A0B2692E-9FBE-4157-9526-7145F07F2C5A} = {93CBCEB8-8B64-420C-950C-BCE9CC8C6032} {2A0519DF-0DDA-45F7-AC3C-E2992748D364} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9} {DD4E2A49-730C-41FD-B6D4-AFB73F94271F} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9} {9802CB35-0BC0-4EE1-9A81-BB40BD97945A} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9} diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 33a502ee5af..6e7fa3f3b5c 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -219,17 +219,6 @@ stages: artifactFolder: Profiled-Aot useDotNet: false - - template: yaml-templates/apk-instrumentation.yaml - parameters: - configuration: $(ApkTestConfiguration) - testName: Xamarin.Forms-Performance-Integration-Bundle - project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj - testResultsFiles: TestResult-apkdiff-Xamarin.Forms_Performance_Integration-Signed-$(ApkTestConfiguration)-Bundle.xml - extraBuildArgs: /p:BundleAssemblies=true - artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk - artifactFolder: Bundle - useDotNet: false - - template: yaml-templates/apk-instrumentation.yaml parameters: configuration: $(ApkTestConfiguration) @@ -652,7 +641,7 @@ stages: nunit_categories: $(DotNetNUnitCategories) & TestCategory != SmokeTests target_framework: $(DotNetStableTargetFramework) provisionatorChannel: ${{ parameters.provisionatorChannel }} - + - template: yaml-templates/stage-msbuild-emulator-tests.yaml parameters: provisionatorChannel: ${{ parameters.provisionatorChannel }} diff --git a/build-tools/installers/create-installers.targets b/build-tools/installers/create-installers.targets index d8880a6ab2f..fda16d71564 100644 --- a/build-tools/installers/create-installers.targets +++ b/build-tools/installers/create-installers.targets @@ -248,7 +248,6 @@ <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Microsoft.Android.Build.BaseTasks.pdb" /> <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle.exe" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle.pdb" ExcludeFromAndroidNETSdk="true" /> - <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle-api.h" /> <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mono-symbolicate.exe" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mono-symbolicate.pdb" ExcludeFromAndroidNETSdk="true" /> <_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.CompilerServices.SymbolWriter.dll" /> diff --git a/build-tools/scripts/RunTests.targets b/build-tools/scripts/RunTests.targets index 2ba159f9e9c..5445dab3a85 100644 --- a/build-tools/scripts/RunTests.targets +++ b/build-tools/scripts/RunTests.targets @@ -159,22 +159,6 @@ Condition=" '$(_CrossCompilerAvailable)' == 'True' " Properties="AndroidEnableProfiledAot=True;AotAssemblies=True" /> - - <_ApkTestProjectBundle> - <_BinLog>$(_XABinLogPrefix)-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss"))-%(Filename)-Bundle.binlog" - - - - diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs b/build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs index 37ff297ba7e..e9ec7ff5f5d 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs @@ -16,16 +16,7 @@ protected override async Task Execute(Context context) var msbuild = new MSBuildRunner (context); string xfTestPath = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "tests", "Xamarin.Forms-Performance-Integration", "Xamarin.Forms.Performance.Integration.csproj"); - if (!await msbuild.Restore (projectPath: xfTestPath, logTag: "xfperf", binlogName: "prepare-local")) - return false; - - // The Xamarin.Forms PackageReference version varies based on the value of $(BundleAssemblies) - return await msbuild.Restore ( - projectPath: xfTestPath, - logTag: "xfperfbundle", - arguments: new List { "-p:BundleAssemblies=true" }, - binlogName: "prepare-local-bundle" - ); + return await msbuild.Restore (projectPath: xfTestPath, logTag: "xfperf", binlogName: "prepare-local"); } } } diff --git a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets index e3192db607f..13c502141e8 100644 --- a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets +++ b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets @@ -135,7 +135,6 @@ Copyright (C) 2016 Xamarin. All rights reserved. Debug="$(AndroidIncludeDebugSymbols)" AndroidSequencePointsMode="$(_SequencePointsMode)" EnableSGenConcurrent="$(AndroidEnableSGenConcurrent)" - IsBundledApplication="$(BundleAssemblies)" SupportedAbis="$(_BuildTargetAbis)" AndroidPackageName="$(_AndroidPackage)" EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)" diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx index f78a40c1314..d84bb10ce53 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx @@ -493,6 +493,10 @@ Please change the value to an assembly-qualifed type name which inherits from '{ The following are literal names and should not be translated: '_Microsoft.Android.Resource.Desinger', 'AndroidUseDesignerAssembly', 'true' {0} - The name of the assembly + + The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties. + The following are literal names and should not be translated: 'BundleAssemblies', 'AndroidUseAssemblyStore', 'AndroidEnableAssemblyCompression' + Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 6 and higher will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 6 is released. The following are literal names and should not be translated: AppDomain.CreateDomain(), AppDomain diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs index 28cca622f9b..e479b4ead3b 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs @@ -185,7 +185,7 @@ void ExecuteWithAbi (string [] supportedAbis, string apkInputPath, string apkOut AddFileToArchiveIfNewer (apk, dex.ItemSpec, DalvikPath + dexPath, compressionMethod: dexCompressionMethod); } - if (EmbedAssemblies && !BundleAssemblies) { + if (EmbedAssemblies) { AddAssemblies (apk, debug, compress, compressedAssembliesInfo, assemblyStoreApkName); apk.Flush (); } diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs b/src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs index f9616ef190d..f4d82569e36 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs @@ -53,9 +53,6 @@ public class GeneratePackageManagerJava : AndroidTask [Required] public string Manifest { get; set; } - [Required] - public bool IsBundledApplication { get; set; } - [Required] public string [] SupportedAbis { get; set; } @@ -373,7 +370,6 @@ void AddEnvironment () var appConfState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (ApplicationConfigTaskState.RegisterTaskObjectKey), RegisteredTaskObjectLifetime.Build); var jniRemappingNativeCodeInfo = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal (ProjectSpecificTaskObjectKey (GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfoKey), RegisteredTaskObjectLifetime.Build); var appConfigAsmGen = new ApplicationConfigNativeAssemblyGenerator (environmentVariables, systemProperties, Log) { - IsBundledApp = IsBundledApplication, UsesMonoAOT = usesMonoAOT, UsesMonoLLVM = EnableLLVM, UsesAssemblyPreload = environmentParser.UsesAssemblyPreload, diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs index a881d54de63..dc386e3dfa8 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AndroidDependenciesTests.cs @@ -56,7 +56,6 @@ public void InstallAndroidDependenciesTest () [TestCase ("AotAssemblies", false)] [TestCase ("AndroidEnableProfiledAot", false)] [TestCase ("EnableLLVM", true)] - [TestCase ("BundleAssemblies", true)] public void GetDependencyNdkRequiredConditions (string property, bool ndkRequired) { var proj = new XamarinAndroidApplicationProject (); 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 3f2ee58ed3a..4244e4c8529 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 @@ -144,9 +144,7 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile () AotAssemblies = true, PackageName = "com.xamarin.buildaotappwithspecialchars", }; - if (!Builder.UseDotNet) { - proj.BundleAssemblies = true; - } + proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath); proj.SetAndroidSupportedAbis (supportedAbis); proj.SetProperty ("EnableLLVM", enableLLVM.ToString ()); @@ -194,12 +192,7 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile () proj.OutputPath, $"{proj.PackageName}-Signed.apk"); var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs); - if (!Builder.UseDotNet) { - // BundleAssemblies=true - Assert.IsFalse (helper.Exists ("assemblies/UnnamedProject.dll"), $"UnnamedProject.dll should not be in the {proj.PackageName}-Signed.apk"); - } else { - Assert.IsTrue (helper.Exists ("assemblies/UnnamedProject.dll"), $"UnnamedProject.dll should be in the {proj.PackageName}-Signed.apk"); - } + Assert.IsTrue (helper.Exists ("assemblies/UnnamedProject.dll"), $"UnnamedProject.dll should be in the {proj.PackageName}-Signed.apk"); using (var zipFile = ZipHelper.OpenZip (apk)) { Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile, string.Format ("lib/{0}/libaot-UnnamedProject.dll.so", 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 f27fa07ca22..1ac9ed252bf 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 @@ -1101,63 +1101,6 @@ public void CSharp8Features ([Values (true, false)] bool bindingProject) } } - [Test] - [Category ("SmokeTests"), Category ("MkBundle")] - public void BuildMkBundleApplicationRelease () - { - var proj = new XamarinAndroidApplicationProject () { IsRelease = true, BundleAssemblies = true }; - proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath); - using (var b = CreateApkBuilder ("temp/BuildMkBundleApplicationRelease", false)) { - Assert.IsTrue (b.Build (proj), "Build should have succeeded."); - var assemblies = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, - "bundles", "armeabi-v7a", "assemblies.o"); - Assert.IsTrue (File.Exists (assemblies), "assemblies.o does not exist"); - var libapp = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, - "bundles", "armeabi-v7a", "libmonodroid_bundle_app.so"); - Assert.IsTrue (File.Exists (libapp), "libmonodroid_bundle_app.so does not exist"); - var apk = Path.Combine (Root, b.ProjectDirectory, - proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - using (var zipFile = ZipHelper.OpenZip (apk)) { - Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile, - "lib/armeabi-v7a/libmonodroid_bundle_app.so"), - $"lib/armeabi-v7a/libmonodroid_bundle_app.so should be in the {proj.PackageName}-Signed.apk"); - Assert.IsNull (ZipHelper.ReadFileFromZip (zipFile, - Path.Combine ("assemblies", "UnnamedProject.dll")), - $"UnnamedProject.dll should not be in the {proj.PackageName}-Signed.apk"); - } - } - } - - [Test] - [Category ("Minor"), Category ("MkBundle")] - public void BuildMkBundleApplicationReleaseAllAbi () - { - var proj = new XamarinAndroidApplicationProject () { IsRelease = true, BundleAssemblies = true }; - proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath); - proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86"); - using (var b = CreateApkBuilder ("temp/BuildMkBundleApplicationReleaseAllAbi", false)) { - Assert.IsTrue (b.Build (proj), "Build should have succeeded."); - foreach (var abi in new string [] { "armeabi-v7a", "x86" }) { - var assemblies = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, - "bundles", abi, "assemblies.o"); - Assert.IsTrue (File.Exists (assemblies), abi + " assemblies.o does not exist"); - var libapp = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, - "bundles", abi, "libmonodroid_bundle_app.so"); - Assert.IsTrue (File.Exists (libapp), abi + " libmonodroid_bundle_app.so does not exist"); - var apk = Path.Combine (Root, b.ProjectDirectory, - proj.OutputPath, $"{proj.PackageName}-Signed.apk"); - using (var zipFile = ZipHelper.OpenZip (apk)) { - Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile, - "lib/" + abi + "/libmonodroid_bundle_app.so"), - $"lib/{0}/libmonodroid_bundle_app.so should be in the {proj.PackageName}-Signed.apk", abi); - Assert.IsNull (ZipHelper.ReadFileFromZip (zipFile, - Path.Combine ("assemblies", "UnnamedProject.dll")), - $"UnnamedProject.dll should not be in the {proj.PackageName}-Signed.apk"); - } - } - } - } - static readonly object [] BuildProguardEnabledProjectSource = new object [] { new object [] { /* isRelease */ false, 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 ae7e039c1a7..d8ab6b85c6a 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 @@ -1093,7 +1093,6 @@ public void BuildIncrementalAot (string supportedAbis, string androidAotMode, bo var path = Path.Combine ("temp", $"BuildAotApplication_{supportedAbis}_{androidAotMode}_{aotAssemblies}_{expectedResult}"); var proj = new XamarinAndroidApplicationProject () { IsRelease = true, - BundleAssemblies = false, AotAssemblies = aotAssemblies, }; if (aotAssemblies) { diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MakeBundleTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MakeBundleTests.cs deleted file mode 100644 index 3ddb6596501..00000000000 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/MakeBundleTests.cs +++ /dev/null @@ -1,320 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Xml; -using System.Xml.XPath; - -using Microsoft.Build.Framework; -using NUnit.Framework; -using Xamarin.ProjectTools; -using Xamarin.Tools.Zip; - -namespace Xamarin.Android.Build.Tests -{ - [Category ("Node-2"), Category ("MkBundle"), Category ("StaticProject")] - [Parallelizable (ParallelScope.Children)] - public class MakeBundleTests : BaseTest - { - sealed class LocalBuilder : Builder - { - public LocalBuilder () - { - BuildingInsideVisualStudio = false; - } - - public bool Build (string projectOrSolution, string target, string[] parameters = null, Dictionary environmentVariables = null) - { - return BuildInternal (projectOrSolution, target, parameters, environmentVariables); - } - } - - const string ProjectName = "Xamarin.Android.MakeBundle-Tests"; - const string ProjectAssemblyName = "Xamarin.Android.MakeBundle-Tests"; - const string ProjectPackageName = "Xamarin.Android.MakeBundle_Tests"; - - static readonly string hostArch = TestEnvironment.IsWindows ? "windows-x86_64" : (TestEnvironment.IsMacOS ? "darwin-x86_64" : "linux-x86_64"); - static readonly string executableExtension = TestEnvironment.IsWindows ? ".exe" : string.Empty; - static readonly string LlvmReadobj = Path.Combine (AndroidSdkResolver.GetAndroidNdkPath(), "toolchains", "llvm", "prebuilt", hostArch, "bin", $"llvm-readobj{executableExtension}"); - static readonly string GccReadelf = Path.Combine (AndroidSdkResolver.GetAndroidNdkPath (), "toolchains", "x86_64-4.9", "prebuilt", hostArch, "bin", $"x86_64-linux-android-readelf{executableExtension}"); - - static readonly char[] ElfDynamicFieldSep = new [] { ' ', '\t' }; - static readonly string TestProjectRootDirectory; - static readonly string TestOutputDir; - - static readonly List produced_binaries = new List { - $"{ProjectAssemblyName}.dll", - $"{ProjectPackageName}-Signed.apk", - $"{ProjectPackageName}.apk", - }; - - static readonly List log_files = new List { - "process.log", - "msbuild.binlog", - }; - - static readonly string[] bundles = new [] { - "lib/x86/libmonodroid_bundle_app.so", - "lib/armeabi-v7a/libmonodroid_bundle_app.so", - }; - - string elfReaderPath; - bool elfReaderLlvm; - string testProjectPath; - string apk; - - static MakeBundleTests () - { - TestProjectRootDirectory = Path.GetFullPath (Path.Combine (XABuildPaths.TopDirectory, "tests", "CodeGen-MkBundle", "Xamarin.Android.MakeBundle-Tests")); - TestOutputDir = Path.Combine (SetUp.TestDirectoryRoot, "temp", "CodeGen-MkBundle"); - } - - [OneTimeSetUp] - public void BuildProject () - { - if (File.Exists (LlvmReadobj)) { - elfReaderPath = LlvmReadobj; - elfReaderLlvm = true; - } else if (File.Exists (GccReadelf)) { - elfReaderPath = GccReadelf; - elfReaderLlvm = false; - } else - Assert.Fail ($"No ELF reader found. Tried '{LlvmReadobj}' and '{GccReadelf}'"); - - Console.WriteLine ($"Will use the following ELF reader: {elfReaderPath}"); - - testProjectPath = PrepareProject (ProjectName); - apk = Path.Combine (testProjectPath, "bin", XABuildPaths.Configuration, $"{ProjectPackageName}-Signed.apk"); - string projectPath = Path.Combine (testProjectPath, $"{ProjectName}.csproj"); - LocalBuilder builder = GetBuilder ("Xamarin.Android.MakeBundle-Tests"); - bool success = builder.Build (projectPath, "SignAndroidPackage", new [] { "UnitTestsMode=true", $"Configuration={XABuildPaths.Configuration}" }); - - Assert.That (success, Is.True, "Should have been built"); - } - - [OneTimeTearDown] - public void CleanUp () - { - if (TestContext.CurrentContext.Result.FailCount == 0) { - FileSystemUtils.SetDirectoryWriteable (TestOutputDir); - Directory.Delete (TestOutputDir, recursive: true); - } - } - - [Test] - public void BinariesExist () - { - foreach (string binary in produced_binaries) { - string fp = Path.Combine (testProjectPath, "bin", XABuildPaths.Configuration, binary); - - Assert.That (new FileInfo (fp), Does.Exist, $"File {fp} should exist"); - } - } - - [Test] - public void PackageIsBundled () - { - Assert.That (new FileInfo (apk), Does.Exist, $"File {apk} should exist"); - - using (ZipArchive zip = ZipArchive.Open (apk, FileMode.Open)) { - Assert.That (zip, Is.Not.Null, $"{apk} couldn't be opened as a zip archive"); - - foreach (string bundle in bundles) { - Assert.That (zip.ContainsEntry (bundle), Is.True, $"`{bundle}` file not found in {apk}"); - } - } - } - - [Test] - public void BundleHasSoname () - { - Assert.That (new FileInfo (apk), Does.Exist, $"File {apk} should exist"); - - using (ZipArchive zip = ZipArchive.Open (apk, FileMode.Open)) { - Assert.That (zip, Is.Not.Null, $"{apk} couldn't be opened as a zip archive"); - - foreach (string bundle in bundles) { - Assert.That (zip.ContainsEntry (bundle), Is.True, $"`{bundle}` file not found in {apk}"); - CheckBundleForSoname (zip, bundle); - } - } - } - - void CheckBundleForSoname (ZipArchive zip, string bundlePath) - { - string tempFile = Path.GetTempFileName (); - using (Stream fs = File.Open (tempFile, FileMode.Create)) { - ZipEntry entry = zip.FirstOrDefault (e => String.Compare (e.FullName, bundlePath, StringComparison.Ordinal) == 0); - Assert.That (entry, Is.Not.Null, $"Unable to open the `{bundlePath}` entry in {apk}"); - - entry.Extract (fs); - } - - var stdout = new List (); - string arguments; - string sonameField; - - if (elfReaderLlvm) { - arguments = "--dynamic-table"; - sonameField = "SONAME"; - } else { - arguments = "-d"; - sonameField = "(SONAME)"; - } - bool success; - - try { - Console.WriteLine ($"Checking bundle {bundlePath} in {tempFile}"); - success = RunCommand (elfReaderPath, $"{arguments} \"{tempFile}\"", stdout); - } finally { - File.Delete (tempFile); - } - - Assert.That (success, Is.True, $"Command {elfReaderPath} failed"); - - string soname = null; - foreach (string l in stdout) { - string line = l?.Trim (); - if (String.IsNullOrEmpty (line)) - continue; - - string[] parts = line.Split (ElfDynamicFieldSep, StringSplitOptions.RemoveEmptyEntries); - if (parts.Length < 3) - continue; - - if (String.Compare (sonameField, parts [1], StringComparison.Ordinal) != 0) - continue; - - if (parts.Length > 3) - soname = String.Join (" ", parts, 3, parts.Length - 3); - else - soname = String.Empty; - break; - } - - const string expectedSoname = "libmonodroid_bundle_app.so"; - Assert.That (soname, Is.Not.Null, $"Bundle {bundlePath} doesn't have DT_SONAME in ELF header"); - Assert.That (soname.Length, Is.GreaterThanOrEqualTo (0), $"Unknown DT_SONAME field format in {bundlePath}"); - Assert.That (soname.IndexOf (expectedSoname, StringComparison.Ordinal), Is.GreaterThanOrEqualTo (0), $"Unexpected bundle {bundlePath} SONAME (expected {expectedSoname}"); - } - - bool RunCommand (string command, string arguments, List stdout) - { - var psi = new ProcessStartInfo () { - FileName = command, - Arguments = arguments, - UseShellExecute = false, - RedirectStandardInput = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - CreateNoWindow = true, - WindowStyle = ProcessWindowStyle.Hidden, - }; - - var stderr_completed = new ManualResetEvent (false); - var stdout_completed = new ManualResetEvent (false); - - var p = new Process () { - StartInfo = psi, - }; - - p.ErrorDataReceived += (sender, e) => { - if (e.Data == null) - stderr_completed.Set (); - else - Console.WriteLine ($"stderr: {e.Data}"); - }; - - p.OutputDataReceived += (sender, e) => { - if (e.Data == null) - stdout_completed.Set (); - else { - stdout.Add (e.Data); - Console.WriteLine ($"stdout: {e.Data}"); - } - }; - - using (p) { - p.StartInfo = psi; - p.Start (); - p.BeginOutputReadLine (); - p.BeginErrorReadLine (); - - bool success = p.WaitForExit (60000); - - // We need to call the parameter-less WaitForExit only if any of the standard - // streams have been redirected (see - // https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.waitforexit?view=netframework-4.7.2#System_Diagnostics_Process_WaitForExit) - // - p.WaitForExit (); - stderr_completed.WaitOne (TimeSpan.FromSeconds (60)); - stdout_completed.WaitOne (TimeSpan.FromSeconds (60)); - - if (!success || p.ExitCode != 0) { - Console.Error.WriteLine ($"Process `{command} {arguments}` exited with value {p.ExitCode}."); - return false; - } - - return true; - } - } - - string PrepareProject (string testName) - { - string tempRoot = Path.Combine (TestOutputDir, $"{testName}.build", XABuildPaths.Configuration); - string temporaryProjectPath = Path.Combine (tempRoot, "project"); - - var ignore = new HashSet { - Path.Combine (TestProjectRootDirectory, "bin"), - Path.Combine (TestProjectRootDirectory, "obj"), - }; - - CopyRecursively (TestProjectRootDirectory, temporaryProjectPath, ignore); - return temporaryProjectPath; - } - - void CopyRecursively (string fromDir, string toDir, HashSet ignoreDirs) - { - if (String.IsNullOrEmpty (fromDir)) - throw new ArgumentException ($"{nameof (fromDir)} is must have a non-empty value"); - if (String.IsNullOrEmpty (toDir)) - throw new ArgumentException ($"{nameof (toDir)} is must have a non-empty value"); - - if (ignoreDirs.Contains (fromDir)) - return; - - var fdi = new DirectoryInfo (fromDir); - if (!fdi.Exists) - throw new InvalidOperationException ($"Source directory '{fromDir}' does not exist"); - - if (Directory.Exists (toDir)) - Directory.Delete (toDir, true); - - foreach (FileSystemInfo fsi in fdi.EnumerateFileSystemInfos ("*", SearchOption.TopDirectoryOnly)) { - if (fsi is FileInfo finfo) - CopyFile (fsi.FullName, Path.Combine (toDir, finfo.Name)); - else - CopyRecursively (fsi.FullName, Path.Combine (toDir, fsi.Name), ignoreDirs); - } - } - - void CopyFile (string from, string to) - { - string dir = Path.GetDirectoryName (to); - if (!Directory.Exists (dir)) - Directory.CreateDirectory (dir); - File.Copy (from, to, true); - } - - LocalBuilder GetBuilder (string baseLogFileName) - { - return new LocalBuilder { - BuildLogFile = $"{baseLogFileName}.log" - }; - } - } -} diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GeneratePackageManagerJavaTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GeneratePackageManagerJavaTests.cs index 71d686ddabf..416e3598350 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GeneratePackageManagerJavaTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/GeneratePackageManagerJavaTests.cs @@ -74,7 +74,6 @@ public void CheckPackageManagerAssemblyOrder (string[] resolvedUserAssemblies, s MainAssembly = "linked/HelloAndroid.dll", TargetFrameworkVersion = "v6.0", Manifest = Path.Combine (path, "AndroidManifest.xml"), - IsBundledApplication = false, SupportedAbis = new string [] { "x86" , "arm64-v8a" }, AndroidPackageName = "com.microsoft.net6.helloandroid", EnablePreloadAssembliesDefault = false, diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs index c3c30ebae39..5b79d0e8309 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/EnvironmentHelper.cs @@ -43,7 +43,6 @@ public sealed class ApplicationConfig public bool uses_mono_aot; public bool aot_lazy_load; public bool uses_assembly_preload; - public bool is_a_bundled_app; public bool broken_exception_transitions; public bool instant_run_enabled; public bool jni_add_native_method_registration_attribute_present; @@ -67,7 +66,7 @@ public sealed class ApplicationConfig public string android_package_name = String.Empty; } - const uint ApplicationConfigFieldCount = 26; + const uint ApplicationConfigFieldCount = 25; const string ApplicationConfigSymbolName = "application_config"; const string AppEnvironmentVariablesSymbolName = "app_environment_variables"; @@ -226,112 +225,107 @@ static ApplicationConfig ReadApplicationConfig (EnvironmentFile envFile) ret.uses_assembly_preload = ConvertFieldToBool ("uses_assembly_preload", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 4: // is_a_bundled_app: bool / .byte - AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); - ret.is_a_bundled_app = ConvertFieldToBool ("is_a_bundled_app", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); - break; - - case 5: // broken_exception_transitions: bool / .byte + case 4: // broken_exception_transitions: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.broken_exception_transitions = ConvertFieldToBool ("broken_exception_transitions", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 6: // instant_run_enabled: bool / .byte + case 5: // instant_run_enabled: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.instant_run_enabled = ConvertFieldToBool ("instant_run_enabled", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 7: // jni_add_native_method_registration_attribute_present: bool / .byte + case 6: // jni_add_native_method_registration_attribute_present: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.jni_add_native_method_registration_attribute_present = ConvertFieldToBool ("jni_add_native_method_registration_attribute_present", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 8: // have_runtime_config_blob: bool / .byte + case 7: // have_runtime_config_blob: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.have_runtime_config_blob = ConvertFieldToBool ("have_runtime_config_blob", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 9: // have_assemblies_blob: bool / .byte + case 8: // have_assemblies_blob: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.have_assemblies_blob = ConvertFieldToBool ("have_assemblies_blob", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 10: // marshal_methods_enabled: bool / .byte + case 9: // marshal_methods_enabled: bool / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.marshal_methods_enabled = ConvertFieldToBool ("marshal_methods_enabled", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 11: // bound_stream_io_exception_type: byte / .byte + case 10: // bound_stream_io_exception_type: byte / .byte AssertFieldType (envFile.Path, parser.SourceFilePath, ".byte", field [0], item.LineNumber); ret.bound_stream_io_exception_type = ConvertFieldToByte ("bound_stream_io_exception_type", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 12: // package_naming_policy: uint32_t / .word | .long + case 11: // package_naming_policy: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.package_naming_policy = ConvertFieldToUInt32 ("package_naming_policy", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 13: // environment_variable_count: uint32_t / .word | .long + case 12: // environment_variable_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.environment_variable_count = ConvertFieldToUInt32 ("environment_variable_count", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 14: // system_property_count: uint32_t / .word | .long + case 13: // system_property_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.system_property_count = ConvertFieldToUInt32 ("system_property_count", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 15: // number_of_assemblies_in_apk: uint32_t / .word | .long + case 14: // number_of_assemblies_in_apk: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_assemblies_in_apk = ConvertFieldToUInt32 ("number_of_assemblies_in_apk", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 16: // bundled_assembly_name_width: uint32_t / .word | .long + case 15: // bundled_assembly_name_width: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.bundled_assembly_name_width = ConvertFieldToUInt32 ("bundled_assembly_name_width", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 17: // number_of_assembly_store_files: uint32_t / .word | .long + case 16: // number_of_assembly_store_files: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_assembly_store_files = ConvertFieldToUInt32 ("number_of_assembly_store_files", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 18: // number_of_dso_cache_entries: uint32_t / .word | .long + case 17: // number_of_dso_cache_entries: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_dso_cache_entries = ConvertFieldToUInt32 ("number_of_dso_cache_entries", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 19: // android_runtime_jnienv_class_token: uint32_t / .word | .long + case 18: // android_runtime_jnienv_class_token: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_dso_cache_entries = ConvertFieldToUInt32 ("android_runtime_jnienv_class_token", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 20: // jnienv_initialize_method_token: uint32_t / .word | .long + case 19: // jnienv_initialize_method_token: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_dso_cache_entries = ConvertFieldToUInt32 ("jnienv_initialize_method_token", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 21: // jnienv_registerjninatives_method_token: uint32_t / .word | .long + case 20: // jnienv_registerjninatives_method_token: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.number_of_dso_cache_entries = ConvertFieldToUInt32 ("jnienv_registerjninatives_method_token", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 22: // jni_remapping_replacement_type_count: uint32_t / .word | .long + case 21: // jni_remapping_replacement_type_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.jni_remapping_replacement_type_count = ConvertFieldToUInt32 ("jni_remapping_replacement_type_count", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 23: // jni_remapping_replacement_method_index_entry_count: uint32_t / .word | .long + case 22: // jni_remapping_replacement_method_index_entry_count: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.jni_remapping_replacement_method_index_entry_count = ConvertFieldToUInt32 ("jni_remapping_replacement_method_index_entry_count", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 24: // mono_components_mask: uint32_t / .word | .long + case 23: // mono_components_mask: uint32_t / .word | .long Assert.IsTrue (expectedUInt32Types.Contains (field [0]), $"Unexpected uint32_t field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); ret.mono_components_mask = ConvertFieldToUInt32 ("mono_components_mask", envFile.Path, parser.SourceFilePath, item.LineNumber, field [1]); break; - case 25: // android_package_name: string / [pointer type] + case 24: // android_package_name: string / [pointer type] Assert.IsTrue (expectedPointerTypes.Contains (field [0]), $"Unexpected pointer field type in '{envFile.Path}:{item.LineNumber}': {field [0]}"); pointers.Add (field [1].Trim ()); break; @@ -434,7 +428,6 @@ static void AssertApplicationConfigIsIdentical (ApplicationConfig firstAppConfig { Assert.AreEqual (firstAppConfig.uses_mono_llvm, secondAppConfig.uses_mono_llvm, $"Field 'uses_mono_llvm' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); Assert.AreEqual (firstAppConfig.uses_mono_aot, secondAppConfig.uses_mono_aot, $"Field 'uses_mono_aot' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); - Assert.AreEqual (firstAppConfig.is_a_bundled_app, secondAppConfig.is_a_bundled_app, $"Field 'is_a_bundled_app' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); Assert.AreEqual (firstAppConfig.environment_variable_count, secondAppConfig.environment_variable_count, $"Field 'environment_variable_count' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); Assert.AreEqual (firstAppConfig.system_property_count, secondAppConfig.system_property_count, $"Field 'system_property_count' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); Assert.AreEqual (firstAppConfig.android_package_name, secondAppConfig.android_package_name, $"Field 'android_package_name' has different value in environment file '{secondEnvFile}' than in environment file '{firstEnvFile}'"); diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownProperties.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownProperties.cs index f59a3c9cc75..d8b7b63fa51 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownProperties.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownProperties.cs @@ -21,7 +21,6 @@ public static class KnownProperties public const string SupportedOSPlatformVersion = "SupportedOSPlatformVersion"; public const string Deterministic = "Deterministic"; - public const string BundleAssemblies = "BundleAssemblies"; public const string AndroidEnableDesugar = "AndroidEnableDesugar"; public const string AndroidManifestMerger = "AndroidManifestMerger"; public const string AndroidLinkTool = "AndroidLinkTool"; @@ -39,4 +38,3 @@ public static class KnownProperties public const string ImplicitUsings = "ImplicitUsings"; } } - diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs index 7e462f5cc64..fde6e298fa1 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs @@ -103,11 +103,6 @@ public virtual string DefaultMainActivity { /// public string MinSdkVersion { get; set; } = "19"; - public bool BundleAssemblies { - get { return string.Equals (GetProperty (KnownProperties.BundleAssemblies), "True", StringComparison.OrdinalIgnoreCase); } - set { SetProperty (KnownProperties.BundleAssemblies, value.ToString ()); } - } - string AotAssembliesPropertyName => Builder.UseDotNet ? KnownProperties.RunAOTCompilation : KnownProperties.AotAssemblies; public bool AotAssemblies { diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfig.cs b/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfig.cs index e5a1405b127..25550eb3473 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfig.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfig.cs @@ -28,7 +28,6 @@ sealed class ApplicationConfig public bool uses_mono_aot; public bool aot_lazy_load; public bool uses_assembly_preload; - public bool is_a_bundled_app; public bool broken_exception_transitions; public bool instant_run_enabled ; public bool jni_add_native_method_registration_attribute_present; diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfigNativeAssemblyGenerator.cs b/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfigNativeAssemblyGenerator.cs index 16bc2daa34a..6802af86229 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfigNativeAssemblyGenerator.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfigNativeAssemblyGenerator.cs @@ -149,7 +149,6 @@ sealed class XamarinAndroidBundledAssembly StructureInfo assemblyStoreSingleAssemblyRuntimeDataStructureinfo; StructureInfo assemblyStoreRuntimeDataStructureInfo; - public bool IsBundledApp { get; set; } public bool UsesMonoAOT { get; set; } public bool UsesMonoLLVM { get; set; } public bool UsesAssemblyPreload { get; set; } @@ -196,7 +195,6 @@ public override void Init () uses_mono_aot = UsesMonoAOT, aot_lazy_load = AotEnableLazyLoad, uses_assembly_preload = UsesAssemblyPreload, - is_a_bundled_app = IsBundledApp, broken_exception_transitions = BrokenExceptionTransitions, instant_run_enabled = InstantRunEnabled, jni_add_native_method_registration_attribute_present = JniAddNativeMethodRegistrationAttributePresent, diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj index dd902240461..ad980b06223 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.csproj @@ -361,10 +361,6 @@ LayoutBinding.cs PreserveNewest - - mkbundle-api.h - PreserveNewest - PreserveNewest diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets index 060d670a696..a465777198e 100644 --- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets +++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets @@ -333,7 +333,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. <_AndroidAotStripLibraries Condition=" '$(_AndroidAotStripLibraries)' == '' And '$(AndroidIncludeDebugSymbols)' != 'true' ">True - false + false true True True @@ -560,6 +560,10 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved. ResourceName="XA1026_dotnet" Condition=" '$(AndroidUseAapt2)' != 'true' and '$(UsingAndroidNETSdk)' == 'true' " /> + - <_PropertyCacheItems Include="BundleAssemblies=$(BundleAssemblies)" /> <_PropertyCacheItems Include="AotAssemblies=$(AotAssemblies)" /> <_PropertyCacheItems Include="AndroidAddKeepAlives=$(AndroidAddKeepAlives)" /> <_PropertyCacheItems Include="AndroidAotMode=$(AndroidAotMode)" /> @@ -1784,7 +1787,6 @@ because xbuild doesn't support framework reference assemblies. Debug="$(AndroidIncludeDebugSymbols)" AndroidSequencePointsMode="$(_SequencePointsMode)" EnableSGenConcurrent="$(AndroidEnableSGenConcurrent)" - IsBundledApplication="$(BundleAssemblies)" SupportedAbis="@(_BuildTargetAbis)" AndroidPackageName="$(_AndroidPackage)" EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)" @@ -2141,7 +2143,6 @@ because xbuild doesn't support framework reference assemblies. AndroidNdkDirectory="$(_AndroidNdkDirectory)" ApkInputPath="$(_PackagedResources)" ApkOutputPath="$(ApkFileIntermediate)" - BundleAssemblies="$(BundleAssemblies)" BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ShrunkUserAssemblies);@(_AndroidResolvedSatellitePaths)" @@ -2175,7 +2176,6 @@ because xbuild doesn't support framework reference assemblies. AndroidNdkDirectory="$(_AndroidNdkDirectory)" ApkInputPath="$(_PackagedResources)" ApkOutputPath="$(_BaseZipIntermediate)" - BundleAssemblies="$(BundleAssemblies)" BundleNativeLibraries="$(_BundleResultNativeLibraries)" EmbedAssemblies="$(EmbedAssembliesIntoApk)" ResolvedUserAssemblies="@(_ShrunkUserAssemblies);@(_AndroidResolvedSatellitePaths)" @@ -2760,7 +2760,7 @@ because xbuild doesn't support framework reference assemblies. <_ProjectAndroidManifest>$(ProjectDir)$(AndroidManifest) - <_NdkRequired Condition="'$(BundleAssemblies)' == 'True' Or '$(EnableLLVM)' == 'True'">true + <_NdkRequired Condition="'$(EnableLLVM)' == 'True'">true <_NdkRequired Condition="'$(_NdkRequired)' == ''">false diff --git a/src/monodroid/jni/application_dso_stub.cc b/src/monodroid/jni/application_dso_stub.cc index 5cbc623260a..8a59a03e51a 100644 --- a/src/monodroid/jni/application_dso_stub.cc +++ b/src/monodroid/jni/application_dso_stub.cc @@ -46,7 +46,6 @@ const ApplicationConfig application_config = { .uses_mono_aot = false, .aot_lazy_load = false, .uses_assembly_preload = false, - .is_a_bundled_app = false, .broken_exception_transitions = false, .instant_run_enabled = false, .jni_add_native_method_registration_attribute_present = false, diff --git a/src/monodroid/jni/logger.cc b/src/monodroid/jni/logger.cc index 7edd748b424..57f1ea79957 100644 --- a/src/monodroid/jni/logger.cc +++ b/src/monodroid/jni/logger.cc @@ -197,10 +197,6 @@ init_logging_categories (char*& mono_log_mask, char*& mono_log_level) continue; } - if (set_category ("bundle", param, LOG_BUNDLE)) { - continue; - } - if (set_category ("network", param, LOG_NET)) { continue; } diff --git a/src/monodroid/jni/mkbundle-api.h b/src/monodroid/jni/mkbundle-api.h deleted file mode 100644 index 586f5d26273..00000000000 --- a/src/monodroid/jni/mkbundle-api.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __MKBUNDLE_API_H -#define __MKBUNDLE_API_H - -#ifdef __cplusplus -using namespace xamarin::android; -#endif - -typedef struct BundleMonoAPI -{ - void (*mono_register_bundled_assemblies) (const MonoBundledAssembly **assemblies); - void (*mono_register_config_for_assembly) (const char* assembly_name, const char* config_xml); - void (*mono_jit_set_aot_mode) (int mode); - void (*mono_aot_register_module) (void** aot_info); - void (*mono_config_parse_memory) (const char *buffer); - void (*mono_register_machine_config) (const char *config_xml); -} BundleMonoAPI; - -#if ANDROID -#include -#include - -#ifdef __cplusplus -[[maybe_unused]] -#endif -static void -mkbundle_log_error (const char *format, ...) -{ - va_list ap; - - va_start (ap, format); - __android_log_vprint (ANDROID_LOG_ERROR, "mkbundle", format, ap); - va_end (ap); -} -#endif // ANDROID -#endif // __MKBUNDLE_API_H diff --git a/src/monodroid/jni/monodroid-glue-internal.hh b/src/monodroid/jni/monodroid-glue-internal.hh index def9a263218..85128eb1915 100644 --- a/src/monodroid/jni/monodroid-glue-internal.hh +++ b/src/monodroid/jni/monodroid-glue-internal.hh @@ -304,7 +304,6 @@ namespace xamarin::android::internal void init_android_runtime (JNIEnv *env, jclass runtimeClass, jobject loader); #else //def NET void init_android_runtime (MonoDomain *domain, JNIEnv *env, jclass runtimeClass, jobject loader); - void setup_bundled_app (const char *dso_name); #endif // ndef NET void set_environment_variable_for_directory (const char *name, jstring_wrapper &value, bool createDirectory, mode_t mode); diff --git a/src/monodroid/jni/monodroid-glue.cc b/src/monodroid/jni/monodroid-glue.cc index d50c2c73d3a..d6a910d2c40 100644 --- a/src/monodroid/jni/monodroid-glue.cc +++ b/src/monodroid/jni/monodroid-glue.cc @@ -80,7 +80,6 @@ #include "debug.hh" #include "embedded-assemblies.hh" #include "monodroid-glue.hh" -#include "mkbundle-api.h" #include "monodroid-glue-internal.hh" #include "globals.hh" #include "xamarin-app.hh" @@ -104,10 +103,6 @@ using namespace microsoft::java_interop; using namespace xamarin::android; using namespace xamarin::android::internal; -// This is below the above because we don't want to modify the header with our internal -// implementation details as it would prevent mkbundle from working -#include "mkbundle-api.h" - #if !defined (NET) #include "config.include" #include "machine.config.include" @@ -175,58 +170,6 @@ setenv(const char *name, const char *value, int overwrite) } #endif // def WINDOWS -#if !defined (NET) -typedef void* (*mono_mkbundle_init_ptr) (void (*)(const MonoBundledAssembly **), void (*)(const char* assembly_name, const char* config_xml),void (*) (int mode)); -mono_mkbundle_init_ptr mono_mkbundle_init; - -typedef void (*mono_mkbundle_initialize_mono_api_ptr) (const BundleMonoAPI *info); -mono_mkbundle_initialize_mono_api_ptr mono_mkbundle_initialize_mono_api; - -void -MonodroidRuntime::setup_bundled_app (const char *dso_name) -{ - if (!application_config.is_a_bundled_app) - return; - - static unsigned int dlopen_flags = JAVA_INTEROP_LIB_LOAD_LOCALLY; - void *libapp = nullptr; - - if (androidSystem.is_embedded_dso_mode_enabled ()) { - log_info (LOG_DEFAULT, "bundle app: embedded DSO mode"); - libapp = androidSystem.load_dso_from_any_directories (dso_name, dlopen_flags); - } else { - log_info (LOG_DEFAULT, "bundle app: normal mode"); - dynamic_local_string bundle_path; - if (!androidSystem.get_full_dso_path_on_disk (dso_name, bundle_path)) { - log_info (LOG_DEFAULT, "bundle %s not found on filesystem", dso_name); - return; - } - log_info (LOG_BUNDLE, "Attempting to load bundled app from %s", bundle_path.get ()); - libapp = androidSystem.load_dso (bundle_path.get (), dlopen_flags, true); - } - - if (libapp == nullptr) { - log_info (LOG_DEFAULT, "No libapp!"); - if (!androidSystem.is_embedded_dso_mode_enabled ()) { - log_fatal (LOG_BUNDLE, "bundled app initialization error"); - Helpers::abort_application (); - } else { - log_info (LOG_BUNDLE, "bundled app not found in the APK, ignoring."); - return; - } - } - - mono_mkbundle_initialize_mono_api = reinterpret_cast (java_interop_lib_symbol (libapp, "initialize_mono_api", nullptr)); - if (mono_mkbundle_initialize_mono_api == nullptr) - log_error (LOG_BUNDLE, "Missing initialize_mono_api in the application"); - - mono_mkbundle_init = reinterpret_cast (java_interop_lib_symbol (libapp, "mono_mkbundle_init", nullptr)); - if (mono_mkbundle_init == nullptr) - log_error (LOG_BUNDLE, "Missing mono_mkbundle_init in the application"); - log_info (LOG_BUNDLE, "Bundled app loaded: %s", dso_name); -} -#endif - void MonodroidRuntime::thread_start ([[maybe_unused]] MonoProfiler *prof, [[maybe_unused]] uintptr_t tid) { @@ -854,24 +797,6 @@ MonodroidRuntime::mono_runtime_init ([[maybe_unused]] dynamic_local_string(mono_jit_set_aot_mode), - .mono_aot_register_module = mono_aot_register_module, - .mono_config_parse_memory = mono_config_parse_memory, - .mono_register_machine_config = reinterpret_cast(mono_register_machine_config), - }; - - /* The initialization function copies the struct */ - mono_mkbundle_initialize_mono_api (&bundle_mono_api); - } - - if (mono_mkbundle_init) - mono_mkbundle_init (mono_register_bundled_assemblies, mono_register_config_for_assembly, reinterpret_cast(mono_jit_set_aot_mode)); -#endif // ndef NET /* * Assembly preload hooks are invoked in _reverse_ registration order. * Looking for assemblies from the update dir takes precedence over @@ -905,11 +830,6 @@ MonoDomain* MonodroidRuntime::create_domain (JNIEnv *env, jstring_array_wrapper &runtimeApks, bool is_root_domain, bool have_split_apks) { size_t user_assemblies_count = 0; -#if defined (NET) - constexpr bool have_mono_mkbundle_init = false; -#else // def NET - bool have_mono_mkbundle_init = mono_mkbundle_init != nullptr; -#endif // ndef NET gather_bundled_assemblies (runtimeApks, &user_assemblies_count, have_split_apks); @@ -930,7 +850,7 @@ MonodroidRuntime::create_domain (JNIEnv *env, jstring_array_wrapper &runtimeApks } #endif // def NET - if (!have_mono_mkbundle_init && user_assemblies_count == 0 && androidSystem.count_override_assemblies () == 0 && !is_running_on_desktop) { + if (user_assemblies_count == 0 && androidSystem.count_override_assemblies () == 0 && !is_running_on_desktop) { #if defined (DEBUG) log_fatal (LOG_DEFAULT, "No assemblies found in '%s' or '%s'. Assuming this is part of Fast Deployment. Exiting...", androidSystem.get_override_dir (0), @@ -2262,10 +2182,6 @@ MonodroidRuntime::Java_mono_android_Runtime_initInternal (JNIEnv *env, jclass kl set_debug_env_vars (); #endif -#if !defined (NET) - setup_bundled_app ("libmonodroid_bundle_app.so"); -#endif - #if defined (ANDROID) bool have_log_assembly = (log_categories & LOG_ASSEMBLY) != 0; bool have_log_gc = (log_categories & LOG_GC) != 0; diff --git a/src/monodroid/jni/xamarin-app.hh b/src/monodroid/jni/xamarin-app.hh index 0843a17d270..3dbc037407b 100644 --- a/src/monodroid/jni/xamarin-app.hh +++ b/src/monodroid/jni/xamarin-app.hh @@ -205,7 +205,6 @@ struct ApplicationConfig bool uses_mono_aot; bool aot_lazy_load; bool uses_assembly_preload; - bool is_a_bundled_app; bool broken_exception_transitions; bool instant_run_enabled; bool jni_add_native_method_registration_attribute_present; 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 18505d4c067..6d3fbc7f627 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 @@ -60,8 +60,7 @@ {195BE9C2-1F91-40DC-BD6D-DE860BF083FB} - - + diff --git a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj index 6d83bbd37ff..a3ca49e47b0 100644 --- a/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj +++ b/tests/Xamarin.Forms-Performance-Integration/Xamarin.Forms.Performance.Integration.csproj @@ -10,7 +10,6 @@ - - + - \ No newline at end of file +