-
Notifications
You must be signed in to change notification settings - Fork 577
[TrimmableTypeMap] Use trimmable Java proxy runtime sources #11271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
882ce7c
0644b70
b1d1947
80d4af4
ac015d1
43bc2ed
92a4836
ba9363f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,28 +7,21 @@ | |
| <OutputDex>$(OutputPath)java_runtime.dex</OutputDex> | ||
| <IntermediateRuntimeOutputPath>$(IntermediateOutputPath)release</IntermediateRuntimeOutputPath> | ||
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)release.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\debug\MultiDexLoader.java;java\mono\android\debug\BuildConfig.java;java\mono\android\debug-net6\BuildConfig.java;java\mono\android\release-net6\BuildConfig.java;java\mono\android\clr\MonoPackageManager.java</RemoveItems> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\debug\MultiDexLoader.java;java\mono\android\debug-net6\BuildConfig.java;java\mono\android\debug\BuildConfig.java;java\mono\android\release\BuildConfig.java;java\mono\android\clr\MonoPackageManager.java</RemoveItems> | ||
| </_RuntimeOutput> | ||
| <_RuntimeOutput Include="$(OutputPath)java_runtime_trimmable.jar"> | ||
| <OutputJar>$(OutputPath)java_runtime_trimmable.jar</OutputJar> | ||
| <OutputDex>$(OutputPath)java_runtime_trimmable.dex</OutputDex> | ||
| <IntermediateRuntimeOutputPath>$(IntermediateOutputPath)release-trimmable</IntermediateRuntimeOutputPath> | ||
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)release-trimmable.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\debug\MultiDexLoader.java;java\mono\android\debug-net6\BuildConfig.java;java\mono\android\debug\BuildConfig.java;java\mono\android\release\BuildConfig.java;java\mono\android\MonoPackageManager.java;$(JavaInteropSourceDirectory)\src\Java.Interop\java\net\dot\jni\internal\JavaProxyObject.java;$(JavaInteropSourceDirectory)\src\Java.Interop\java\net\dot\jni\internal\JavaProxyThrowable.java</RemoveItems> | ||
| <AddItems>java-trimmable\net\dot\jni\internal\JavaProxyObject.java;java-trimmable\net\dot\jni\internal\JavaProxyThrowable.java</AddItems> | ||
| </_RuntimeOutput> | ||
| <_RuntimeOutput Include="$(OutputPath)java_runtime_fastdev.jar"> | ||
| <OutputJar>$(OutputPath)java_runtime_fastdev.jar</OutputJar> | ||
| <OutputDex>$(OutputPath)java_runtime_fastdev.dex</OutputDex> | ||
| <IntermediateRuntimeOutputPath>$(IntermediateOutputPath)fastdev</IntermediateRuntimeOutputPath> | ||
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)fastdev.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\release\MultiDexLoader.java;java\mono\android\release\BuildConfig.java;java\mono\android\release-net6\BuildConfig.java;java\mono\android\debug-net6\BuildConfig.java;java\mono\android\clr\MonoPackageManager.java</RemoveItems> | ||
| </_RuntimeOutput> | ||
|
|
||
| <_RuntimeOutput Include="$(OutputPath)java_runtime_net6.jar"> | ||
| <OutputJar>$(OutputPath)java_runtime_net6.jar</OutputJar> | ||
| <OutputDex>$(OutputPath)java_runtime_net6.dex</OutputDex> | ||
| <IntermediateRuntimeOutputPath>$(IntermediateOutputPath)release-net6</IntermediateRuntimeOutputPath> | ||
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)release-net6.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\debug\MultiDexLoader.java;java\mono\android\debug-net6\BuildConfig.java;java\mono\android\debug\BuildConfig.java;java\mono\android\release\BuildConfig.java;java\mono\android\clr\MonoPackageManager.java</RemoveItems> | ||
| </_RuntimeOutput> | ||
| <_RuntimeOutput Include="$(OutputPath)java_runtime_fastdev_net6.jar"> | ||
| <OutputJar>$(OutputPath)java_runtime_fastdev_net6.jar</OutputJar> | ||
| <OutputDex>$(OutputPath)java_runtime_fastdev_net6.dex</OutputDex> | ||
| <IntermediateRuntimeOutputPath>$(IntermediateOutputPath)fastdev-net6</IntermediateRuntimeOutputPath> | ||
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)fastdev-net6.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\release\MultiDexLoader.java;java\mono\android\release-net6\BuildConfig.java;java\mono\android\release\BuildConfig.java;java\mono\android\debug\BuildConfig.java;java\mono\android\clr\MonoPackageManager.java</RemoveItems> | ||
| </_RuntimeOutput> | ||
|
|
||
|
|
@@ -46,18 +39,33 @@ | |
| <IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)fastdev-clr.txt</IntermediateRuntimeClassesTxt> | ||
| <RemoveItems>..\..\src-ThirdParty\bazel\java\mono\android\release\MultiDexLoader.java;java\mono\android\release-net6\BuildConfig.java;java\mono\android\release\BuildConfig.java;java\mono\android\debug\BuildConfig.java;java\mono\android\MonoPackageManager.java</RemoveItems> | ||
| </_RuntimeOutput> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_net6.jar" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_net6.dex" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_fastdev_net6.jar" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_fastdev_net6.dex" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_trimmable_net6.jar" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_trimmable_net6.dex" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_trimmable_clr.jar" /> | ||
| <_ObsoleteRuntimeOutput Include="$(OutputPath)java_runtime_trimmable_clr.dex" /> | ||
| </ItemGroup> | ||
|
|
||
| <Target Name="_DeleteObsoleteJavaRuntimeArtifacts" BeforeTargets="_BuildJavaRuntimeJar"> | ||
| <Delete Files="@(_ObsoleteRuntimeOutput)" /> | ||
| </Target> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably don't have to delete these, we could just leave them.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot remove this unnecessary Target and the _ObsoleteRuntimeOutput item.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done — removed the |
||
|
|
||
| <Target Name="_BuildJavaRuntimeJar" | ||
| BeforeTargets="Build" | ||
| Inputs="@(AllRuntimeSource)" | ||
| Inputs="@(AllRuntimeSource);%(_RuntimeOutput.AddItems)" | ||
| Outputs="%(_RuntimeOutput.OutputJar)" | ||
| > | ||
| <MakeDir Directories="%(_RuntimeOutput.IntermediateRuntimeOutputPath)" /> | ||
| <MakeDir Directories="$(OutputPath)" /> | ||
| <!-- Remove stale D8 output so 'jar uf' doesn't bundle DEX into the runtime jar. --> | ||
| <Delete Files="%(_RuntimeOutput.IntermediateRuntimeOutputPath)\classes.dex" /> | ||
|
simonrozsival marked this conversation as resolved.
|
||
| <ItemGroup> | ||
| <_RuntimeSource Include="@(AllRuntimeSource)" /> | ||
| <_RuntimeSource Remove="%(_RuntimeOutput.RemoveItems)" /> | ||
| <_RuntimeSource Include="%(_RuntimeOutput.AddItems)" Condition=" '%(_RuntimeOutput.AddItems)' != '' " /> | ||
| </ItemGroup> | ||
| <WriteLinesToFile | ||
| File="%(_RuntimeOutput.IntermediateRuntimeClassesTxt)" | ||
|
|
@@ -104,6 +112,7 @@ | |
|
|
||
| <Target Name="_CleanJavaRuntimeJar" BeforeTargets="Clean"> | ||
| <Delete Files="%(_RuntimeOutput.OutputJar)" /> | ||
| <Delete Files="@(_ObsoleteRuntimeOutput)" /> | ||
| </Target> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| package net.dot.jni.internal; | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
||
| import net.dot.jni.GCUserPeerable; | ||
|
|
||
| /* package */ final class JavaProxyObject | ||
| extends java.lang.Object | ||
| implements GCUserPeerable | ||
| { | ||
| ArrayList<Object> managedReferences = new ArrayList<Object> (); | ||
|
|
||
| // This trimmable runtime copy cannot use Java.Interop's native object methods: | ||
| // those are registered through ManagedPeer.registerNativeMembers, which is not | ||
| // supported in the trimmable typemap path. | ||
| // Trimmable proxies use Java identity semantics: equals/hashCode/toString | ||
| // do not delegate to the wrapped .NET object. | ||
| @Override | ||
| public boolean equals (Object obj) | ||
| { | ||
| return this == obj; | ||
| } | ||
|
simonrozsival marked this conversation as resolved.
|
||
|
|
||
| @Override | ||
| public int hashCode () | ||
| { | ||
| return System.identityHashCode (this); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString () | ||
| { | ||
| return super.toString (); | ||
| } | ||
|
|
||
| public void jiAddManagedReference (java.lang.Object obj) | ||
| { | ||
| managedReferences.add (obj); | ||
| } | ||
|
|
||
| public void jiClearManagedReferences () | ||
| { | ||
| managedReferences.clear (); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| package net.dot.jni.internal; | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
||
| import net.dot.jni.GCUserPeerable; | ||
|
|
||
| /* package */ final class JavaProxyThrowable | ||
| extends java.lang.Error | ||
| implements GCUserPeerable | ||
| { | ||
| ArrayList<Object> managedReferences = new ArrayList<Object> (); | ||
|
|
||
| public JavaProxyThrowable () | ||
| { | ||
| } | ||
|
|
||
| public JavaProxyThrowable (String message) | ||
| { | ||
| super (message); | ||
| } | ||
|
|
||
| public void jiAddManagedReference (java.lang.Object obj) | ||
| { | ||
| managedReferences.add (obj); | ||
| } | ||
|
|
||
| public void jiClearManagedReferences () | ||
| { | ||
| managedReferences.clear (); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.