Skip to content

Commit

Permalink
[net6] Bump DotNetPreview version to 6.0.100-preview.1.21109.8 (#5610)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
radekdoulik authored Mar 1, 2021
1 parent 439437e commit dcd1cb7
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 107 deletions.
2 changes: 1 addition & 1 deletion Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<DotNetPreviewTool Condition=" '$(DotNetPreviewTool)' == '' ">$(DotNetPreviewPath)dotnet</DotNetPreviewTool>
<!-- Version number from: https://github.com/dotnet/installer#installers-and-binaries -->
<DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">6.0.100</DotNetPreviewVersionBand>
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-preview.1.21103.13</DotNetPreviewVersionFull>
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-preview.1.21109.8</DotNetPreviewVersionFull>
<ILLinkVersionBand Condition=" '$(ILLinkVersionBand)' == '' ">6.0.0</ILLinkVersionBand>
<ILLinkVersionFull Condition=" '$(ILLinkVersionFull)' == '' ">$(ILLinkVersionBand)-alpha.1.21109.1</ILLinkVersionFull>
<WixToolPath Condition=" '$(WixToolPath)' == '' ">$(AndroidToolchainDirectory)\wix\</WixToolPath>
Expand Down
16 changes: 13 additions & 3 deletions src/Microsoft.Android.Sdk.ILLink/SetupStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
using Java.Interop.Tools.Cecil;
using Mono.Cecil;
using Mono.Linker;
using Mono.Linker.Steps;
using Mono.Tuner;
Expand All @@ -25,6 +26,8 @@ List<IStep> Steps {
}
}

static MethodInfo getReferencedAssembliesMethod = typeof (LinkContext).GetMethod ("GetReferencedAssemblies", BindingFlags.Public | BindingFlags.Instance);

protected override void Process ()
{
string tfmPaths;
Expand All @@ -43,9 +46,16 @@ protected override void Process ()
subSteps2.Add (new PreserveRegistrations (cache));
subSteps2.Add (new PreserveJavaInterfaces ());

InsertAfter (new FixAbstractMethodsStep (cache), "RemoveUnreachableBlocksStep");
InsertAfter (subSteps2, "RemoveUnreachableBlocksStep");
InsertAfter (subSteps1, "RemoveUnreachableBlocksStep");
InsertAfter (new FixAbstractMethodsStep (cache), "SetupStep");
InsertAfter (subSteps2, "SetupStep");
InsertAfter (subSteps1, "SetupStep");

// temporary workaround: this call forces illink to process all the assemblies
if (getReferencedAssembliesMethod == null)
throw new InvalidOperationException ($"Temporary linker workaround failed, {nameof (getReferencedAssembliesMethod)} is null.");

foreach (var assembly in (IEnumerable<AssemblyDefinition>)getReferencedAssembliesMethod.Invoke (Context, null))
Context.LogMessage ($"Reference assembly to process: {assembly}");

string proguardPath;
if (Context.TryGetCustomData ("ProguardConfiguration", out proguardPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ This file contains the .NET 5-specific targets to customize ILLink
<ItemGroup>
<!-- add our custom steps -->
<_TrimmerCustomSteps Include="$(MSBuildThisFileDirectory)..\tools\Microsoft.Android.Sdk.ILLink.dll">
<BeforeStep>LoadReferencesStep</BeforeStep>
<BeforeStep>MarkStep</BeforeStep>
<Type>Microsoft.Android.Sdk.ILLink.SetupStep</Type>
</_TrimmerCustomSteps>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@
"Size": 1724
},
"classes.dex": {
"Size": 316988
"Size": 316876
},
"assemblies/UnnamedProject.dll": {
"Size": 2959
},
"assemblies/System.Console.dll": {
"Size": 6214
"Size": 6202
},
"assemblies/System.Linq.dll": {
"Size": 15127
"Size": 15122
},
"assemblies/System.Private.CoreLib.dll": {
"Size": 516700
"Size": 513489
},
"assemblies/Java.Interop.dll": {
"Size": 63117
"Size": 63151
},
"assemblies/Mono.Android.dll": {
"Size": 86318
"Size": 86291
},
"lib/arm64-v8a/libxamarin-app.so": {
"Size": 68560
Expand All @@ -59,16 +59,16 @@
"Size": 100464
},
"lib/arm64-v8a/libmonosgen-2.0.so": {
"Size": 3831000
"Size": 3796008
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 250136
"Size": 247312
},
"lib/arm64-v8a/libxa-internal-api.so": {
"Size": 65480
},
"lib/arm64-v8a/libxamarin-debug-app-helper.so": {
"Size": 31672
"Size": 37408
},
"META-INF/ANDROIDD.SF": {
"Size": 2512
Expand All @@ -80,5 +80,5 @@
"Size": 2385
}
},
"PackageSize": 2938815
"PackageSize": 2926527
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
"Size": 1724
},
"classes.dex": {
"Size": 316956
"Size": 316848
},
"assemblies/UnnamedProject.dll": {
"Size": 2862
"Size": 2863
},
"assemblies/Java.Interop.dll": {
"Size": 75153
"Size": 75279
},
"assemblies/Mono.Android.dll": {
"Size": 264429
"Size": 264424
},
"assemblies/mscorlib.dll": {
"Size": 769824
"Size": 769789
},
"assemblies/System.Core.dll": {
"Size": 28190
"Size": 28191
},
"assemblies/System.dll": {
"Size": 12986
Expand All @@ -50,7 +50,7 @@
"Size": 68560
},
"lib/arm64-v8a/libmonodroid.so": {
"Size": 250696
"Size": 247872
},
"lib/arm64-v8a/libxa-internal-api.so": {
"Size": 65184
Expand Down
Loading

0 comments on commit dcd1cb7

Please sign in to comment.