Skip to content

Commit

Permalink
Merge branch 'main' into classloader-thread-init
Browse files Browse the repository at this point in the history
* main:
  [Xamarin.Android.Build.Tasks] Remove support for mkbundle (dotnet#7772)
  [Xamarin.Android.Build.Tasks] `unable to open file as zip archive`? (dotnet#7759)
  [monodroid] Properly process satellite assemblies (dotnet#7823)
  Bump to xamarin/java.interop/main@77800dda (dotnet#7824)
  • Loading branch information
grendello committed Feb 28, 2023
2 parents 93858a5 + d0701eb commit 8b2cb16
Show file tree
Hide file tree
Showing 46 changed files with 140 additions and 720 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:main@50faac94c6a0c27864564829ac83f3988c82f8ef
xamarin/monodroid:main@602aca98245744882a129206b79b5a5e093dae44
mono/mono:2020-02@6dd9def57ce969ca04a0ecd9ef72c0a8f069112d
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<!-- Common <PackageReference/> versions -->
<PropertyGroup>
<LibZipSharpVersion>2.0.7</LibZipSharpVersion>
<LibZipSharpVersion>2.1.0</LibZipSharpVersion>
<MicroBuildCoreVersion>1.0.0</MicroBuildCoreVersion>
<MonoCecilVersion>0.11.4</MonoCecilVersion>
<NewtonsoftJsonPackageVersion>13.0.1</NewtonsoftJsonPackageVersion>
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
7 changes: 0 additions & 7 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,6 @@
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)jcw-gen.pdb" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)jit-times.exe" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)jit-times.pdb" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)jnimarshalmethod-gen.exe" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)jnimarshalmethod-gen.pdb" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)Java.Interop.dll.config" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)Java.Runtime.Environment.dll" /> <!-- Required by jnimarshalmethod-gen.exe -->
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)Java.Runtime.Environment.pdb" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)Java.Runtime.Environment.dll.config" Condition=" '$(HostOS)' != 'Windows' " />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)logcat-parse.exe" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)logcat-parse.pdb" />
<_LegacyJIFiles Include="$(LegacyMSBuildSrcDir)Mono.CSharp.dll" /> <!-- Required by logcat-parse.exe -->
Expand Down Expand Up @@ -248,7 +242,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
26 changes: 0 additions & 26 deletions build-tools/scripts/JavaInteropDllConfigs.targets

This file was deleted.

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");
}
}
}
2 changes: 1 addition & 1 deletion external/Java.Interop
2 changes: 1 addition & 1 deletion external/xamarin-android-tools
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
3 changes: 2 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,10 @@ void ExecuteWithAbi (string [] supportedAbis, string apkInputPath, string apkOut
string apkName = dex.GetMetadata ("ApkName");
string dexPath = string.IsNullOrWhiteSpace (apkName) ? Path.GetFileName (dex.ItemSpec) : apkName;
AddFileToArchiveIfNewer (apk, dex.ItemSpec, DalvikPath + dexPath, compressionMethod: dexCompressionMethod);
apk.Flush ();
}

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 @@ -265,7 +262,9 @@ void AddEnvironment ()
HashSet<string> archAssemblyNames = null;
HashSet<string> uniqueAssemblyNames = new HashSet<string> (StringComparer.OrdinalIgnoreCase);
Action<ITaskItem> updateAssemblyCount = (ITaskItem assembly) => {
string assemblyName = Path.GetFileName (assembly.ItemSpec);
// We need to use the 'RelativePath' metadata, if found, because it will give us the correct path for satellite assemblies - with the culture in the path.
string? relativePath = assembly.GetMetadata ("RelativePath");
string assemblyName = String.IsNullOrEmpty (relativePath) ? Path.GetFileName (assembly.ItemSpec) : relativePath;
if (!uniqueAssemblyNames.Contains (assemblyName)) {
uniqueAssemblyNames.Add (assemblyName);
}
Expand Down Expand Up @@ -373,7 +372,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");
using (var zipFile = ZipHelper.OpenZip (apk)) {
Assert.IsNotNull (ZipHelper.ReadFileFromZip (zipFile,
string.Format ("lib/{0}/libaot-UnnamedProject.dll.so", abi)),
Expand Down
Loading

0 comments on commit 8b2cb16

Please sign in to comment.