diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs index 636e491f4a9..13a28371195 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -531,7 +531,7 @@ public static string XA0140 { } /// - /// Looks up a localized string similar to NuGet package '{0}' version '{1}' contains a shared library '{2}' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details. + /// Looks up a localized string similar to NuGet package '{0}' version '{1}' contains a shared library '{2}' ({3}) which is not aligned to the {4} byte boundary. Google will require such alignment in the future. See https://developer.android.com/guide/practices/page-sizes for more details /// public static string XA0141 { get { diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx index 54ad2397fa9..e486f634722 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx @@ -1063,11 +1063,13 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS {1} - NuGet package version - NuGet package '{0}' version '{1}' contains a shared library '{2}' which is not correctly aligned. See https://developer.android.com/guide/practices/page-sizes for more details + NuGet package '{0}' version '{1}' contains a shared library '{2}' ({3}) which is not aligned to the {4} byte boundary. Google will require such alignment in the future. See https://developer.android.com/guide/practices/page-sizes for more details The following is a literal name and should not be translated: NuGet {0} - NuGet package id {1} - NuGet package version {2} - shared library file name +{3} - target architecture name +{4} - is an integer (size in bytes) diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs b/src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs index 9bee404bb7c..bc48aa436bd 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs @@ -45,6 +45,12 @@ static void AssertValidLibraryAlignment (TaskLoggingHelper log, uint pageSize, s throw new InvalidOperationException ($"Internal error: {elf} is not ELF"); } + string archName = elf.Machine switch { + Machine.AArch64 => "arm64-v8a", + Machine.AMD64 => "x86_64", + _ => throw new NotSupportedException ($"Internal error: ELF architecture {elf.Machine} is not supported") + }; + // We need to find all segments of Load type and make sure their alignment is as expected. foreach (ISegment segment in elf64.Segments) { if (segment.Type != SegmentType.Load) { @@ -66,7 +72,17 @@ static void AssertValidLibraryAlignment (TaskLoggingHelper log, uint pageSize, s log.LogDebugMessage ($" expected segment alignment of 0x{pageSize:x}, found 0x{segment64.Alignment:x}"); (string packageId, string packageVersion) = GetNugetPackageInfo (); - log.LogCodedWarning ("XA0141", Properties.Resources.XA0141, packageId, packageVersion, Path.GetFileName (path)); + log.LogCodedWarning ( + "XA0141", + path, + lineNumber: 0, + Properties.Resources.XA0141, + packageId, + packageVersion, + Path.GetFileName (path), + archName, + pageSize + ); break; }