@@ -612,17 +612,55 @@ static void Test ()
612612 } ,
613613 } ;
614614
615+ static IEnumerable < object [ ] > Get_BuildBasicApplicationFSharpData ( )
616+ {
617+ var ret = new List < object [ ] > ( ) ;
618+
619+ // TODO: AndroidRuntime.NativeAOT doesn't work yet. Fails with
620+ //
621+ // Microsoft.Android.Sdk.Aot.targets(123,5): error : Runtime critical type System.RuntimeMethodHandle not found
622+ foreach ( AndroidRuntime runtime in new [ ] { AndroidRuntime . MonoVM , AndroidRuntime . CoreCLR } ) {
623+ AddTestData ( isRelease : false , aot : false , runtime ) ;
624+ AddTestData ( isRelease : true , aot : false , runtime ) ;
625+ AddTestData ( isRelease : true , aot : true , runtime ) ;
626+ }
627+
628+ return ret ;
629+
630+ void AddTestData ( bool isRelease , bool aot , AndroidRuntime runtime )
631+ {
632+ ret . Add ( new object [ ] {
633+ isRelease ,
634+ aot ,
635+ runtime ,
636+ } ) ;
637+ }
638+ }
639+
615640 [ Test ]
616- [ TestCaseSource ( nameof ( BuildBasicApplicationFSharpSource ) ) ]
641+ [ TestCaseSource ( nameof ( Get_BuildBasicApplicationFSharpData ) ) ]
617642 [ Category ( "Minor" ) , Category ( "FSharp" ) ]
618643 [ NonParallelizable ] // parallel NuGet restore causes failures
619- public void BuildBasicApplicationFSharp ( bool isRelease , bool aot )
644+ public void BuildBasicApplicationFSharp ( bool isRelease , bool aot , AndroidRuntime runtime )
620645 {
646+ if ( runtime == AndroidRuntime . NativeAOT ) {
647+ if ( ! aot ) {
648+ Assert . Ignore ( "NativeAOT disabled for !aot" ) ;
649+ return ;
650+ }
651+ } else if ( runtime == AndroidRuntime . CoreCLR ) {
652+ if ( aot ) {
653+ Assert . Ignore ( "CoreCLR + AOT == NativeAOT" ) ;
654+ return ;
655+ }
656+ }
657+
621658 var proj = new XamarinAndroidApplicationProject {
622659 Language = XamarinAndroidProjectLanguage . FSharp ,
623660 IsRelease = isRelease ,
624661 AotAssemblies = aot ,
625662 } ;
663+ proj . SetRuntime ( runtime ) ;
626664 using var b = CreateApkBuilder ( ) ;
627665 Assert . IsTrue ( b . Build ( proj ) , "Build should have succeeded." ) ;
628666 }
0 commit comments