Skip to content

Commit

Permalink
Merge branch 'main' into api-32-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpeppers committed Jan 12, 2022
2 parents 2103268 + 582adfd commit 0b66c55
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 35 deletions.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
directory: "/src/r8/"
schedule:
interval: "weekly"
- package-ecosystem: "gradle"
directory: "/src/manifestmerger/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion Documentation/building/windows/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MSBuild version 15 or later is required.

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

msbuild tools/xabuild/xabuild.csproj
msbuild tools/xabuild/xabuild.csproj /restore

8. (For Microsoft team members only - Optional) In a [Developer Command
Prompt][developer-prompt], build external proprietary git
Expand Down
6 changes: 6 additions & 0 deletions Documentation/release-notes/manifest-merger-30.0.4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### manifestmerger.jar version update to 30.0.4

The version of the [manifest merger][0] included in Xamarin.Android
has been updated from 27.1.1 to 30.0.4

[0]: https://developer.android.com/studio/build/manifest-merge.html
11 changes: 7 additions & 4 deletions src/Mono.Android/metadata
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,14 @@
~~ remaining Color methods, manually enumified ~~
<attr path="/api/package[@name='android.content.res']/class[@name='ColorStateList']/method[@name='getColorForState']" name="return">Android.Graphics.Color</attr>
-->
<attr api-since="21" path="/api/package[@name='android.app']/class[@name='ActivityManager.TaskDescription']/constructor/parameter[@name='colorPrimary']" name="type">Android.Graphics.Color</attr>
<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>
<attr path="/api/package[@name='android.content.res']/class[@name='Resources']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
<attr path="/api/package[@name='android.content.res']/class[@name='TypedArray']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
<attr path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
<attr path="/api/package[@name='android.graphics']/class[@name='Paint']/method[@name='setColor']/parameter[position()=1]" name="type">Android.Graphics.Color</attr>
<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>
<attr api-since="11" path="/api/package[@name='android.graphics.drawable']/class[@name='ColorDrawable']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
<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>
<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>
<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>
<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>
<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>
<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>
<attr path="/api/package[@name='android.text.style']/class[@name='QuoteSpan']/method[@name='getColor']" name="return">Android.Graphics.Color</attr>
Expand Down Expand Up @@ -1656,6 +1656,9 @@
<!-- C# won't let you access protected types in a sealed type, so make them public so they can be used by user code. -->
<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>

<!-- The setter 'setColor (long)' can't be merged with the existing 'virtual long Color { get; }' because it's a breaking change -->
<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>

<!--
***********************************************************************
THE FOLLOWING LINES MUST BE CREATED FOR ANY NEW PLATFORM THAT IS ADDED.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
<UsingTask TaskName="Xamarin.Android.Tasks.ImportJavaDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.JavaDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.MDoc" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.Unzip" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.UnzipToFolder" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />

<Target Name="_ExtractJavaDocJars"
Inputs="@(JavaDocJar)"
Outputs="@(JavaDocJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
<Unzip
<UnzipToFolder
Sources="@(JavaDocJar)"
DestinationDirectories="@(JavaDocJar->'$(IntermediateOutputPath)javadocs\%(FileName)')"
/>
Expand All @@ -33,7 +33,7 @@ This file is only used by binding projects. .NET 5 can eventually use it, once `
Condition=" '$(_UseLegacyJavadocImport)' == 'True' "
Inputs="@(JavaSourceJar)"
Outputs="@(JavaSourceJar->'$(IntermediateOutputPath)javadocs\%(FileName).stamp')">
<Unzip
<UnzipToFolder
Sources="@(JavaSourceJar)"
DestinationDirectories="@(JavaSourceJar->'$(IntermediateOutputPath)javasources\%(FileName)')"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ This file is imported *after* the Microsoft.NET.Sdk/Sdk.targets.
<!-- Only import this in VS 2019 16.x -->
<Import Project="Microsoft.Android.Sdk.NuGet.targets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and '$(MSBuildVersion)' &lt; '17.0' " />
<Import Project="Microsoft.Android.Sdk.ProjectCapabilities.targets" />
<Import Project="Microsoft.Android.Sdk.PropertyPages.targets" />
<Import Project="Microsoft.Android.Sdk.Publish.targets" />
<Import Project="Microsoft.Android.Sdk.RuntimeConfig.targets" />
<Import Project="Microsoft.Android.Sdk.Tooling.targets" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Xamarin.Android.Tasks
{
public class Unzip : AndroidTask
public class UnzipToFolder : AndroidTask
{
public override string TaskPrefix => "UNZ";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public static void Foo () {

[Test]
[Category ("LLVM")]
public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode)
public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode, [Values (false, true)] bool skipDebugSymbols)
{
AssertAotModeSupported (androidAotMode);

Expand All @@ -463,7 +463,12 @@ public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string andr
using (var apk = ZipHelper.OpenZip (apkPath)) {
xaAssemblySize = ZipHelper.ReadFileFromZip (apk, $"lib/{supportedAbi}/libaot-Mono.Android.dll.so").Length;
}
proj.SetProperty ("AndroidAotAdditionalArguments", "no-write-symbols");

string additionalArgs = "no-write-symbols";
if (skipDebugSymbols) {
additionalArgs += ",nodebug";
}
proj.SetProperty ("AndroidAotAdditionalArguments", additionalArgs);
Assert.IsTrue (b.Build (proj), "Second build should have succeeded.");
FileAssert.Exists (apkPath);
using (var apk = ZipHelper.OpenZip (apkPath)) {
Expand Down
31 changes: 30 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,42 @@ static bool IsEmptyAOTLibrary (TaskLoggingHelper log, string path, IELF elf)
return false;
}

bool isElf64 = elf.Class == Class.Bit64;
foreach (var entry in symtab.Entries) {
if (entry.Type == SymbolType.Function) {
return false;
}
}

if (!(isElf64 ? IsNonEmptyCodeSymbol (entry as SymbolEntry<ulong>) : IsNonEmptyCodeSymbol (entry as SymbolEntry<uint>))) {
continue;
}

// We have an entry that's in (some) executable section and has some code in it.
// Mono creates symbols which are essentially jump tables into executable code
// inside the DSO that is not accessible via any other symbol, merely a blob of
// executable code. The jump table symbols are named with the `_plt` prefix.
if (entry.Name.EndsWith ("_plt")) {
return false;
}
}
return true;

bool IsNonEmptyCodeSymbol<T> (SymbolEntry<T>? symbolEntry) where T : struct
{
if (symbolEntry == null) {
return true; // Err on the side of caution
}

Type t = typeof(T);
ulong size = 0;
if (t == typeof(System.UInt64)) {
size = (ulong)(object)symbolEntry.Size;
} else if (t == typeof(System.UInt32)) {
size = (uint)(object)symbolEntry.Size;
}

return size != 0 && symbolEntry.PointedSection.Type == SectionType.ProgBits;
}
}

static ISymbolTable? GetSymbolTable (IELF elf, string sectionName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<UsingTask TaskName="Xamarin.Android.Tasks.PrepareAbiItems" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.WriteLockFile" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="GenerateCompressedAssembliesNativeSourceFiles" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.Unzip" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />
<UsingTask TaskName="Xamarin.Android.Tasks.UnzipToFolder" AssemblyFile="Xamarin.Android.Build.Tasks.dll" />

<!--
*******************************************
Expand Down Expand Up @@ -2346,7 +2346,7 @@ because xbuild doesn't support framework reference assemblies.
<FileWrites Include="$(_UniversalApkSetIntermediate)" />
<FileWrites Include="$(OutDir)$(_AndroidPackage)-Signed.apk" />
</ItemGroup>
<Unzip Sources="$(_UniversalApkSetIntermediate)" DestinationDirectories="$(OutDir)" Files="@(_FilestoExtract)" />
<UnzipToFolder Sources="$(_UniversalApkSetIntermediate)" DestinationDirectories="$(OutDir)" Files="@(_FilestoExtract)" />
</Target>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/manifestmerger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

dependencies {
// https://mvnrepository.com/artifact/com.android.tools.build/manifest-merger
compile group: 'com.android.tools.build', name: 'manifest-merger', version: '27.1.1'
compile group: 'com.android.tools.build', name: 'manifest-merger', version: '30.0.4'
}

sourceSets {
Expand Down
1 change: 0 additions & 1 deletion tests/api-compatibility/acceptable-breakages-v10.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ CannotRemoveBaseTypeOrInterface : Type 'Java.Util.Concurrent.Atomic.DoubleAccumu
CannotRemoveBaseTypeOrInterface : Type 'Java.Util.Concurrent.Atomic.DoubleAdder' does not inherit from base type 'Java.Util.Concurrent.Atomic.Striped64' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'Java.Util.Concurrent.Atomic.LongAccumulator' does not inherit from base type 'Java.Util.Concurrent.Atomic.Striped64' in the implementation but it does in the contract.
CannotRemoveBaseTypeOrInterface : Type 'Java.Util.Concurrent.Atomic.LongAdder' does not inherit from base type 'Java.Util.Concurrent.Atomic.Striped64' in the implementation but it does in the contract.
CannotChangeAttribute : Attribute 'Android.Runtime.RegisterAttribute' on 'Android.Graphics.Paint.Color.set(Android.Graphics.Color)' changed from '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler")]' in the contract to '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler", ApiSince=29)]' in the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' exists on 'Android.Content.ContentResolver.AddPeriodicSync(Android.Accounts.Account, System.String, Android.OS.Bundle, System.Int64)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' exists on 'Android.Content.ContentResolver.CancelSync(Android.Content.SyncRequest)' in the contract but not the implementation.
CannotRemoveAttribute : Attribute 'Android.Runtime.RequiresPermissionAttribute' exists on 'Android.Content.ContentResolver.CurrentSync.get()' in the contract but not the implementation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Compat issues with assembly Mono.Android:
CannotSealType : Type 'Java.Interop.JavaTypeParametersAttribute' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
MembersMustExist : Member 'public void Java.Interop.JavaTypeParametersAttribute.TypeParameters.set(System.String[])' does not exist in the implementation but it does exist in the contract.
CannotChangeAttribute : Attribute 'Android.Runtime.RegisterAttribute' on 'Android.Graphics.Paint.Color.set(Android.Graphics.Color)' changed from '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler", ApiSince=29)]' in the contract to '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler")]' in the implementation.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Compat issues with assembly Mono.Android:
CannotChangeAttribute : Attribute 'Android.Runtime.RegisterAttribute' on 'Android.Graphics.Paint.Color.set(Android.Graphics.Color)' changed from '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler", ApiSince=29)]' in the contract to '[RegisterAttribute("setColor", "(I)V", "GetSetColor_IHandler")]' in the implementation.

0 comments on commit 0b66c55

Please sign in to comment.