Skip to content

Commit 0b66c55

Browse files
Merge branch 'main' into api-32-beta1
2 parents 2103268 + 582adfd commit 0b66c55

File tree

15 files changed

+65
-35
lines changed

15 files changed

+65
-35
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
version: 2
33
updates:
44
- package-ecosystem: "gradle"
5-
directory: "/"
5+
directory: "/src/r8/"
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "gradle"
9+
directory: "/src/manifestmerger/"
610
schedule:
711
interval: "weekly"

Documentation/building/windows/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ MSBuild version 15 or later is required.
3232

3333
7. In order to use the in-tree Xamarin.Android, build xabuild:
3434

35-
msbuild tools/xabuild/xabuild.csproj
35+
msbuild tools/xabuild/xabuild.csproj /restore
3636

3737
8. (For Microsoft team members only - Optional) In a [Developer Command
3838
Prompt][developer-prompt], build external proprietary git
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
### manifestmerger.jar version update to 30.0.4
2+
3+
The version of the [manifest merger][0] included in Xamarin.Android
4+
has been updated from 27.1.1 to 30.0.4
5+
6+
[0]: https://developer.android.com/studio/build/manifest-merge.html

src/Mono.Android/metadata

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,14 @@
367367
~~ remaining Color methods, manually enumified ~~
368368
<attr path="/api/package[@name='android.content.res']/class[@name='ColorStateList']/method[@name='getColorForState']" name="return">Android.Graphics.Color</attr>
369369
-->
370-
<attr api-since="21" path="/api/package[@name='android.app']/class[@name='ActivityManager.TaskDescription']/constructor/parameter[@name='colorPrimary']" name="type">Android.Graphics.Color</attr>
370+
<attr api-since="21" path="/api/package[@name='android.app']/class[@name='ActivityManager.TaskDescription']/constructor/parameter[@name='colorPrimary' and @type='int']" name="type">Android.Graphics.Color</attr>
371371
<attr path="/api/package[@name='android.content.res']/class[@name='Resources']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
372372
<attr path="/api/package[@name='android.content.res']/class[@name='TypedArray']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
373373
<attr path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
374-
<attr path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setColor']/parameter[position()=1]" name="type">Android.Graphics.Color</attr>
374+
<attr path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setColor' and parameter[1][@type='int']]/parameter[position()=1]" name="type">Android.Graphics.Color</attr>
375375
<attr api-since="11" path="/api/package[@name='android.graphics.drawable']/class[@name='ColorDrawable']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
376-
<attr api-since="11" path="/api/package[@name='android.graphics.drawable']/class[@name='ColorDrawable']/method[@name='setColor']/parameter[position()=1]" name="type">Android.Graphics.Color</attr>
377-
<attr api-since="21" path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setShadowColor']/parameter[@name='shadowColor']" name="type">Android.Graphics.Color</attr>
376+
<attr api-since="11" path="/api/package[@name='android.graphics.drawable']/class[@name='ColorDrawable']/method[@name='setColor']/parameter[position()=1 and @type='int']" name="type">Android.Graphics.Color</attr>
377+
<attr api-since="21" path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setShadowColor']/parameter[@name='shadowColor' and @type='int']" name="type">Android.Graphics.Color</attr>
378378
<attr api-since="21" path="/api/package[@name='android.graphics']/class[@name='RadialGradient']/constructor/parameter[@name='centerColor' and @type='int']" name="type">Android.Graphics.Color</attr>
379379
<attr api-since="21" path="/api/package[@name='android.graphics']/class[@name='RadialGradient']/constructor/parameter[@name='edgeColor' and @type='int']" name="type">Android.Graphics.Color</attr>
380380
<attr path="/api/package[@name='android.text.style']/class[@name='QuoteSpan']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
@@ -1656,6 +1656,9 @@
16561656
<!-- C# won't let you access protected types in a sealed type, so make them public so they can be used by user code. -->
16571657
<attr api-since="30" path="/api/package[@name='android.provider']/interface[contains(@name, 'Contract.') and contains(@name, 'Columns') and @visibility='protected']" name="visibility">public</attr>
16581658

1659+
<!-- The setter 'setColor (long)' can't be merged with the existing 'virtual long Color { get; }' because it's a breaking change -->
1660+
<attr api-since="29" path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setColor' and count(parameter)=1 and parameter[1][@type='long']]" name="propertyName"></attr>
1661+
16591662
<!--
16601663
***********************************************************************
16611664
THE FOLLOWING LINES MUST BE CREATED FOR ANY NEW PLATFORM THAT IS ADDED.

src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Documentation.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
1414
<UsingTask TaskName="Xamarin.Android.Tasks.ImportJavaDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
1515
<UsingTask TaskName="Xamarin.Android.Tasks.JavaDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
1616
<UsingTask TaskName="Xamarin.Android.Tasks.MDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
17-
<UsingTask TaskName="Xamarin.Android.Tasks.Unzip" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
17+
<UsingTask TaskName="Xamarin.Android.Tasks.UnzipToFolder" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
1818

1919
<Target Name="_ExtractJavaDocJars"
2020
Inputs="@(JavaDocJar)"
2121
Outputs="@(JavaDocJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
22-
<Unzip
22+
<UnzipToFolder
2323
Sources="@(JavaDocJar)"
2424
DestinationDirectories="@(JavaDocJar->'$(IntermediateOutputPath)javadocs\%(FileName)')"
2525
/>
@@ -33,7 +33,7 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
3333
Condition=" '$(_UseLegacyJavadocImport)' == 'True' "
3434
Inputs="@(JavaSourceJar)"
3535
Outputs="@(JavaSourceJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
36-
<Unzip
36+
<UnzipToFolder
3737
Sources="@(JavaSourceJar)"
3838
DestinationDirectories="@(JavaSourceJar->'$(IntermediateOutputPath)javasources\%(FileName)')"
3939
/>

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.After.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ This file is imported *after* the Microsoft.NET.Sdk/Sdk.targets.
2525
<!-- Only import this in VS 2019 16.x -->
2626
<Import Project="Microsoft.Android.Sdk.NuGet.targets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and '$(MSBuildVersion)' &lt; '17.0' " />
2727
<Import Project="Microsoft.Android.Sdk.ProjectCapabilities.targets" />
28-
<Import Project="Microsoft.Android.Sdk.PropertyPages.targets" />
2928
<Import Project="Microsoft.Android.Sdk.Publish.targets" />
3029
<Import Project="Microsoft.Android.Sdk.RuntimeConfig.targets" />
3130
<Import Project="Microsoft.Android.Sdk.Tooling.targets" />

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.PropertyPages.targets

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Xamarin.Android.Build.Tasks/Tasks/Unzip.cs renamed to src/Xamarin.Android.Build.Tasks/Tasks/UnzipToFolder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Xamarin.Android.Tasks
1010
{
11-
public class Unzip : AndroidTask
11+
public class UnzipToFolder : AndroidTask
1212
{
1313
public override string TaskPrefix => "UNZ";
1414

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public static void Foo () {
438438

439439
[Test]
440440
[Category ("LLVM")]
441-
public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode)
441+
public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode, [Values (false, true)] bool skipDebugSymbols)
442442
{
443443
AssertAotModeSupported (androidAotMode);
444444

@@ -463,7 +463,12 @@ public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string andr
463463
using (var apk = ZipHelper.OpenZip (apkPath)) {
464464
xaAssemblySize = ZipHelper.ReadFileFromZip (apk, $"lib/{supportedAbi}/libaot-Mono.Android.dll.so").Length;
465465
}
466-
proj.SetProperty ("AndroidAotAdditionalArguments", "no-write-symbols");
466+
467+
string additionalArgs = "no-write-symbols";
468+
if (skipDebugSymbols) {
469+
additionalArgs += ",nodebug";
470+
}
471+
proj.SetProperty ("AndroidAotAdditionalArguments", additionalArgs);
467472
Assert.IsTrue (b.Build (proj), "Second build should have succeeded.");
468473
FileAssert.Exists (apkPath);
469474
using (var apk = ZipHelper.OpenZip (apkPath)) {

src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,42 @@ static bool IsEmptyAOTLibrary (TaskLoggingHelper log, string path, IELF elf)
5656
return false;
5757
}
5858

59+
bool isElf64 = elf.Class == Class.Bit64;
5960
foreach (var entry in symtab.Entries) {
6061
if (entry.Type == SymbolType.Function) {
6162
return false;
6263
}
63-
}
6464

65+
if (!(isElf64 ? IsNonEmptyCodeSymbol (entry as SymbolEntry<ulong>) : IsNonEmptyCodeSymbol (entry as SymbolEntry<uint>))) {
66+
continue;
67+
}
68+
69+
// We have an entry that's in (some) executable section and has some code in it.
70+
// Mono creates symbols which are essentially jump tables into executable code
71+
// inside the DSO that is not accessible via any other symbol, merely a blob of
72+
// executable code. The jump table symbols are named with the `_plt` prefix.
73+
if (entry.Name.EndsWith ("_plt")) {
74+
return false;
75+
}
76+
}
6577
return true;
78+
79+
bool IsNonEmptyCodeSymbol<T> (SymbolEntry<T>? symbolEntry) where T : struct
80+
{
81+
if (symbolEntry == null) {
82+
return true; // Err on the side of caution
83+
}
84+
85+
Type t = typeof(T);
86+
ulong size = 0;
87+
if (t == typeof(System.UInt64)) {
88+
size = (ulong)(object)symbolEntry.Size;
89+
} else if (t == typeof(System.UInt32)) {
90+
size = (uint)(object)symbolEntry.Size;
91+
}
92+
93+
return size != 0 && symbolEntry.PointedSection.Type == SectionType.ProgBits;
94+
}
6695
}
6796

6897
static ISymbolTable? GetSymbolTable (IELF elf, string sectionName)

0 commit comments

Comments
 (0)