ci(sdk_v2): build the C++ core for Android in the native pipeline - #954
Draft
sheetalarkadam wants to merge 1 commit into
Draft
ci(sdk_v2): build the C++ core for Android in the native pipeline#954sheetalarkadam wants to merge 1 commit into
sheetalarkadam wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
sheetalarkadam
force-pushed
the
ci/android-native-build
branch
from
August 6, 2026 23:58
16cfb94 to
b72f5e3
Compare
Adds two cross-compiled Android stages (arm64-v8a, x86_64) to the sdk_v2 native build graph, running on the existing Linux pool via the NDK. Android resolves its native dependencies from different origins than the desktop platforms: ORT comes from the same Microsoft.ML.OnnxRuntime NuGet package, but GenAI ships as a standalone AAR on GitHub Releases. A version that exists on NuGet therefore does not necessarily exist for Android, and today nothing in CI notices - every desktop leg goes green while the Android build cannot configure at all. The stages publish `cpp-native-android-<abi>` artifacts but are deliberately not wired into either pack stage; neither the NuGet package nor the C++ SDK tgz has an Android consumer yet, so packaging is left as a separate question. Build-only for now. Emulator tests are plumbed behind a `runEmulatorTests` parameter on the x86_64 leg and can be enabled once the leg is proven stable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 24ef037b-246f-4fea-a1a3-4fae5223cb0c
sheetalarkadam
force-pushed
the
ci/android-native-build
branch
from
August 7, 2026 00:21
b72f5e3 to
d859c00
Compare
sheetalarkadam
changed the base branch from
fix/genai-android-nuget
to
fix/genai-aar-cache-staleness
August 7, 2026 00:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two cross-compiled Android stages —
arm64-v8aandx86_64— to thesdk_v2native build graph, plus a reusablesteps-build-android.ymltemplate. Both run on the existing Linux pool (onnxruntime-Ubuntu2404-AMD-CPU) via the NDK, so no new pool is needed.Why
Android resolves its native dependencies from different origins than the desktop platforms:
Microsoft.ML.OnnxRuntimeNuGetruntimes/android-{arm64,x64}Microsoft.ML.OnnxRuntimeGenAI.FoundryNuGetBecause GenAI comes from a different origin, a version that exists on NuGet does not necessarily exist as an Android AAR — and today nothing in CI notices.
That is not hypothetical.
mainis currently in exactly that state:A clean Android configure against
mainfails hard:v0.15.1 exists on NuGet but has no GitHub release, so every desktop leg is green while Android cannot configure at all. That has been true since 6f35431 ("Update ort and ort-genai package (#934)").
So this PR is expected to fail its own new Android stages on first run. That red is the point — it is the bug the stages exist to catch. Repinning is intentionally left out of this PR; see below.
Scope / decisions
runEmulatorTestsparameter on the x86_64 leg (the only ABIbuild.py --android_run_emulatorsupports) but default to off. This stage is here to guard the build and the dependency wiring; an emulator boot adds runtime and flakiness that should be opted into once the leg is proven stable.cpp-native-android-<abi>artifacts, but neither the NuGet package nor the C++ SDK tgz has an Android consumer today, and Android's differing dependency origins make packaging a separate design question..sofiles are staged, unlike the desktop legs which stage onlylibfoundry_local.so. Desktop consumers get ORT/GenAI out of band (pip on the Python side, NuGet on the C# side); an Android consumer has no such channel, so the libraries must be captured alongsidelibfoundry_local.so.29.0.14206865) and resolved from the pool image where present, falling back tosdkmanageronly if absent — so a pool image refresh cannot silently change the toolchain.Follow-ups (not in this PR)
sdk_v2/deps_versions.jsonand the matching literal in.pipelines/foundry-local-packaging.yml, and it changes the desktop dependency too, so it deserves its own PR and the judgement of whoever landed Update ort and ort-genai package #934.FindOnnxRuntimeGenAI.cmake. The AAR download is guarded on_deps/genai-android-aaralready existing (L128–L130), and the extraction directory is not keyed on the version. A local tree with a warm build dir therefore keeps linking whatever AAR it downloaded first while CMake cheerfully logs the resolved version — I hit this locally, building against a 0.14.0 AAR while the log said0.15.1. Keying the directory on${ORT_GENAI_VERSION}would fix it. CI is immune (always a fresh binary dir), which is arguably why this survived; it is the nastier of the two bugs for developers.Testing
Both ABIs build green locally with GenAI repinned to a version that has an AAR:
YAML validated locally; stage graph resolves to:
Draft because the new stages have not yet run on a real agent — the NDK-resolution step in particular needs to be confirmed against the actual pool image.