[TrimmableTypeMap] Use trimmable virtual-constructor fixtures#11274
Draft
simonrozsival wants to merge 1 commit intotrimmable-java-proxy-objectfrom
Draft
[TrimmableTypeMap] Use trimmable virtual-constructor fixtures#11274simonrozsival wants to merge 1 commit intotrimmable-java-proxy-objectfrom
simonrozsival wants to merge 1 commit intotrimmable-java-proxy-objectfrom
Conversation
1467afa to
e66930e
Compare
711aeae to
7e2737b
Compare
Enable the Java.Interop virtual-constructor tests in the trimmable typemap lane by swapping in Android-owned Java fixtures that use Runtime.registerNatives and generated n_* callbacks instead of ManagedPeer. Teach the trimmable typemap scanner/model to emit native registrations for hand-written Java peers that opt into JniAddNativeMethodRegistrationAttribute. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e66930e to
0644b70
Compare
7e2737b to
dc13b42
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-enables
Java.InteropTests.InvokeVirtualFromConstructorTestsfor the CoreCLR trimmable typemap lane.This swaps the incompatible Java.Interop desktop-JVM fixtures for Android-owned trimmable copies that use generated
n_*callbacks and register those callbacks throughmono.android.Runtime.registerNatives(Class)instead ofManagedPeer.registerNativeMembers/ManagedPeer.construct. It also lets the trimmable typemap emit native registrations for hand-written Java peers marked withJniAddNativeMethodRegistrationAttribute.The trimmable Java fixture calls
registerNatives(Class)via reflection becauseMono.Android-Test-classes.jaris compiled bybuild-tools/scripts/Jar.targetswith onlyandroid.jarandjava-interop.jaron thejavacclasspath.mono.android.Runtimelives in the Android runtime jar/dex, so it is available when the test app runs but not when these Java fixture sources are compiled.Validation:
dotnet build src/Microsoft.Android.Sdk.TrimmableTypeMap/Microsoft.Android.Sdk.TrimmableTypeMap.csproj -v:minimalANDROID_SERIAL=emulator-5570 MSBUILDDISABLENODEREUSE=1 dotnet-local.sh build tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj -t:RunTestApp -c Debug -p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false -p:TestFixture=Java.InteropTests.InvokeVirtualFromConstructorTests -nr:false -m:1 -v:minimalNote: local validation used the PR-built Xamarin.Android.Build.Tasks / Microsoft.Android.Sdk.TrimmableTypeMap assemblies in the prepared parent local SDK; those assemblies were restored afterward.
Related issues