Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for mkbundle #7772

Merged
merged 16 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@
<PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
<_TestsAotName Condition=" '$(AotAssemblies)' == 'true' ">-Aot</_TestsAotName>
<_TestsProfiledAotName Condition=" '$(AndroidEnableProfiledAot)' == 'true' ">-Profiled</_TestsProfiledAotName>
<_TestsBundleName Condition=" '$(BundleAssemblies)' == 'true' ">-Bundle</_TestsBundleName>
<TestsFlavor>$(_TestsProfiledAotName)$(_TestsAotName)$(_TestsBundleName)</TestsFlavor>
<TestsFlavor>$(_TestsProfiledAotName)$(_TestsAotName)</TestsFlavor>
</PropertyGroup>
<PropertyGroup>
<MingwCommandPrefix32>i686-w64-mingw32</MingwCommandPrefix32>
Expand Down
1 change: 1 addition & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa1035.md
Original file line number Diff line number Diff line change
@@ -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`.
9 changes: 0 additions & 9 deletions Xamarin.Android-Tests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
13 changes: 1 addition & 12 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
16 changes: 0 additions & 16 deletions build-tools/scripts/RunTests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,6 @@
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
Properties="AndroidEnableProfiledAot=True;AotAssemblies=True"
/>
<ItemGroup Condition=" '$(USE_MSBUILD)' == '1' ">
<_ApkTestProjectBundle>
<_BinLog>$(_XABinLogPrefix)-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss"))-%(Filename)-Bundle.binlog"</_BinLog>
</_ApkTestProjectBundle>
</ItemGroup>
<Exec
Command="$(_XABuild) %(_ApkTestProjectBundle.Identity) %(_ApkTestProjectBundle._BinLog) /t:SignAndroidPackage $(_XABuildProperties) /p:BundleAssemblies=True /p:EmbedAssembliesIntoApk=True"
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
/>
<MSBuild
ContinueOnError="ErrorAndContinue"
Projects="$(_TopDir)\tests\RunApkTests.targets"
Targets="$(RunApkTestsTarget)"
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
Properties="BundleAssemblies=True"
/>
</Target>
<Target Name="RunPerformanceTests">
<MSBuild Projects="$(MSBuildThisFileDirectory)..\timing\timing.csproj" Targets="MSBuildTiming" />
Expand Down
11 changes: 1 addition & 10 deletions build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ protected override async Task<bool> 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<string> { "-p:BundleAssemblies=true" },
binlogName: "prepare-local-bundle"
);
return await msbuild.Restore (projectPath: xfTestPath, logTag: "xfperf", binlogName: "prepare-local");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
4 changes: 4 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ Please change the value to an assembly-qualifed type name which inherits from '{
<comment>The following are literal names and should not be translated: '_Microsoft.Android.Resource.Desinger', 'AndroidUseDesignerAssembly', 'true'
{0} - The name of the assembly</comment>
</data>
<data name="XA1035" xml:space="preserve">
<value>The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties.</value>
<comment>The following are literal names and should not be translated: 'BundleAssemblies', 'AndroidUseAssemblyStore', 'AndroidEnableAssemblyCompression'</comment>
</data>
<data name="XA2000" xml:space="preserve">
<value>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.</value>
<comment>The following are literal names and should not be translated: AppDomain.CreateDomain(), AppDomain
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -373,7 +370,6 @@ void AddEnvironment ()
var appConfState = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<ApplicationConfigTaskState> (ProjectSpecificTaskObjectKey (ApplicationConfigTaskState.RegisterTaskObjectKey), RegisteredTaskObjectLifetime.Build);
var jniRemappingNativeCodeInfo = BuildEngine4.GetRegisteredTaskObjectAssemblyLocal<GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfo> (ProjectSpecificTaskObjectKey (GenerateJniRemappingNativeCode.JniRemappingNativeCodeInfoKey), RegisteredTaskObjectLifetime.Build);
var appConfigAsmGen = new ApplicationConfigNativeAssemblyGenerator (environmentVariables, systemProperties, Log) {
IsBundledApp = IsBundledApplication,
UsesMonoAOT = usesMonoAOT,
UsesMonoLLVM = EnableLLVM,
UsesAssemblyPreload = environmentParser.UsesAssemblyPreload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb
AotAssemblies = true,
PackageName = "com.xamarin.buildaotappwithspecialchars",
};
if (!Builder.UseDotNet) {
proj.BundleAssemblies = true;
}

proj.SetProperty ("AndroidNdkDirectory", AndroidNdkPath);
proj.SetAndroidSupportedAbis (supportedAbis);
proj.SetProperty ("EnableLLVM", enableLLVM.ToString ());
Expand Down Expand Up @@ -194,12 +192,7 @@ public void BuildAotApplicationWithNdkAndBundleAndÜmläüts (string supportedAb
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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this assert be conditioned on usesAssemblyBlobs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper hides that from the tests.

using (var zipFile = ZipHelper.OpenZip (apk)) {
Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile,
string.Format ("lib/{0}/libaot-UnnamedProject.dll.so", abi)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading