Skip to content

Commit

Permalink
[One .NET] Do not preserve GeneratedEnumAttribute (#5450)
Browse files Browse the repository at this point in the history
Context: #5167

The `GeneratedEnumAttribute` attribute does not need to be preserved
for runtime behavior.  It is only used for bindings.

Removing the attribute allows apps to be smaller.

`.apk` size comparison, BuildReleaseArm64False test:

	> apkdiff -f -e dll$ before.apk after.apk
	Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
	  -          39 assemblies/Mono.Android.dll
	    +         132 Resource Android.ILLink.ILLink.LinkAttributes.xml
	    -             Type Android.Runtime.GeneratedEnumAttribute
	Summary:
	  -          39 Assemblies -0.01% (of 749,078)

Note that the attribute instances removal doesn't work yet; we need
net6 illink for that.
  • Loading branch information
radekdoulik authored Jan 7, 2021
1 parent bb3a9dc commit 55dbc33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<assembly fullname="Mono.Android">
<type fullname="Android.Runtime.AnnotationAttribute" />
<type fullname="Android.Runtime.GeneratedDummyHost" />
<type fullname="Android.Runtime.GeneratedEnumAttribute" />
<type fullname="Android.Runtime.IJavaObject" />
<type fullname="Android.Runtime.JNIEnv">
<method name="Exit" />
Expand Down
3 changes: 3 additions & 0 deletions src/Mono.Android/ILLink/ILLink.LinkAttributes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
<type fullname="Android.Runtime.IntDefinitionAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
<type fullname="Android.Runtime.GeneratedEnumAttribute">
<attribute internal="RemoveAttributeInstances" />
</type>
</assembly>
</linker>

0 comments on commit 55dbc33

Please sign in to comment.