Skip to content

Commit dcd1cb7

Browse files
authored
[net6] Bump DotNetPreview version to 6.0.100-preview.1.21109.8 (#5610)
* Bump net6 version to 6.0.100-preview.1.21109.8 * Add workaround for linker changes The linker doesn't load all assemblies anymore. We depend on processing of all assemblies before `MarkStep`. Use reflection as temporary workaround to overcome that, until we have new API in the linker available to handle our processing as part of `MarkStep`. * Simplify the workaround This also gets rid of typo in previous commit, which caused problems in XF test. * Not needed anymore * Simplified it too much We need at least use the enumerable * Update reference files * Add S.D.Common reference * Add null check with explanatory exception * Fix whitespace * Move the package reference * Add more missing references * Add more missing references
1 parent 439437e commit dcd1cb7

File tree

8 files changed

+125
-107
lines changed

8 files changed

+125
-107
lines changed

Configuration.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<DotNetPreviewTool Condition=" '$(DotNetPreviewTool)' == '' ">$(DotNetPreviewPath)dotnet</DotNetPreviewTool>
7777
<!-- Version number from: https://github.com/dotnet/installer#installers-and-binaries -->
7878
<DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">6.0.100</DotNetPreviewVersionBand>
79-
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-preview.1.21103.13</DotNetPreviewVersionFull>
79+
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-preview.1.21109.8</DotNetPreviewVersionFull>
8080
<ILLinkVersionBand Condition=" '$(ILLinkVersionBand)' == '' ">6.0.0</ILLinkVersionBand>
8181
<ILLinkVersionFull Condition=" '$(ILLinkVersionFull)' == '' ">$(ILLinkVersionBand)-alpha.1.21109.1</ILLinkVersionFull>
8282
<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(AndroidToolchainDirectory)\wix\</WixToolPath>

src/Microsoft.Android.Sdk.ILLink/SetupStep.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Reflection;
44
using Java.Interop.Tools.Cecil;
5+
using Mono.Cecil;
56
using Mono.Linker;
67
using Mono.Linker.Steps;
78
using Mono.Tuner;
@@ -25,6 +26,8 @@ List<IStep> Steps {
2526
}
2627
}
2728

29+
static MethodInfo getReferencedAssembliesMethod = typeof (LinkContext).GetMethod ("GetReferencedAssemblies", BindingFlags.Public | BindingFlags.Instance);
30+
2831
protected override void Process ()
2932
{
3033
string tfmPaths;
@@ -43,9 +46,16 @@ protected override void Process ()
4346
subSteps2.Add (new PreserveRegistrations (cache));
4447
subSteps2.Add (new PreserveJavaInterfaces ());
4548

46-
InsertAfter (new FixAbstractMethodsStep (cache), "RemoveUnreachableBlocksStep");
47-
InsertAfter (subSteps2, "RemoveUnreachableBlocksStep");
48-
InsertAfter (subSteps1, "RemoveUnreachableBlocksStep");
49+
InsertAfter (new FixAbstractMethodsStep (cache), "SetupStep");
50+
InsertAfter (subSteps2, "SetupStep");
51+
InsertAfter (subSteps1, "SetupStep");
52+
53+
// temporary workaround: this call forces illink to process all the assemblies
54+
if (getReferencedAssembliesMethod == null)
55+
throw new InvalidOperationException ($"Temporary linker workaround failed, {nameof (getReferencedAssembliesMethod)} is null.");
56+
57+
foreach (var assembly in (IEnumerable<AssemblyDefinition>)getReferencedAssembliesMethod.Invoke (Context, null))
58+
Context.LogMessage ($"Reference assembly to process: {assembly}");
4959

5060
string proguardPath;
5161
if (Context.TryGetCustomData ("ProguardConfiguration", out proguardPath))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ This file contains the .NET 5-specific targets to customize ILLink
5656
<ItemGroup>
5757
<!-- add our custom steps -->
5858
<_TrimmerCustomSteps Include="$(MSBuildThisFileDirectory)..\tools\Microsoft.Android.Sdk.ILLink.dll">
59-
<BeforeStep>LoadReferencesStep</BeforeStep>
59+
<BeforeStep>MarkStep</BeforeStep>
6060
<Type>Microsoft.Android.Sdk.ILLink.SetupStep</Type>
6161
</_TrimmerCustomSteps>
6262
</ItemGroup>

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleDotNet.apkdesc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@
2626
"Size": 1724
2727
},
2828
"classes.dex": {
29-
"Size": 316988
29+
"Size": 316876
3030
},
3131
"assemblies/UnnamedProject.dll": {
3232
"Size": 2959
3333
},
3434
"assemblies/System.Console.dll": {
35-
"Size": 6214
35+
"Size": 6202
3636
},
3737
"assemblies/System.Linq.dll": {
38-
"Size": 15127
38+
"Size": 15122
3939
},
4040
"assemblies/System.Private.CoreLib.dll": {
41-
"Size": 516700
41+
"Size": 513489
4242
},
4343
"assemblies/Java.Interop.dll": {
44-
"Size": 63117
44+
"Size": 63151
4545
},
4646
"assemblies/Mono.Android.dll": {
47-
"Size": 86318
47+
"Size": 86291
4848
},
4949
"lib/arm64-v8a/libxamarin-app.so": {
5050
"Size": 68560
@@ -59,16 +59,16 @@
5959
"Size": 100464
6060
},
6161
"lib/arm64-v8a/libmonosgen-2.0.so": {
62-
"Size": 3831000
62+
"Size": 3796008
6363
},
6464
"lib/arm64-v8a/libmonodroid.so": {
65-
"Size": 250136
65+
"Size": 247312
6666
},
6767
"lib/arm64-v8a/libxa-internal-api.so": {
6868
"Size": 65480
6969
},
7070
"lib/arm64-v8a/libxamarin-debug-app-helper.so": {
71-
"Size": 31672
71+
"Size": 37408
7272
},
7373
"META-INF/ANDROIDD.SF": {
7474
"Size": 2512
@@ -80,5 +80,5 @@
8080
"Size": 2385
8181
}
8282
},
83-
"PackageSize": 2938815
83+
"PackageSize": 2926527
8484
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Resources/Base/BuildReleaseArm64SimpleLegacy.apkdesc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@
2626
"Size": 1724
2727
},
2828
"classes.dex": {
29-
"Size": 316956
29+
"Size": 316848
3030
},
3131
"assemblies/UnnamedProject.dll": {
32-
"Size": 2862
32+
"Size": 2863
3333
},
3434
"assemblies/Java.Interop.dll": {
35-
"Size": 75153
35+
"Size": 75279
3636
},
3737
"assemblies/Mono.Android.dll": {
38-
"Size": 264429
38+
"Size": 264424
3939
},
4040
"assemblies/mscorlib.dll": {
41-
"Size": 769824
41+
"Size": 769789
4242
},
4343
"assemblies/System.Core.dll": {
44-
"Size": 28190
44+
"Size": 28191
4545
},
4646
"assemblies/System.dll": {
4747
"Size": 12986
@@ -50,7 +50,7 @@
5050
"Size": 68560
5151
},
5252
"lib/arm64-v8a/libmonodroid.so": {
53-
"Size": 250696
53+
"Size": 247872
5454
},
5555
"lib/arm64-v8a/libxa-internal-api.so": {
5656
"Size": 65184

0 commit comments

Comments
 (0)