Skip to content

Commit 161e275

Browse files
committed
LinkerTests.AndroidAddKeepAlives works
1 parent 0333a54 commit 161e275

File tree

1 file changed

+11
-2
lines changed
  • src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks

1 file changed

+11
-2
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/LinkerTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static IEnumerable<object[]> Get_AndroidAddKeepAlivesData ()
433433
{
434434
var ret = new List<object[]> ();
435435

436-
foreach (AndroidRuntime runtime in new[] { AndroidRuntime.MonoVM, AndroidRuntime.CoreCLR }) {
436+
foreach (AndroidRuntime runtime in Enum.GetValues (typeof (AndroidRuntime))) {
437437
// Debug configuration
438438
AddTestData (isRelease: false, setAndroidAddKeepAlivesTrue: false, setLinkModeNone: false, shouldAddKeepAlives: false, runtime);
439439

@@ -465,6 +465,10 @@ void AddTestData (bool isRelease, bool setAndroidAddKeepAlivesTrue, bool setLink
465465
[TestCaseSource (nameof (Get_AndroidAddKeepAlivesData))]
466466
public void AndroidAddKeepAlives (bool isRelease, bool setAndroidAddKeepAlivesTrue, bool setLinkModeNone, bool shouldAddKeepAlives, AndroidRuntime runtime)
467467
{
468+
if (IgnoreUnsupportedConfiguration (runtime, release: isRelease)) {
469+
return;
470+
}
471+
468472
if (runtime == AndroidRuntime.CoreCLR && isRelease && !setAndroidAddKeepAlivesTrue && setLinkModeNone && shouldAddKeepAlives) {
469473
// This currently fails with the following exception:
470474
//
@@ -529,7 +533,12 @@ public unsafe bool MyMethod (Android.OS.IBinder windowToken, [global::Android.Ru
529533
var assemblyFile = "UnnamedProject.dll";
530534
if (!isRelease || setLinkModeNone) {
531535
foreach (string abi in proj.GetRuntimeIdentifiersAsAbis ()) {
532-
CheckAssembly (b.Output.GetIntermediaryPath (Path.Combine ("android", "assets", abi, assemblyFile)), projectDir);
536+
string assemblyDir = runtime switch {
537+
AndroidRuntime.NativeAOT => Path.Combine (MonoAndroidHelper.AbiToRid (abi), "linked"),
538+
_ => Path.Combine ("android", "assets", abi)
539+
};
540+
541+
CheckAssembly (b.Output.GetIntermediaryPath (Path.Combine (assemblyDir, assemblyFile)), projectDir);
533542
}
534543
} else {
535544
CheckAssembly (BuildTest.GetLinkedPath (b, true, assemblyFile), projectDir);

0 commit comments

Comments
 (0)