Arcadia
Arcadia copied to clipboard
REPL in exported App
Optionally embed a REPL in an exported app for debugging and instrumentation.
This would be amazing; has there been any work done for it?
It is theoretically possible on some platforms, but we have not had a chance to try it yet. Short answer: it should work on exported desktop games, probably won't ever work on mobile or consoles.
Long answer: some export platforms disallow runtime code emission, i.e. the generation of new executable code while a program is running. This is done for security reasons and happens on the kernel level, so we can't sidestep it. We've confirmed this to be the case on iOS, the web and the PS4, but it probably applies to all mobile and console targets as well.
A Clojure REPL emits code when it compiles and executes forms, so an exported REPL on these platforms will never be possible given the current compiler architecture. This limitation is also what makes exporting normal Clojure code to these platforms difficult, as the compiler uses optimizations that modify the bytecode at runtime, which is also rejected by these platforms for the same reason.
Confirmed working on desktop and Android! Just need to clean it up a bit. It will be in the first alpha.
Wait, Arcadia is working on Android now as well? I didn't use it for my last project because I was told Android wasn't supported (IL2CPP issues).
Yeah! We've learned not to trust what we read and just build things. Unity doesn't AOT anything for Android, it seems. We have export and a REPL on the device.
Badass! Nice work and thanks for the update.
maybe this issue should include:
- fixing up
arcadia.replto be a buildable ns - fixing android export (currently you have to manually AOT your project and copy to build?)
arcadia.replis very close, its really our config story thats still something of a mess and editor dependent- android export should Just Work, but only
clojure.core,arcadia.coreand the namespaces of vars on your hooks (and their requires) will be automatically AOT'd. If you want more namespaces to show up in the exported app, you need to:requirethem or manually AOT them.
I think reader conditionals would help a lot with this. Maybe we can map Unity's #define directives to arcadia specific keywords like :unity-editor, :unity-android, etc.
ah ok wasn't sure if the android build aot stuff had been fixed or not.
reader conditionals for build target/editor would be very cool, or at the least some sort of ns meta like in https://github.com/arcadia-unity/Arcadia/issues/184#issuecomment-252267986
About the android export, I'm not sure if this is a linux-specific issue but in my case BuildPostProcess was running after the apk was sent to the device which wasn't very useful. So I ended up deleting BuildPostProcess.cs and AOTing some namespaces manually.
That's a limitation of Unity's export hooks. It seems to run them after it uploads the apk. What I've done is hit Build then upload the apk myself.
- [ ] disentangle config
- [ ] use main-thread-callback (or whatever) ns for driver
- [ ] make main-thread-callback ns easily externally drivable from the main thread by a variety of mechanisms (including export-amenable ones) and have it test that it's running on the main thread