Skip to content

Commit d0e30f6

Browse files
[TrimmableTypeMap] Fix CoreCLR test plumbing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ad897dd commit d0e30f6

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.TypeMap.Trimmable.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,14 @@
3636
<!--
3737
Generate TypeMap assemblies and JCW files.
3838
AfterTargets="CoreCompile" so it runs after compilation.
39+
BeforeTargets="_GenerateJavaStubs" so the generated manifest + Java sources
40+
are available when _GenerateJavaStubs copies typemap sources into android/src.
3941
Uses @(ReferencePath) as the primary input (available after compilation).
4042
-->
4143
<Target Name="_GenerateTrimmableTypeMap"
4244
Condition=" '$(_AndroidTypeMapImplementation)' == 'trimmable' and '@(ReferencePath->Count())' != '0' "
4345
AfterTargets="CoreCompile"
46+
BeforeTargets="_GenerateJavaStubs"
4447
Inputs="@(ReferencePath);$(IntermediateOutputPath)$(TargetFileName);$(_AndroidManifestAbs)"
4548
Outputs="$(_TypeMapOutputDirectory)$(_TypeMapAssemblyName).dll">
4649

tests/Mono.Android-Tests/Java.Interop-Tests/Java.Interop-Tests.NET.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<Compile Include="$(JavaInteropTestDirectory)**\*.cs" Exclude="$(JavaInteropTestDirectory)obj\**;$(JavaInteropTestDirectory)bin\**" />
2626
<Compile Remove="$(JavaInteropTestDirectory)Java.Interop\JavaVMFixture.cs" />
2727
<Compile Remove="$(JavaInteropTestDirectory)Java.Interop\JniReferenceSafeHandleTest.cs" />
28+
<!-- Uses FEATURE_JNIENVIRONMENT_JI_FUNCTION_POINTERS-only APIs that are not exposed by the Android product assembly -->
29+
<Compile Remove="$(JavaInteropTestDirectory)Java.Interop\JniTypeUtf8Test.cs" />
2830
<Compile Remove="$(JavaInteropTestDirectory)obj\Release\net7.0-android/designtime/Resource.designer.cs" />
2931
</ItemGroup>
3032

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.RuntimeTests/NUnitInstrumentation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override string LogTag
2525
protected NUnitInstrumentation(IntPtr handle, JniHandleOwnership transfer)
2626
: base(handle, transfer)
2727
{
28-
if (Microsoft.Android.Runtime.RuntimeFeature.TrimmableTypeMap) {
28+
if (AppContext.TryGetSwitch ("Microsoft.Android.Runtime.RuntimeFeature.TrimmableTypeMap", out bool trimmableTypeMap) && trimmableTypeMap) {
2929
// Java.Interop-Tests fixtures that use JavaObject types (not Java.Lang.Object)
3030
// don't have JCW Java classes in the trimmable APK, and method remapping
3131
// tests require Java-side support not present in the trimmable path.
@@ -53,4 +53,4 @@ protected override IList<TestAssemblyInfo> GetTestAssemblies()
5353
};
5454
}
5555
}
56-
}
56+
}

0 commit comments

Comments
 (0)