Skip to content

Commit d0701eb

Browse files
authored
[Xamarin.Android.Build.Tasks] Remove support for mkbundle (#7772)
Fixes: #7764 Context: d236af5 Context: dotnet/android-libraries#64 (comment) .NET Android dropped support for `$(BundleAssemblies)`=True; see also commit d236af5 and [a comment on dotnet/android-libraries#64][0]: > After internal discussion, we are strongly considering removing > support for `$(BundleAssemblies)` in .NET 5, as it increases > on-device memory use and slows down app startup times. However, this "dropping of support" was incomplete; setting it would result in broken apps! % dotnet new android -n android-ba % cd android-ba % dotnet build -p:BundleAssemblies=true # run the app, or just look at the .apk contents % unzip -l bin/Debug/net7.0-android/*-Signed.apk | grep assem 660 02-03-2023 14:13 assemblies/rc.bin # Note: `assemblies/assemblies.blob` is not present, but is required! Fix this by *removing* most usage of the `$(BundleAssemblies)` MSBuild property as well as all the code affected by it. - Stop running bundle test apps on CI - Remove bundle unit tests - Remove the `CodeGen-MkBundle` project from the tests solution - Remove the `Xamarin.Android.MakeBundle-Tests` from the tests solution - Remove all native code (and configuration) related to mkbundle - Warn about `$(BundleAssemblies)` usage in .NET projects. A XA1035 warning will be emitted when `$(BundleAssemblies)`=True in .NET Android apps. Preserve a couple of related properties in the `<BuildApk/>` and `<GeneratePackageManagerJava/>` tasks, because they are still used by the debugger targets from `xamarin/monodroid`. [0]: dotnet/android-libraries#64 (comment)
1 parent 0b2a982 commit d0701eb

33 files changed

+62
-626
lines changed

Configuration.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@
155155
<PathSeparator>$([System.IO.Path]::PathSeparator)</PathSeparator>
156156
<_TestsAotName Condition=" '$(AotAssemblies)' == 'true' ">-Aot</_TestsAotName>
157157
<_TestsProfiledAotName Condition=" '$(AndroidEnableProfiledAot)' == 'true' ">-Profiled</_TestsProfiledAotName>
158-
<_TestsBundleName Condition=" '$(BundleAssemblies)' == 'true' ">-Bundle</_TestsBundleName>
159-
<TestsFlavor>$(_TestsProfiledAotName)$(_TestsAotName)$(_TestsBundleName)</TestsFlavor>
158+
<TestsFlavor>$(_TestsProfiledAotName)$(_TestsAotName)</TestsFlavor>
160159
</PropertyGroup>
161160
<PropertyGroup>
162161
<MingwCommandPrefix32>i686-w64-mingw32</MingwCommandPrefix32>

Documentation/guides/messages/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ or 'Help->Report a Problem' in Visual Studio for Mac.
134134
+ [XA1031](xa1031.md): The 'AndroidHttpClientHandlerType' has an invalid value.
135135
+ [XA1032](xa1032.md):Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting.
136136
+ [XA1033](xa1033.md): Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting.
137+
+ [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.
137138

138139
## XA2xxx: Linker
139140

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Xamarin.Android warning XA1035
3+
description: XA1034 warning code
4+
ms.date: 13/12/2022
5+
---
6+
# Xamarin.Android warning XA1035
7+
8+
## Example messages
9+
10+
```
11+
The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties.
12+
```
13+
14+
## Solution
15+
16+
Edit your csproj directly and remove the 'BundleAssemblies' property.
17+
`AndroidUseAssemblyStore` and `AndroidEnableAssemblyCompression` are
18+
both enabled by default and, together, they implement behavior
19+
equivalent to that of `BundleAssemblies`.

Xamarin.Android-Tests.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.FixJavaAbst
3434
EndProject
3535
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}"
3636
EndProject
37-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeGen-MkBundle", "CodeGen-MkBundle", "{93CBCEB8-8B64-420C-950C-BCE9CC8C6032}"
38-
EndProject
39-
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}"
40-
EndProject
4137
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ResolveImports", "ResolveImports", "{E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9}"
4238
EndProject
4339
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
151147
{9479B71F-19FE-48F9-AB3F-AE764D76038A}.Debug|Any CPU.Build.0 = Debug|Any CPU
152148
{9479B71F-19FE-48F9-AB3F-AE764D76038A}.Release|Any CPU.ActiveCfg = Release|Any CPU
153149
{9479B71F-19FE-48F9-AB3F-AE764D76038A}.Release|Any CPU.Build.0 = Release|Any CPU
154-
{A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
155-
{A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
156-
{A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
157-
{A0B2692E-9FBE-4157-9526-7145F07F2C5A}.Release|Any CPU.Build.0 = Release|Any CPU
158150
{2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
159151
{2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Debug|Any CPU.Build.0 = Debug|Any CPU
160152
{2A0519DF-0DDA-45F7-AC3C-E2992748D364}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -269,7 +261,6 @@ Global
269261
{7B9D9F32-973F-49CF-A8F8-05BDFC75556C} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4}
270262
{B7476528-C166-40BF-931F-EAEB02247879} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4}
271263
{9479B71F-19FE-48F9-AB3F-AE764D76038A} = {2EFFECF5-1CCA-4005-AE62-1D6F01C88DF4}
272-
{A0B2692E-9FBE-4157-9526-7145F07F2C5A} = {93CBCEB8-8B64-420C-950C-BCE9CC8C6032}
273264
{2A0519DF-0DDA-45F7-AC3C-E2992748D364} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9}
274265
{DD4E2A49-730C-41FD-B6D4-AFB73F94271F} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9}
275266
{9802CB35-0BC0-4EE1-9A81-BB40BD97945A} = {E49089E4-4CE0-475E-BE9C-0AB4E4D56EE9}

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,6 @@ stages:
219219
artifactFolder: Profiled-Aot
220220
useDotNet: false
221221

222-
- template: yaml-templates/apk-instrumentation.yaml
223-
parameters:
224-
configuration: $(ApkTestConfiguration)
225-
testName: Xamarin.Forms-Performance-Integration-Bundle
226-
project: tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj
227-
testResultsFiles: TestResult-apkdiff-Xamarin.Forms_Performance_Integration-Signed-$(ApkTestConfiguration)-Bundle.xml
228-
extraBuildArgs: /p:BundleAssemblies=true
229-
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk
230-
artifactFolder: Bundle
231-
useDotNet: false
232-
233222
- template: yaml-templates/apk-instrumentation.yaml
234223
parameters:
235224
configuration: $(ApkTestConfiguration)
@@ -652,7 +641,7 @@ stages:
652641
nunit_categories: $(DotNetNUnitCategories) & TestCategory != SmokeTests
653642
target_framework: $(DotNetStableTargetFramework)
654643
provisionatorChannel: ${{ parameters.provisionatorChannel }}
655-
644+
656645
- template: yaml-templates/stage-msbuild-emulator-tests.yaml
657646
parameters:
658647
provisionatorChannel: ${{ parameters.provisionatorChannel }}

build-tools/installers/create-installers.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@
242242
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Microsoft.Android.Build.BaseTasks.pdb" />
243243
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle.exe" ExcludeFromAndroidNETSdk="true" />
244244
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle.pdb" ExcludeFromAndroidNETSdk="true" />
245-
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mkbundle-api.h" />
246245
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mono-symbolicate.exe" ExcludeFromAndroidNETSdk="true" />
247246
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)mono-symbolicate.pdb" ExcludeFromAndroidNETSdk="true" />
248247
<_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)Mono.CompilerServices.SymbolWriter.dll" />

build-tools/scripts/RunTests.targets

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,6 @@
159159
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
160160
Properties="AndroidEnableProfiledAot=True;AotAssemblies=True"
161161
/>
162-
<ItemGroup Condition=" '$(USE_MSBUILD)' == '1' ">
163-
<_ApkTestProjectBundle>
164-
<_BinLog>$(_XABinLogPrefix)-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss"))-%(Filename)-Bundle.binlog"</_BinLog>
165-
</_ApkTestProjectBundle>
166-
</ItemGroup>
167-
<Exec
168-
Command="$(_XABuild) %(_ApkTestProjectBundle.Identity) %(_ApkTestProjectBundle._BinLog) /t:SignAndroidPackage $(_XABuildProperties) /p:BundleAssemblies=True /p:EmbedAssembliesIntoApk=True"
169-
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
170-
/>
171-
<MSBuild
172-
ContinueOnError="ErrorAndContinue"
173-
Projects="$(_TopDir)\tests\RunApkTests.targets"
174-
Targets="$(RunApkTestsTarget)"
175-
Condition=" '$(_CrossCompilerAvailable)' == 'True' "
176-
Properties="BundleAssemblies=True"
177-
/>
178162
</Target>
179163
<Target Name="RunPerformanceTests">
180164
<MSBuild Projects="$(MSBuildThisFileDirectory)..\timing\timing.csproj" Targets="MSBuildTiming" />

build-tools/xaprepare/xaprepare/Steps/Step_PrepareLocal.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@ protected override async Task<bool> Execute(Context context)
1616
var msbuild = new MSBuildRunner (context);
1717
string xfTestPath = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "tests", "Xamarin.Forms-Performance-Integration", "Xamarin.Forms.Performance.Integration.csproj");
1818

19-
if (!await msbuild.Restore (projectPath: xfTestPath, logTag: "xfperf", binlogName: "prepare-local"))
20-
return false;
21-
22-
// The Xamarin.Forms PackageReference version varies based on the value of $(BundleAssemblies)
23-
return await msbuild.Restore (
24-
projectPath: xfTestPath,
25-
logTag: "xfperfbundle",
26-
arguments: new List<string> { "-p:BundleAssemblies=true" },
27-
binlogName: "prepare-local-bundle"
28-
);
19+
return await msbuild.Restore (projectPath: xfTestPath, logTag: "xfperf", binlogName: "prepare-local");
2920
}
3021
}
3122
}

src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ Copyright (C) 2016 Xamarin. All rights reserved.
135135
Debug="$(AndroidIncludeDebugSymbols)"
136136
AndroidSequencePointsMode="$(_SequencePointsMode)"
137137
EnableSGenConcurrent="$(AndroidEnableSGenConcurrent)"
138-
IsBundledApplication="$(BundleAssemblies)"
139138
SupportedAbis="$(_BuildTargetAbis)"
140139
AndroidPackageName="$(_AndroidPackage)"
141140
EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)"

src/Xamarin.Android.Build.Tasks/Properties/Resources.resx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ Please change the value to an assembly-qualifed type name which inherits from '{
493493
<comment>The following are literal names and should not be translated: '_Microsoft.Android.Resource.Desinger', 'AndroidUseDesignerAssembly', 'true'
494494
{0} - The name of the assembly</comment>
495495
</data>
496+
<data name="XA1035" xml:space="preserve">
497+
<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>
498+
<comment>The following are literal names and should not be translated: 'BundleAssemblies', 'AndroidUseAssemblyStore', 'AndroidEnableAssemblyCompression'</comment>
499+
</data>
496500
<data name="XA2000" xml:space="preserve">
497501
<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>
498502
<comment>The following are literal names and should not be translated: AppDomain.CreateDomain(), AppDomain

0 commit comments

Comments
 (0)