Skip to content

Conditionally call ManagedPeer.Init() - #761

Merged
jonpryor merged 6 commits into
dotnet:masterfrom
radekdoulik:pr-conditional-managed-peer-init
Jan 11, 2021
Merged

Conditionally call ManagedPeer.Init()#761
jonpryor merged 6 commits into
dotnet:masterfrom
radekdoulik:pr-conditional-managed-peer-init

Conversation

@radekdoulik

@radekdoulikradekdoulik commented Dec 14, 2020

Copy link
Copy Markdown
Member

Context: dotnet/android#5400
Context: dotnet/android#5444

Driven by XA_JI_EXCLUDE, which will be defined
in XAConfig.props in $(JavaInteropDefineConstants), when
building for XA. The file is generated by XA's xaprep
in bin/Build$(Configuration).

Also clean old XA_INTEGRATION #if's, they are not used anymore.

Driven by `XA_JI_EXCLUDE`, which will be defined
in Xamarin.Android.props, when building for XA.
They are not used anymore
@jonpryor

Copy link
Copy Markdown
Contributor

Who is setting $(JavaInteropDefineConstants) and what is it set to?

radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request Dec 18, 2020
Context: dotnet#5400
Context: dotnet/java-interop#761
Generate `XAConfig.props` file in Java.Interop to define `XA_JI_EXCLUDE`
compilation constant.
The generated file contains properties set for Java.Interop by XA. So
far it is only setting one property, and thus doesn't necessarily be
generated. I still wanted to be written by `xaprep`, plus it might be
handy in future for other configuration.
The currently set `JavaInteropDefineConstants` property is going to be
used to disable `ManagedPeer` initialization.
We don't really use `ManagedPeer` today and it is duplicating
functionality of `ConstructorBuilder` class. The unwanted effect of
having it in JI is that it is pulling in System.Linq.Expressions, which
greatly increase assemblies size after linking.
The size reduction for simple XA app is cca 135kbytes of compressed
size.
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 27 assemblies/Mono.Android.dll
- 30 assemblies/System.Collections.Concurrent.dll
- 989 assemblies/System.Linq.dll
- 2,930 assemblies/Java.Interop.dll
- 4,514 assemblies/System.Collections.dll *1
- 4,874 assemblies/System.ObjectModel.dll *1
- 7,987 assemblies/System.Private.CoreLib.dll
- 115,284 assemblies/System.Linq.Expressions.dll *1
Summary:
- 136,635 Assemblies -14.87% (of 918,689)
- 139,506 Package size difference -1.79% (of 7,780,819)
@radekdoulik
radekdoulik marked this pull request as ready for review December 18, 2020 16:28
@radekdoulik

Copy link
Copy Markdown
MemberAuthor

Who is setting $(JavaInteropDefineConstants) and what is it set to?

I updated the PR description with that information.

Comment threadDirectory.Build.props Outdated
Comment threadsrc/Java.Interop/Java.Interop-MonoAndroid.csproj Outdated
...to a place whete `$(Configuration) is already set
@jonpryor
jonpryor merged commit a77aa33 into dotnet:masterJan 11, 2021
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request Jan 12, 2021
Context: dotnet#5400
Context: dotnet/java-interop#761
Generate `XAConfig.props` file in Java.Interop to define `XA_JI_EXCLUDE`
compilation constant.
The generated file contains properties set for Java.Interop by XA. So
far it is only setting one property, and thus doesn't necessarily be
generated. I still wanted to be written by `xaprep`, plus it might be
handy in future for other configuration.
The currently set `JavaInteropDefineConstants` property is going to be
used to disable `ManagedPeer` initialization.
We don't really use `ManagedPeer` today and it is duplicating
functionality of `ConstructorBuilder` class. The unwanted effect of
having it in JI is that it is pulling in System.Linq.Expressions, which
greatly increase assemblies size after linking.
The size reduction for simple XA app is cca 135kbytes of compressed
size.
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 27 assemblies/Mono.Android.dll
- 30 assemblies/System.Collections.Concurrent.dll
- 989 assemblies/System.Linq.dll
- 2,930 assemblies/Java.Interop.dll
- 4,514 assemblies/System.Collections.dll *1
- 4,874 assemblies/System.ObjectModel.dll *1
- 7,987 assemblies/System.Private.CoreLib.dll
- 115,284 assemblies/System.Linq.Expressions.dll *1
Summary:
- 136,635 Assemblies -14.87% (of 918,689)
- 139,506 Package size difference -1.79% (of 7,780,819)
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request Jan 12, 2021
Context: dotnet#5400
Context: dotnet/java-interop#761
Generate `XAConfig.props` file in Java.Interop to define `XA_JI_EXCLUDE`
compilation constant.
The generated file contains properties set for Java.Interop by XA. So
far it is only setting one property, and thus doesn't necessarily be
generated. I still wanted to be written by `xaprep`, plus it might be
handy in future for other configuration.
The currently set `JavaInteropDefineConstants` property is going to be
used to disable `ManagedPeer` initialization.
We don't really use `ManagedPeer` today and it is duplicating
functionality of `ConstructorBuilder` class. The unwanted effect of
having it in JI is that it is pulling in System.Linq.Expressions, which
greatly increase assemblies size after linking.
The size reduction for simple XA app is cca 135kbytes of compressed
size.
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 27 assemblies/Mono.Android.dll
- 30 assemblies/System.Collections.Concurrent.dll
- 989 assemblies/System.Linq.dll
- 2,930 assemblies/Java.Interop.dll
- 4,514 assemblies/System.Collections.dll *1
- 4,874 assemblies/System.ObjectModel.dll *1
- 7,987 assemblies/System.Private.CoreLib.dll
- 115,284 assemblies/System.Linq.Expressions.dll *1
Summary:
- 136,635 Assemblies -14.87% (of 918,689)
- 139,506 Package size difference -1.79% (of 7,780,819)
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request Jan 15, 2021
Context: dotnet#5400
Context: dotnet/java-interop#761
Generate `XAConfig.props` file in Java.Interop to define `XA_JI_EXCLUDE`
compilation constant.
The generated file contains properties set for Java.Interop by XA. So
far it is only setting one property, and thus doesn't necessarily be
generated. I still wanted to be written by `xaprep`, plus it might be
handy in future for other configuration.
The currently set `JavaInteropDefineConstants` property is going to be
used to disable `ManagedPeer` initialization.
We don't really use `ManagedPeer` today and it is duplicating
functionality of `ConstructorBuilder` class. The unwanted effect of
having it in JI is that it is pulling in System.Linq.Expressions, which
greatly increase assemblies size after linking.
The size reduction for simple XA app is cca 135kbytes of compressed
size.
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 27 assemblies/Mono.Android.dll
- 30 assemblies/System.Collections.Concurrent.dll
- 989 assemblies/System.Linq.dll
- 2,930 assemblies/Java.Interop.dll
- 4,514 assemblies/System.Collections.dll *1
- 4,874 assemblies/System.ObjectModel.dll *1
- 7,987 assemblies/System.Private.CoreLib.dll
- 115,284 assemblies/System.Linq.Expressions.dll *1
Summary:
- 136,635 Assemblies -14.87% (of 918,689)
- 139,506 Package size difference -1.79% (of 7,780,819)
@jpobstjpobst added this to the 11.2 (16.10 / 8.10) milestone Feb 2, 2021
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 12, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@radekdoulik@jonpryor@jpobst