-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mono] Add iOS app builder project #34563
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @rolfbjarne
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think this should come as input to the task (e.g. from publish)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should better come from runtime pack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also come from the runtime pack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once you address the comments
} | ||
|
||
Process process = Process.Start(processStartInfo)!; | ||
process.ErrorDataReceived += (sender, e) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should attach ErrorDataReceived and OutputDataReceived before we start the process or we could miss some output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe also follow the recommendations from #18789 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveisok please extract the remaining work items into tracking issue
This PR adds a project with a single msbuild task. This task creates an
*.app
bundle for iOS (device or simulator) from a list of *.dll files with some simple UI (can be configured).Usage:
For
x64
(Simulator)DevTeamProvisioning
andCrossCompiler
are not required.How it works
First of all it needs a
AppDir
directory (e.g.dotnet publish
result) with:Program.dll
) it can be a hand-made xunit runner or a HelloWorld applibmono.a
,libSystem.Native.a
, etc.AotCompiler
runs FullAOT compilation and produces *.dll.o files with help of clang (it does it in parallel).Also, it creates
modules.m
file where it lists all the linking symbols from all *.dll.o.Then it creates a
CMakeLists.txt
in order to create an xcode project via cmake.That xcode project produces app bundles via
xcodebuild
command.These app bundles are ready-to-use e.g. to be deployed to simulators via
xcrun simctl install/launch
or to real devices viamlaunch
orios-deploy
tools.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