feat(mobilecore): add in-process facade + net10.0-android target for mobile hosts - #313
feat(mobilecore): add in-process facade + net10.0-android target for mobile hosts#313IoannisMaras wants to merge 3 commits into
Conversation
Adds net10.0-android as a second TargetFramework alongside the desktop net10.0 build. On Android the project compiles as a Library (no CLI entry point — Program.cs is excluded there) instead of a self-contained single-file Exe, so it can be embedded directly in a host app process instead of shelled out to as a binary. GlobalUsings.Android.cs adds #if ANDROID type aliases for OpenXML types that collide with Android SDK binding names on that target only. No behavior change on net10.0; this is purely additive multi-targeting.
officecli.mobilecore wraps WordHandler/ExcelHandler/PowerPointHandler with a small, mobile-safe surface (open/create/render/outline/get/query/set/add/ remove/save) for hosts that embed the engine directly in-process, such as an Android or iOS app. It deliberately excludes CLI parsing, MCP stdio, named pipes, watch servers, plugins, installers, browsers, subprocesses, raw package writes, and arbitrary output paths — an AI tool layer talking to this facade gets document-local operations only, never a shell. Multi-targets net10.0;net10.0-android alongside the officecli core engine patch in this branch.
Unconditional TargetFrameworks broke the desktop CLI's default build: dotnet build/run/publish with no -f now require an explicit framework once a second TargetFramework exists, and building at all without the Android SDK installed hard-fails with XA5207. Both would have broken this repo's own release CI (dotnet publish with no -f, 8-platform matrix) and any contributor building locally without Android tooling. Gate the Android target behind IncludeAndroidTarget (default off), so building/running/publishing officecli with no extra property behaves exactly as it did before this target existed. officecli.mobilecore always needs the Android target, so it requests it explicitly via ProjectReference Properties instead of requiring callers to remember to pass anything. Verified: dotnet publish src/officecli/officecli.csproj -c Release -r win-x64 -o publish --nologo (this repo's exact CI command) and plain dotnet run both succeed with no extra flags, matching pre-PR behavior.
|
Pushed a fix (87cf912) after testing this against a clean checkout more carefully: the original version made Fixed by gating the Android target behind an opt-in property ( Should not affect anything else in this PR - same two commits, same scope, just a safer default on the new target. |
What
officeclifornet10.0(existing CLI) andnet10.0-android(new: library only, noProgram.cs/CLI entry point) via<TargetFrameworks>+ per-targetOutputType/publish conditions.officecli.mobilecore, a small in-process facade (MobileDocumentSession) over the existing document engine for Android/iOS hosts that need to open, edit, and render OOXML documents in-process: no subprocess, no MCP stdio, no named pipes, no shell.Why
Embedding officecli directly in a mobile app process (so an on-device AI agent can edit a document without shelling out or running a local server) needs officecli to build as a library for
net10.0-android, and needs a narrow, mobile-safe surface instead of the full CLI/MCP/plugin/installer surface.officecli.mobilecoreintentionally exposes only: open/create, render-to-HTML, outline/get/query, set/add/remove, save. No CLI parsing, no watch server, no browser automation, no raw package writes, no arbitrary output paths.Validation
The
net10.0-androidtarget has been building and running this exact flow inside a real Android app throughout development (WebView-rendered live preview, structured mutations end to end). Reproducible without Android, same facade,net10.0desktop target:(3-line
Program.cs+ aProjectReferencetoofficecli.mobilecore.csproj. Happy to add this as a real test project in the repo if useful.)