Skip to content

[NativeAOT] Support library mode with NativeAOT on iOS-like platforms - #93658

Merged
ivanpovazan merged 6 commits into
dotnet:mainfrom
ivanpovazan:naot-ios-libmode
Jan 10, 2024
Merged

[NativeAOT] Support library mode with NativeAOT on iOS-like platforms#93658
ivanpovazan merged 6 commits into
dotnet:mainfrom
ivanpovazan:naot-ios-libmode

Conversation

@ivanpovazan

@ivanpovazan ivanpovazan commented Oct 18, 2023

Copy link
Copy Markdown
Member

This PR enables support for building libraries for iOS-like platforms with NativeAOT.

Changes

  • Extended NativeAOT build integration targets to support building libraries for iOS-like platforms
  • Adapted AppleAppBuilder to support bundling in library mode for both MonoAOT and NativeAOT
  • Adapted AppleAppBuilder to support bundling in library mode when targeting iOS-like devices
  • Adapted src/tests/FunctionalTests/iOS/Simulator/LibraryMode for testing the library mode on iossimulators-arm64/x64 with NativeAOT - currently this only works locally please see comments in the project file for more info
  • Added src/tests/FunctionalTests/iOS/Device/LibraryMode for testing the library mode on ios-arm64 for both MonoAOT and NativeAOT

Additional notes

To test locally one can execute the following from the repo root directory:

  • Test MonoAOT library mode on ios-arm64:

    ./dotnet.sh build /t:Test -c Debug /p:TargetOS=ios /p:TargetArchitecture=arm64 src/tests/FunctionalTests/iOS/Device/LibraryMode/iOS.Device.LibraryMode.Test.csproj /p:RuntimeFlavor=Mono
    
  • Test NativeAOT library mode on ios-arm64:

    ./dotnet.sh build /t:Test -c Debug /p:TargetOS=ios /p:TargetArchitecture=arm64 src/tests/FunctionalTests/iOS/Device/LibraryMode/iOS.Device.LibraryMode.Test.csproj /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:RuntimeFlavor=CoreCLR
    

Documentation


Fixes #88737

@ghost

ghost commented Oct 18, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @directhex
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR enables support for building libraries for iOS-like platforms with NativeAOT.

Changes

  • Extended NativeAOT build integration targets to support building libraries for iOS-like platforms
  • Adapted AppleAppBuilder to support bundling in library mode for both MonoAOT and NativeAOT
  • Adapted AppleAppBuilder to support bundling in library mode when targeting iOS-like devices
  • Adapted src/tests/FunctionalTests/iOS/Simulator/LibraryMode for testing the library mode on iossimulators-arm64/x64 with NativeAOT - currently this only works locally please see comments in the project file for more info
  • Added src/tests/FunctionalTests/iOS/Device/LibraryMode for testing the library mode on ios-arm64 for both MonoAOT and NativeAOT

Additional notes

To test locally one can execute the following from the repo root directory:

  • Test MonoAOT library mode on ios-arm64:

    ./dotnet.sh build /t:Test -c Debug /p:TargetOS=ios /p:TargetArchitecture=arm64 src/tests/FunctionalTests/iOS/Device/LibraryMode/iOS.Device.LibraryMode.Test.csproj /p:RuntimeFlavor=Mono
    
  • Test NativeAOT library mode on ios-arm64:

    ./dotnet.sh build /t:Test -c Debug /p:TargetOS=ios /p:TargetArchitecture=arm64 src/tests/FunctionalTests/iOS/Device/LibraryMode/iOS.Device.LibraryMode.Test.csproj /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:RuntimeFlavor=CoreCLR
    

Fixes #88737

Author: ivanpovazan
Assignees: ivanpovazan
Labels:

area-Infrastructure-mono

Milestone: -
Comment thread src/tasks/AppleAppBuilder/Xcode.cs Outdated
@ivanpovazan

ivanpovazan commented Oct 18, 2023

Copy link
Copy Markdown
Member Author

Failures are related:
1. Since I introduced VerifyOSSpecificTooling target, it seems I broke some dependency with tooling in the build
2. Building on Helix for the library mode tests seem to be broken

@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-ioslikesimulator

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).
Comment thread src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Outdated
Comment thread global.json Outdated
@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-ioslikesimulator

@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-ioslike

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).
1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).
@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-ioslikesimulator

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@am11 am11 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two optional nits, otherwise looks great! 👍

Comment thread src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Outdated
@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).
@ivanpovazan

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).
@ivanpovazan

Copy link
Copy Markdown
Member Author

The CI failures are unrelated.

@steveisok @rolfbjarne @jkotas could you please take another look as we would like to get this in for net9.0-p1?

@rolfbjarne rolfbjarne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkotas

jkotas commented Jan 9, 2024

Copy link
Copy Markdown
Member

@jkotas could you please take another look as we would like to get this in for net9.0-p1?

The changes in the shared native AOT files LGTM.

@MichalStrehovsky MichalStrehovsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nativeaot/BuildIntegration looks good to me too!

@ivanpovazan
ivanpovazan merged commit 3f3af5e into dotnet:main Jan 10, 2024
@ivanpovazan
ivanpovazan deleted the naot-ios-libmode branch January 10, 2024 08:57
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.