[nativeaot][tests] Add smoke unit runtime tests for Native AOT on iOS platforms ...
authorMilos Kotlar <kotlarmilos@gmail.com>
Fri, 14 Jul 2023 14:26:40 +0000 (16:26 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Jul 2023 14:26:40 +0000 (16:26 +0200)
* Initial commit

* Add runtime-ioslike-coreclr and runtime-ioslike-mono azp runs

* Add support for stripping debug symbols and enabling IL stripping during AOT compilation on iOS

* Use the _AppleGenerateAppBundle target from AppleBuild.targets to build the app bundle

* Update the CI to use cross-build

* Update the sample app to use the cross-build

* Disable failing tests with OperatingSystem.Is...().

* Update perf build command for Native AOT

* Update IlcToolsPath to use cross-build ilc path

* Use /p:BuildNativeAOTRuntimePack=true to pick up NativeAOT assets instead of CoreCLR

23 files changed:
eng/pipelines/common/global-build-job.yml
eng/pipelines/common/platform-matrix.yml
eng/pipelines/common/templates/runtimes/build-test-job.yml
eng/pipelines/common/templates/runtimes/test-variables.yml
eng/pipelines/common/variables.yml
eng/pipelines/common/xplat-setup.yml
eng/pipelines/coreclr/perf-non-wasm-jobs.yml
eng/pipelines/coreclr/templates/build-perf-sample-apps.yml
eng/pipelines/coreclr/templates/perf-job.yml
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml
eng/pipelines/runtime-ioslike-coreclr.yml [new file with mode: 0644]
eng/pipelines/runtime-ioslike-mono.yml [new file with mode: 0644]
src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
src/mono/msbuild/apple/build/AppleBuild.targets
src/mono/sample/iOS-NativeAOT/Makefile
src/mono/sample/iOS-NativeAOT/Program.csproj
src/tasks/AppleAppBuilder/Templates/main-simple.m
src/tests/Common/CLRTest.Execute.Bash.targets
src/tests/Directory.Build.props
src/tests/Directory.Build.targets
src/tests/build.proj
src/tests/nativeaot/SmokeTests/UnitTests/Delegates.cs

index d1332a2..3ac90ee 100644 (file)
@@ -70,6 +70,8 @@ jobs:
 
       - name: _osParameter
         value: -os ${{ parameters.osGroup }}
+      - name: _archParameter
+        value: -arch ${{ parameters.archType }}
 
       - ${{ if and(eq(parameters.osGroup, 'linux'), eq(parameters.osSubGroup, '_bionic')) }}:
         - name: _osParameter
@@ -184,7 +186,7 @@ jobs:
         - task: CodeQL3000Init@0
           displayName: Initialize CodeQL (manually-injected)
 
-      - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci -arch ${{ parameters.archType }} $(_osParameter) $(crossArg) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
+      - script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -ci $(_archParameter) $(_osParameter) $(crossArg) ${{ parameters.buildArgs }} $(_officialBuildParameter) $(_buildDarwinFrameworksParameter) $(_overrideTestScriptWindowsCmdParameter)
         displayName: Build product
         ${{ if eq(parameters.useContinueOnErrorDuringBuild, true) }}:
           continueOnError: ${{ parameters.shouldContinueOnError }}
index bae7964..8399c82 100644 (file)
@@ -674,7 +674,10 @@ jobs:
       platform: maccatalyst_x64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -693,7 +696,10 @@ jobs:
       platform: maccatalyst_arm64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -712,7 +718,10 @@ jobs:
       platform: tvos_arm64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -731,7 +740,10 @@ jobs:
       platform: tvossimulator_x64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -750,7 +762,10 @@ jobs:
       platform: tvossimulator_arm64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -769,7 +784,10 @@ jobs:
       platform: ios_arm64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -788,7 +806,10 @@ jobs:
       platform: iossimulator_x64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
@@ -807,7 +828,10 @@ jobs:
       platform: iossimulator_arm64
       shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
       jobParameters:
-        runtimeFlavor: mono
+        ${{ if eq(parameters.runtimeFlavor, '') }}:
+          runtimeFlavor: mono
+        ${{ else }}:
+          runtimeFlavor: ${{ parameters.runtimeFlavor }}
         buildConfig: ${{ parameters.buildConfig }}
         helixQueueGroup: ${{ parameters.helixQueueGroup }}
         ${{ insert }}: ${{ parameters.jobParameters }}
index 2813c45..567c1e5 100644 (file)
@@ -80,6 +80,10 @@ jobs:
         - name: runtimeFlavorArgs
           value: '-mono'
 
+      - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), in(parameters.osGroup, 'ios', 'iossimulator', 'tvos', 'tvossimulator', 'maccatalyst')) }}:
+        - name: runtimeFlavorArgs
+          value: '-nativeaot'
+
       - name: testTreeFilterArg
         value: ''
 
index 108b9f0..d3eb48f 100644 (file)
@@ -79,6 +79,10 @@ variables:
     - name: runtimeFlavorArgs
       value: '-mono'
 
+  - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), in(parameters.osGroup, 'ios', 'iossimulator', 'tvos', 'tvossimulator', 'maccatalyst')) }}:
+    - name: runtimeFlavorArgs
+      value: '-nativeaot'
+
   - name: runtimeVariantArg
     value: ''
 
index 2a757f8..9e2a737 100644 (file)
@@ -20,7 +20,7 @@ variables:
 - name: isWasmOnlyBuild
   value: ${{ in(variables['Build.DefinitionName'], 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-wasm-dbgtests', 'runtime-wasm-optional') }}
 - name: isiOSLikeOnlyBuild
-  value: ${{ in(variables['Build.DefinitionName'], 'runtime-ioslike') }}
+  value: ${{ in(variables['Build.DefinitionName'], 'runtime-ioslike', 'runtime-ioslike-mono', 'runtime-ioslike-coreclr') }}
 - name: isiOSLikeSimulatorOnlyBuild
   value: ${{ in(variables['Build.DefinitionName'], 'runtime-ioslikesimulator') }}
 - name: isAndroidOnlyBuild
@@ -32,14 +32,14 @@ variables:
 - name: isLinuxBionicOnlyBuild
   value: ${{ in(variables['Build.DefinitionName'], 'runtime-linuxbionic') }}
 - name: isRunSmokeTestsOnly
-  value: ${{ notin(variables['Build.DefinitionName'], 'runtime-extra-platforms', 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic') }}
+  value: ${{ notin(variables['Build.DefinitionName'], 'runtime-extra-platforms', 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslike-mono', 'runtime-ioslike-coreclr', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic') }}
 - name: isNotSpecificPlatformOnlyBuild
-  value: ${{ notin(variables['Build.DefinitionName'], 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic') }}
+  value: ${{ notin(variables['Build.DefinitionName'], 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslike-mono', 'runtime-ioslike-coreclr', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic') }}
 
 # We only run evaluate paths on runtime and runtime-community pipelines on PRs
 # keep in sync with /eng/pipelines/common/xplat-setup.yml
 - name: dependOnEvaluatePaths
-  value: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-community', 'runtime-extra-platforms', 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic', 'dotnet-linker-tests', 'runtime-dev-innerloop', 'runtime-coreclr superpmi-replay', 'runtime-coreclr superpmi-diffs')) }}
+  value: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-community', 'runtime-extra-platforms', 'runtime-wasm', 'runtime-wasm-libtests', 'runtime-wasm-non-libtests', 'runtime-ioslike', 'runtime-ioslike-mono', 'runtime-ioslike-coreclr', 'runtime-ioslikesimulator', 'runtime-android', 'runtime-androidemulator', 'runtime-maccatalyst', 'runtime-linuxbionic', 'dotnet-linker-tests', 'runtime-dev-innerloop', 'runtime-coreclr superpmi-replay', 'runtime-coreclr superpmi-diffs')) }}
 - name: debugOnPrReleaseOnRolling
   ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
     value: Release
index d6b8d26..b56f65e 100644 (file)
@@ -1,6 +1,7 @@
 parameters:
   jobTemplate: ''
   hostedOs: ''
+  hostedArch: ''
   osGroup: ''
   osSubgroup: ''
   archType: ''
index 6fac205..3324929 100644 (file)
@@ -107,11 +107,11 @@ jobs:
     parameters:
       jobTemplate: /eng/pipelines/common/global-build-job.yml
       buildConfig: release
-      runtimeFlavor: mono
+      runtimeFlavor: coreclr
       platforms:
       - ios_arm64
       jobParameters:
-        buildArgs: -clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(_BuildConfig)
+        buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(_BuildConfig)
         nameSuffix: iOSNativeAOT
         isOfficialBuild: false
         extraStepsTemplate: /eng/pipelines/coreclr/templates/build-perf-sample-apps.yml
@@ -223,7 +223,7 @@ jobs:
     parameters:
       jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml
       buildConfig: release
-      runtimeFlavor: mono
+      runtimeFlavor: coreclr
       platforms:
         - osx_x64
       jobParameters:
@@ -239,7 +239,7 @@ jobs:
     parameters:
       jobTemplate: /eng/pipelines/coreclr/templates/perf-job.yml
       buildConfig: release
-      runtimeFlavor: mono
+      runtimeFlavor: coreclr
       platforms:
         - osx_x64
       jobParameters:
index de6e513..b74f22d 100644 (file)
@@ -137,7 +137,7 @@ steps:
         artifactName:  ${{ parameters.artifactName }}
     - template: /eng/pipelines/common/upload-artifact-step.yml
       parameters:
-        rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
+        rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
         includeRootFolder: true
         displayName: iOS Sample App Symbols
         artifactName: iOSSampleAppSymbols
@@ -159,7 +159,7 @@ steps:
         artifactName:  ${{ parameters.artifactName }}
     - template: /eng/pipelines/common/upload-artifact-step.yml
       parameters:
-        rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/publish/app/HelloiOS/Release-iphoneos/HelloiOS.app
+        rootFolder: $(Build.SourcesDirectory)/src/mono/sample/iOS-NativeAOT/bin/ios-arm64/Bundle/HelloiOS/Release-iphoneos/HelloiOS.app
         includeRootFolder: true
         displayName: iOS Sample App NoSymbols
         artifactName: iOSSampleAppNoSymbols
index d0bc486..28d3b8e 100644 (file)
@@ -279,7 +279,7 @@ jobs:
     # Create Core_Root
     - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) $(buildConfig) $(archType) generatelayoutonly $(librariesOverrideArg) $(_crossBuildPropertyArg)
       displayName: Create Core_Root
-      condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'), ne('${{ parameters.runtimeType }}', 'wasm'))
+      condition: and(succeeded(), ne(variables.runtimeFlavorName, 'Mono'), ne('${{ parameters.runtimeType }}', 'wasm'), not(in('${{ parameters.runtimeType }}', 'AndroidMono', 'iOSMono', 'iOSNativeAOT')))
 
     # Copy the runtime directory into the testhost folder to include OOBs.
     - script: "build.cmd -subset libs.pretest -configuration release -ci -arch $(archType) -testscope innerloop /p:RuntimeArtifactsPath=$(librariesDownloadDir)\\bin\\mono\\$(osGroup).$(archType).$(buildConfigUpper) /p:RuntimeFlavor=mono;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\runtime\\net8.0-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\net8.0-$(osGroup)-$(buildConfigUpper)-$(archType)\\shared\\Microsoft.NETCore.App\\$(productVersion) /E /I /Y;xcopy $(Build.SourcesDirectory)\\artifacts\\bin\\testhost\\net8.0-$(osGroup)-$(buildConfigUpper)-$(archType)\\* $(Build.SourcesDirectory)\\.dotnet-mono /E /I /Y;copy $(Build.SourcesDirectory)\\artifacts\\bin\\coreclr\\$(osGroup).$(archType).$(buildConfigUpper)\\corerun.exe $(Build.SourcesDirectory)\\.dotnet-mono\\shared\\Microsoft.NETCore.App\\$(productVersion)\\corerun.exe"
index f856d62..6145d3e 100644 (file)
@@ -7,81 +7,120 @@ parameters:
   isExtraPlatformsBuild: false
   isiOSLikeOnlyBuild: false
   isRollingBuild: false
+  isMonoOnlyBuild: false
+  isCoreclrOnlyBuild: false
 
 jobs:
 
-#
-# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
-# Build the whole product using Mono and run libraries tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
-  parameters:
-    jobTemplate: /eng/pipelines/common/global-build-job.yml
-    helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
-    buildConfig: Release
-    runtimeFlavor: mono
-    isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
-    isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
-    platforms:
-      - ios_arm64
-      - tvos_arm64
-    variables:
-      # map dependencies variables to local variables
-      - name: librariesContainsChange
-        value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
-      - name: monoContainsChange
-        value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'] ]
-    jobParameters:
-      testGroup: innerloop
-      nameSuffix: AllSubsets_Mono
-      isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
-      buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true
-      timeoutInMinutes: 180
-      # extra steps, run tests
-      extraStepsTemplate: /eng/pipelines/libraries/helix.yml
-      extraStepsParameters:
-        creator: dotnet-bot
-        testRunNamePrefixSuffix: Mono_$(_BuildConfig)
-        extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
+- ${{ if eq(parameters.isCoreclrOnlyBuild, false) }}:
+  #
+  # iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
+  # Build the whole product using Mono and run libraries tests
+  #
+  - template: /eng/pipelines/common/platform-matrix.yml
+    parameters:
+      jobTemplate: /eng/pipelines/common/global-build-job.yml
+      helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+      buildConfig: Release
+      runtimeFlavor: mono
+      isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
+      isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
+      platforms:
+        - ios_arm64
+        - tvos_arm64
+      variables:
+        # map dependencies variables to local variables
+        - name: librariesContainsChange
+          value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
+        - name: monoContainsChange
+          value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono_excluding_wasm.containsChange'] ]
+      jobParameters:
+        testGroup: innerloop
+        nameSuffix: AllSubsets_Mono
+        isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
+        buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:EnableAdditionalTimezoneChecks=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true /p:IsManualOrRollingBuild=true
+        timeoutInMinutes: 180
+        # extra steps, run tests
+        extraStepsTemplate: /eng/pipelines/libraries/helix.yml
+        extraStepsParameters:
+          creator: dotnet-bot
+          testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+          extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
 
-#
-# Build the whole product using Mono for iOS/tvOS and run runtime tests with iOS/tvOS devices
-#
-- template: /eng/pipelines/common/platform-matrix.yml
-  parameters:
-    jobTemplate: /eng/pipelines/common/global-build-job.yml
-    helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
-    buildConfig: Release
-    runtimeFlavor: mono
-    isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
-    isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
-    platforms:
-      - ios_arm64
-      - tvos_arm64
-    variables:
-      - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
-        - name: _HelixSource
-          value: pr/dotnet/runtime/$(Build.SourceBranch)
-      - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
-        - name: _HelixSource
-          value: ci/dotnet/runtime/$(Build.SourceBranch)
-      - name: timeoutPerTestInMinutes
-        value: 60
-      - name: timeoutPerTestCollectionInMinutes
-        value: 180
-    jobParameters:
-      testGroup: innerloop
-      nameSuffix: AllSubsets_Mono_RuntimeTests
-      buildArgs: -s mono+libs -c $(_BuildConfig)
-      timeoutInMinutes: 240
-      # extra steps, run tests
-      extraVariablesTemplates:
-        - template: /eng/pipelines/common/templates/runtimes/test-variables.yml
-          parameters:
-            testGroup: innerloop
-      extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
-      extraStepsParameters:
-        creator: dotnet-bot
-        # FIXME: Currently, tracing/eventpipe tests are only enabled on iOS platforms. It should be expanded to include all runtime tests. Tracking issue: https://github.com/dotnet/runtime/issues/84254
-        testBuildArgs: tree tracing/eventpipe
-        testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+  #
+  # Build the whole product using Mono for iOS/tvOS and run runtime tests with iOS/tvOS devices
+  #
+  - template: /eng/pipelines/common/platform-matrix.yml
+    parameters:
+      jobTemplate: /eng/pipelines/common/global-build-job.yml
+      helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+      buildConfig: Release
+      runtimeFlavor: mono
+      isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
+      isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
+      platforms:
+        - ios_arm64
+        - tvos_arm64
+      variables:
+        - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
+          - name: _HelixSource
+            value: pr/dotnet/runtime/$(Build.SourceBranch)
+        - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
+          - name: _HelixSource
+            value: ci/dotnet/runtime/$(Build.SourceBranch)
+        - name: timeoutPerTestInMinutes
+          value: 60
+        - name: timeoutPerTestCollectionInMinutes
+          value: 180
+      jobParameters:
+        testGroup: innerloop
+        nameSuffix: AllSubsets_Mono_RuntimeTests
+        buildArgs: -s mono+libs -c $(_BuildConfig)
+        timeoutInMinutes: 240
+        # extra steps, run tests
+        extraVariablesTemplates:
+          - template: /eng/pipelines/common/templates/runtimes/test-variables.yml
+            parameters:
+              testGroup: innerloop
+        extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
+        extraStepsParameters:
+          creator: dotnet-bot
+          # FIXME: Currently, tracing/eventpipe tests are only enabled on iOS platforms. It should be expanded to include all runtime tests. Tracking issue: https://github.com/dotnet/runtime/issues/84254
+          testBuildArgs: tree tracing/eventpipe
+          testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+
+- ${{ if eq(parameters.isMonoOnlyBuild, false) }}:
+  #
+  # Build the whole product using NativeAOT for iOS/tvOS and run runtime tests with iOS/tvOS devices
+  #
+  - template: /eng/pipelines/common/platform-matrix.yml
+    parameters:
+      jobTemplate: /eng/pipelines/common/global-build-job.yml
+      helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+      buildConfig: Release
+      runtimeFlavor: coreclr
+      isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
+      isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
+      platforms:
+        - ios_arm64
+        - tvos_arm64
+      variables:
+        - name: timeoutPerTestInMinutes
+          value: 60
+        - name: timeoutPerTestCollectionInMinutes
+          value: 180
+      jobParameters:
+        testGroup: innerloop
+        nameSuffix: AllSubsets_NativeAOT_RuntimeTests
+        timeoutInMinutes: 240
+        buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(_BuildConfig)
+        # extra steps, run tests
+        extraVariablesTemplates:
+          - template: /eng/pipelines/common/templates/runtimes/test-variables.yml
+            parameters:
+              testGroup: innerloop
+        extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
+        extraStepsParameters:
+          creator: dotnet-bot
+          testBuildArgs: tree nativeaot/SmokeTests/UnitTests /p:BuildNativeAOTRuntimePack=true
+          testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
index 308fbd3..d764397 100644 (file)
@@ -88,3 +88,45 @@ jobs:
         # FIXME: Currently, tracing/eventpipe tests are only enabled on iOS platforms. It should be expanded to include all runtime tests. Tracking issue: https://github.com/dotnet/runtime/issues/84254
         testBuildArgs: tree tracing/eventpipe
         testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+
+#
+# Build the whole product using Native AOT for iOSSimulator/tvOSSimulator and run runtime tests with iOS/tvOS simulators
+#
+- template: /eng/pipelines/common/platform-matrix.yml
+  parameters:
+    jobTemplate: /eng/pipelines/common/global-build-job.yml
+    helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+    buildConfig: Release
+    runtimeFlavor: coreclr
+    isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
+    isiOSLikeOnlyBuild: ${{ parameters.isiOSLikeOnlyBuild }}
+    platforms:
+      - iossimulator_x64
+      - tvossimulator_x64
+      - iossimulator_arm64
+    variables:
+      - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
+        - name: _HelixSource
+          value: pr/dotnet/runtime/$(Build.SourceBranch)
+      - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
+        - name: _HelixSource
+          value: ci/dotnet/runtime/$(Build.SourceBranch)
+      - name: timeoutPerTestInMinutes
+        value: 60
+      - name: timeoutPerTestCollectionInMinutes
+        value: 180
+    jobParameters:
+      testGroup: innerloop
+      nameSuffix: AllSubsets_NativeAOT_RuntimeTests
+      timeoutInMinutes: 240
+      buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(_BuildConfig)
+      # extra steps, run tests
+      extraVariablesTemplates:
+        - template: /eng/pipelines/common/templates/runtimes/test-variables.yml
+          parameters:
+            testGroup: innerloop
+      extraStepsTemplate: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
+      extraStepsParameters:
+        creator: dotnet-bot
+        testBuildArgs: tree nativeaot/SmokeTests/UnitTests /p:BuildNativeAOTRuntimePack=true
+        testRunNamePrefixSuffix: NativeAOT_$(_BuildConfig)
diff --git a/eng/pipelines/runtime-ioslike-coreclr.yml b/eng/pipelines/runtime-ioslike-coreclr.yml
new file mode 100644 (file)
index 0000000..dd82731
--- /dev/null
@@ -0,0 +1,19 @@
+# This is a wrapper yml for `runtime-extra-platforms-ioslike.yml`, which runs Native AOT iOS/tvOS runtime tests.
+
+trigger: none
+
+variables:
+  - template: /eng/pipelines/common/variables.yml
+
+extends:
+  template:  /eng/pipelines/common/templates/pipeline-with-resources.yml
+  parameters:
+    stages:
+    - stage: Build
+      jobs:
+      - template: /eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
+        parameters:
+          isExtraPlatformsBuild: ${{ variables.isExtraPlatformsBuild }}
+          isiOSLikeOnlyBuild: ${{ variables.isiOSLikeOnlyBuild }}
+          isRollingBuild: ${{ variables.isRollingBuild }}
+          isCoreclrOnlyBuild: true
diff --git a/eng/pipelines/runtime-ioslike-mono.yml b/eng/pipelines/runtime-ioslike-mono.yml
new file mode 100644 (file)
index 0000000..4e32db9
--- /dev/null
@@ -0,0 +1,19 @@
+# This is a wrapper yml for `runtime-extra-platforms-ioslike.yml`, which runs Mono AOT iOS/tvOS runtime tests.
+
+trigger: none
+
+variables:
+  - template: /eng/pipelines/common/variables.yml
+
+extends:
+  template:  /eng/pipelines/common/templates/pipeline-with-resources.yml
+  parameters:
+    stages:
+    - stage: Build
+      jobs:
+      - template: /eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
+        parameters:
+          isExtraPlatformsBuild: ${{ variables.isExtraPlatformsBuild }}
+          isiOSLikeOnlyBuild: ${{ variables.isiOSLikeOnlyBuild }}
+          isRollingBuild: ${{ variables.isRollingBuild }}
+          isMonoOnlyBuild: true
index e6805c2..d8cd01c 100644 (file)
@@ -49,7 +49,7 @@
     <Error Condition="'$(RuntimeIdentifier)' == ''"
       Text="RuntimeIdentifier is required for native compilation. Try running dotnet publish with the -r option value specified." />
     <Error Condition="'$(GeneratePackageOnBuild)' == 'true'" Text="GeneratePackageOnBuild is not supported for native compilation." />
-    <Error Condition="'$(OutputType)' != 'Library' and '$(NativeLib)' != ''" Text="NativeLib requires OutputType=Library." />
+    <Error Condition="'$(OutputType)' != 'Library' and '$(NativeLib)' != '' and '$(CustomNativeMain)' != 'true'" Text="NativeLib requires OutputType=Library." />
 
     <Error Condition="'$(PublishTrimmed)' == 'false'" Text="PublishTrimmed is implied by native compilation and cannot be disabled." />
 
index f54f37b..44b2f3b 100644 (file)
     <Error Condition="'$(NativeMainSource)' != '' and !Exists('$(NativeMainSource)')" Text="Project property NativeMainSource is defined, but the specified file: '$(NativeMainSource)' does not exist." />
 
     <AppleAppBuilderTask
+      UseNativeAOTRuntime="$(UseNativeAOTRuntime)"
+      NativeDependencies="$(NativeDependencies)"
       AppDir="$(AppleBuildDir)"
       Arch="$(TargetArchitecture)"
       Assemblies="@(_AssembliesToBundleInternal)"
index 2ef3ea8..29f98c4 100644 (file)
@@ -23,22 +23,18 @@ world: build-deps all
 
 # build all dependencies: runtime, nativeAot and all the libs
 ifeq ($(USE_RUNTIME_PACKS),false)
-build-deps: build-runtime-ilc build-libs-all
+build-deps: build-runtime-libs-ilc
 else
 build-deps: build-runtime-ilc-packs build-libs-all-packs
 endif
 
 # building for host
-build-runtime-ilc:
-       $(BUILD_SCRIPT) clr+clr.aot -c $(BUILD_CONFIG)
+build-runtime-libs-ilc:
+       $(BUILD_SCRIPT) --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(BUILD_CONFIG) -os $(TARGET_OS) -arch $(TARGET_ARCH)
 
 build-runtime-ilc-packs:
        $(BUILD_SCRIPT) clr+clr.aot+libs+packs -c $(BUILD_CONFIG)
 
-# building for target platform
-build-libs-all:
-       $(BUILD_SCRIPT) clr.nativeaotruntime+clr.nativeaotlibs+libs -c $(BUILD_CONFIG) -os $(TARGET_OS) -arch $(TARGET_ARCH)
-
 build-libs-all-packs:
        $(BUILD_SCRIPT) clr.nativeaotruntime+clr.nativeaotlibs+libs+packs -c $(BUILD_CONFIG) -os $(TARGET_OS) -arch $(TARGET_ARCH) /p:BuildNativeAOTRuntimePack=true
 
index 89862c9..7a60866 100644 (file)
@@ -9,7 +9,6 @@
     <RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture)</RuntimeIdentifier>
     <AppName>HelloiOS</AppName>
     <UseNativeAOTRuntime Condition="'$(UseNativeAOTRuntime)' == ''">true</UseNativeAOTRuntime>
-    <PublishDir Condition="'$(PublishDir)' == ''">$(OutputPath)/publish</PublishDir>
     <NativeLib>static</NativeLib>
     <CustomNativeMain>true</CustomNativeMain>
     <!-- Escape NativeAOT bundling targets -->
@@ -47,8 +46,7 @@
   <Target Name="ConfigureIlcPathsForiOSCrossCompilation" Condition="'$(PublishAotUsingRuntimePack)' != 'true'"
     BeforeTargets="SetupProperties">
       <PropertyGroup>
-        <IlcPath>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', '$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)', '$(BuildArchitecture)' ,'ilc'))</IlcPath>
-        <IlcToolsPath>$(IlcPath)</IlcToolsPath>
+        <IlcToolsPath>$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
         <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
         <IlcFrameworkPath>$(LibrariesAllBinArtifactsPath)</IlcFrameworkPath>
         <IlcFrameworkNativePath>$(LibrariesAllBinArtifactsPath)</IlcFrameworkNativePath>
@@ -60,7 +58,7 @@
     DependsOnTargets="IlcCompile;CopyFilesToPublishDirectory">
 
     <PropertyGroup>
-      <AppDir>$(MSBuildThisFileDirectory)$(PublishDir)\app</AppDir>
+      <AppDir>$(MSBuildThisFileDirectory)$(OutputPath)\Bundle</AppDir>
       <Optimized Condition="'$(Configuration)' == 'Release'">True</Optimized>
       <StripDebugSymbols Condition="'$(StripDebugSymbols)' == ''">false</StripDebugSymbols>
       <DevTeamProvisioning Condition="'$(TargetOS)' == 'maccatalyst' and '$(DevTeamProvisioning)' == ''">adhoc</DevTeamProvisioning>
@@ -91,7 +89,7 @@
         InvariantGlobalization="$(InvariantGlobalization)"
         EnableAppSandbox="$(EnableAppSandbox)"
         StripSymbolTable="$(StripDebugSymbols)"
-        AppDir="$(MSBuildThisFileDirectory)$(PublishDir)" 
+        AppDir="$(MSBuildThisFileDirectory)$(OutputPath)" 
         ExtraLinkerArguments="@(ExtraLinkerArguments)" >
         <Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
         <Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
index f34d4c9..36bf576 100644 (file)
@@ -48,7 +48,6 @@ void (*clickHandlerPtr)(void);
     [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
     [button setFrame:CGRectMake(50, 300, 200, 50)];
     [button setTitle:@"Click me (wire me up)" forState:UIControlStateNormal];
-    [button setExclusiveTouch:YES];
     [self.view addSubview:button];
 
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
index 9f8ee43..d586722 100644 (file)
@@ -417,7 +417,7 @@ CLRTestExitCode=$?
 CLRTestExpectedExitCode=0
       ]]>
       </BashCLRTestLaunchCmds>
-      <BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun' And ('$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator')">
+      <BashCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun' and ('$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst')">
       <![CDATA[
 __Command=""
 if [ ! -z ${__TestDotNetCmd+x} ] %3B then
index aae487c..4574f6c 100644 (file)
@@ -81,7 +81,7 @@
     <RunWithAndroid Condition="'$(TargetOS)' == 'android'">true</RunWithAndroid>
 
     <RunWithiOS>false</RunWithiOS>
-    <RunWithiOS Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator'">true</RunWithiOS>
+    <RunWithiOS Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'maccatalyst'">true</RunWithiOS>
 
     <MonoAot>false</MonoAot>
     <MonoAot Condition="'$(__MonoAot)' == '1'">true</MonoAot>
     <SkipTestUtilitiesReference>true</SkipTestUtilitiesReference>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(RuntimeFlavor)' == 'coreclr' and '$(TargetsAppleMobile)' == 'true'">
+    <_targetOS>$(TargetOS)</_targetOS>
+    <UseNativeAOTRuntime>true</UseNativeAOTRuntime>
+    <NativeLib>static</NativeLib>
+    <CustomNativeMain>true</CustomNativeMain>
+    <_IsApplePlatform Condition="'$(TargetsAppleMobile)' == 'true'">true</_IsApplePlatform>
+    <_IsiOSLikePlatform Condition="'$(TargetsAppleMobile)' == 'true'">true</_IsiOSLikePlatform>
+    <DsymUtilOptions Condition="'$(_IsApplePlatform)' == 'true'">--flat</DsymUtilOptions>
+    <_SymbolPrefix Condition="'$(_IsApplePlatform)' == 'true'">_</_SymbolPrefix>
+  </PropertyGroup>
+
   <Import Project="$(RepositoryEngineeringDir)testing\tests.props"  Condition="'$(IsTestsCommonProject)' != 'true'" />
   <Import Project="$(BaseOutputPath)\packages\Common\test_dependencies\test_dependencies\test_dependencies.*.props" Condition="'$(IsTestsCommonProject)' != 'true'" />
 </Project>
index e00069e..b5bec81 100644 (file)
     <TrimMode Condition="'$(EnableAggressiveTrimming)' != 'true'">partial</TrimMode>
 
     <IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
-    <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
+    <IlcToolsPath Condition="'$(TargetArchitecture)' != '$(BuildArchitecture)' or '$(TargetOS)' != '$(HostOS)'">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
     <IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
     <IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
     <IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</IlcFrameworkPath>
index 3be9564..af5f69c 100644 (file)
@@ -3,6 +3,9 @@
   <Import Project="Directory.Build.targets" />
   <Import Project="xunit-wrappers.targets" />
 
+  <Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.props" />
+  <Import Project="$(MonoProjectRoot)\msbuild\apple\build\AppleBuild.InTree.targets" />
+
   <PropertyGroup>
     <XunitTestBinBase Condition="'$(XunitTestBinBase)'==''" >$(BaseOutputPathWithConfig)</XunitTestBinBase>
     <XunitWrapperGeneratedCSDirBase>$(XunitTestBinBase)\TestWrappers\</XunitWrapperGeneratedCSDirBase>
@@ -55,7 +58,9 @@
     <ItemGroup Condition="'@(LegacyRunnableTestPaths)' != ''">
       <LegacyRunnableTestPaths Separator="$([System.String]::Copy('%(LegacyRunnableTestPaths.Identity)').IndexOfAny('\\/', $(XunitTestBinBase.Length)))" />
       <LegacyRunnableTestPaths SecondSeparator="$([System.String]::Copy('%(LegacyRunnableTestPaths.Identity)').IndexOfAny('\\/', $([MSBuild]::Add(%(LegacyRunnableTestPaths.Separator), 1))))" />
+      <LegacyRunnableTestPaths ThirdSeparator="$([System.String]::Copy('%(LegacyRunnableTestPaths.Identity)').IndexOfAny('\\/', $([MSBuild]::Add(%(LegacyRunnableTestPaths.SecondSeparator), 1))))" />
       <LegacyRunnableTestPaths Separator="%(LegacyRunnableTestPaths.SecondSeparator)" Condition="'%(LegacyRunnableTestPaths.SecondSeparator)' != '-1'" />
+      <LegacyRunnableTestPaths Separator="%(LegacyRunnableTestPaths.ThirdSeparator)" Condition="'%(LegacyRunnableTestPaths.ThirdSeparator)' != '-1' and '$(TestBuildMode)' == 'nativeaot' and '$(TargetsAppleMobile)' == 'true'" />
       <TestDirectoriesWithDup Include="$([System.String]::Copy('%(LegacyRunnableTestPaths.Identity)').Substring(0, %(LegacyRunnableTestPaths.Separator)))" />
     </ItemGroup>
 
   <UsingTask TaskName="AppleAppBuilderTask" AssemblyFile="$(AppleAppBuilderTasksAssemblyPath)" />
   <UsingTask TaskName="MonoAOTCompiler" AssemblyFile="$(MonoAOTCompilerTasksAssemblyPath)" />
 
-  <Target Name="BuildiOSApp">
+  <Target Name="BuildMonoiOSApp">
     <PropertyGroup>
       <CMDDIR_Grandparent>$([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($(_CMDDIR)))))</CMDDIR_Grandparent>
       <CategoryWithSlash>$([System.String]::Copy('$(_CMDDIR)').Replace("$(CMDDIR_Grandparent)/",""))</CategoryWithSlash>
     <Message Importance="High" Text="App: $(FinalPath)" />
   </Target>
 
+
+  <!-- This target builds a Native AOT iOS App -->
+  <Target Name="BuildNativeAOTiOSApp" DependsOnTargets="SetupOSSpecificProps">
+    <PropertyGroup>
+      <CategoryPath>$([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($(_CMDDIR)))))</CategoryPath>
+      <CategoryName>$([System.IO.Path]::GetFileName($(CategoryPath)))</CategoryName>
+      <TestRelativePath>$(CategoryName)/$([System.String]::Copy('$(_CMDDIR)').Replace("$(CategoryPath)/",""))</TestRelativePath>
+      <TestName>$([System.IO.Path]::GetFileName($(_CMDDIR)))</TestName>
+      <AppName>$([System.String]::Copy('$(TestRelativePath)').Replace('/','_'))</AppName>
+      <AppleBuildDir>$(IntermediateOutputPath)\iOSApps\$(AppName)</AppleBuildDir>
+      <FinalPath>$(XUnitTestBinBase)$(TestRelativePath)\$(AppName).app</FinalPath>
+    </PropertyGroup>
+
+    <PropertyGroup>
+      <NativeDependencies>$(IntermediateOutputPath)\..\$(TestRelativePath)\$(TestName)\native\$(TestName).o</NativeDependencies>
+      <DevTeamProvisioning>-</DevTeamProvisioning>
+      <AppleGenerateAppBundle>true</AppleGenerateAppBundle>
+      <GenerateXcodeProject>true</GenerateXcodeProject>
+      <AppleBundleDir>$(AppDir)</AppleBundleDir>
+      <RunAOTCompilation>false</RunAOTCompilation>
+      <MonoForceInterpreter>false</MonoForceInterpreter>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <_LinkerFlagsToDrop Include="@(NativeFramework->'-framework %(Identity)')" />
+      <LinkerArg Remove="@(_LinkerFlagsToDrop)" />
+      <ExtraAppLinkerArgs Include="@(LinkerArg)" />
+      <GlobalizationNativeLibs Include="$(MicrosoftNetCoreAppRuntimePackDir)runtimes/$(TargetOS)-$(TargetArchitecture)/native/icudt.dat" />
+    </ItemGroup>
+
+    <RemoveDir Directories="$(AppleBuildDir)" />
+    <RemoveDir Directories="$(AppDir)" />
+    <MakeDir Directories="$(AppleBuildDir)" />
+
+    <Copy
+        SourceFiles="@(GlobalizationNativeLibs)"
+        DestinationFolder="$(AppleBuildDir)" />
+  </Target>
+
+  <!-- This target moves app bundles to the payload directory -->
+  <Target Name="AfterAppleBuild">
+    <!-- Apparently MSBuild cannot move directories and recursively copying a
+         a directory requires writing some sort of recursive traversal
+         logic yourself. -->
+    <ItemGroup>
+      <RecursiveCopyHack Include="$(AppBundlePath)/**/*.*" />
+    </ItemGroup>
+    <MakeDir Directories="$(FinalPath)" />
+    <Copy SourceFiles="@(RecursiveCopyHack)" DestinationFolder="$(FinalPath)/%(RecursiveDir)" />
+    <RemoveDir Directories="$(AppBundlePath)" />
+    <Message Importance="High" Text="Final app: $(FinalPath)" />
+  </Target>
+
   <Target Name="BuildAlliOSApp" DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
     <ItemGroup>
       <RunProj Include="$(MSBuildProjectFile)">
     </ItemGroup>
     <MSBuild
       Projects="@(RunProj)"
-      Targets="BuildiOSApp"
+      Targets="BuildMonoiOSApp"
       BuildInParallel="true"
-      Condition="'@(TestDirectories)' != ''"
-      />
+      Condition="'@(TestDirectories)' != '' and '$(TestBuildMode)' != 'nativeaot'"
+    />
+
+    <MSBuild
+      Projects="@(RunProj)"
+      Targets="BuildNativeAOTiOSApp;_AppleGenerateAppBundle;AfterAppleBuild"
+      BuildInParallel="true"
+      Condition="'@(TestDirectories)' != '' and '$(TestBuildMode)' == 'nativeaot'"
+    />
   </Target>
 
   <Target Name="GetListOfTestCmds">
index 2617cb5..9452d87 100644 (file)
@@ -51,7 +51,12 @@ public class Delegates
             result = Fail;
         }
 
-        TestLinqExpressions.Run();
+        // ActiveIssue https://github.com/dotnet/runtime/issues/87924
+        if (!OperatingSystem.IsIOS() && !OperatingSystem.IsTvOS() && !OperatingSystem.IsMacCatalyst())
+        {
+            TestLinqExpressions.Run();
+        }
+
         TestDefaultInterfaceMethods.Run();
 
         return result;