[mono] Add iOS app builder project#34563
Conversation
|
Is this a task that you're going to ship? Or is it for internal consumption? What we need is a task that only does the AOT compilation (takes the managed assemblies as input, and produces .o/.m files as output). |
@marek-safar @rolfbjarne It looks like there is a miscommunication, I was asked to make a task from my makefile scripts to produce app bundles from libraries (tests) |
| .Select(i => i.ItemSpec) | ||
| .ToArray(); | ||
| } | ||
| string[] libsToAot = Directory.GetFiles(AppDir, "*.dll") |
There was a problem hiding this comment.
I still think this should come as input to the task (e.g. from publish)
There was a problem hiding this comment.
the AppDir is basically the dotnet publish location - we need everything in the directory anyway.
Collection of files as an input makes it harder to use via command line 🙁
| Arch="$(TargetArchitecture)" | ||
| ProjectName="$(ProjectName)" | ||
| Optimized="$(Optimized)" | ||
| MonoInclude="$(BinDir)include\mono-2.0" |
There was a problem hiding this comment.
This should better come from runtime pack
There was a problem hiding this comment.
cc @steveisok @akoeplinger
how do I build the "runtime pack", I've just built my repo with build.sh -c Release -os iOS -arch arm64 -subset Mono+Libs+Libs.Tests and don't see any runtime packs. The only location where I can find mono-2.0 headers and mono-aot-cross is this $(BinDir)
There was a problem hiding this comment.
It's in a PR. You'll have to update src/mono/netcore/sample/iOS/Program.csproj when it's ready.
| ProjectName="$(ProjectName)" | ||
| Optimized="$(Optimized)" | ||
| MonoInclude="$(BinDir)include\mono-2.0" | ||
| CrossCompiler="$(BinDir)cross\mono-aot-cross" |
There was a problem hiding this comment.
This should also come from the runtime pack.
akoeplinger
left a comment
There was a problem hiding this comment.
LGTM once you address the comments
| } | ||
|
|
||
| Process process = Process.Start(processStartInfo)!; | ||
| process.ErrorDataReceived += (sender, e) => |
There was a problem hiding this comment.
We should attach ErrorDataReceived and OutputDataReceived before we start the process or we could miss some output.
There was a problem hiding this comment.
And maybe also follow the recommendations from #18789 (comment)
There was a problem hiding this comment.
We should attach ErrorDataReceived and OutputDataReceived before we start the process or we could miss some output.
Looks like it won't miss anything, furthermore you can't start listening for outputs before you start the actual process - it throws StandardOut has not been redirected or the process hasn't started yet
There was a problem hiding this comment.
#18789 (comment) doesn't apply here since I actually use the parameterless overload
|
@marek-safar I think this is good to go. We'll likely need a follow up PR once the in-tree runtime pack functionality is there. Since we want to make available some kind of test runner, I think this PR shouldn't wait. |
marek-safar
left a comment
There was a problem hiding this comment.
@steveisok please extract the remaining work items into tracking issue
This PR adds a project with a single msbuild task. This task creates an
*.appbundle for iOS (device or simulator) from a list of *.dll files with some simple UI (can be configured).Usage:
For
x64(Simulator)DevTeamProvisioningandCrossCompilerare not required.How it works
First of all it needs a
AppDirdirectory (e.g.dotnet publishresult) with:Program.dll) it can be a hand-made xunit runner or a HelloWorld applibmono.a,libSystem.Native.a, etc.AotCompilerruns FullAOT compilation and produces *.dll.o files with help of clang (it does it in parallel).Also, it creates
modules.mfile where it lists all the linking symbols from all *.dll.o.Then it creates a
CMakeLists.txtin order to create an xcode project via cmake.That xcode project produces app bundles via
xcodebuildcommand.These app bundles are ready-to-use e.g. to be deployed to simulators via
xcrun simctl install/launchor to real devices viamlaunchorios-deploytools.Notes:
FullAOT compilation is used only for arm64 builds
Some tests crash (e.g. all with remote executor)
I'll add a hand-made xunit runner app in a separate PR.
How to run the sample:
/cc @steveisok @marek-safar @akoeplinger