Repository navigation
[performance] Build Android native assets on Linux - #4818
mattleibow wants to merge 1 commit into
Conversation
Move all four Android ABI builds into a pinned Azure Linux Android container and make those artifacts the canonical native merge inputs. Remove the redundant Windows and macOS Android jobs while preserving the existing source build, symbol extraction, and alignment validation paths. Co-authored-by: Copilot App <[email protected]>
📦 Try the packages from this PRWarning Do not run these scripts without first reviewing the code in this PR. Step 1 — Download the packages bash / macOS / Linux: curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4818PowerShell / Windows: iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4818"Step 2 — Add the local NuGet source dotnet nuget add source ~/.skiasharp/hives/pr-4818/packages --name skiasharp-pr-4818More options
Or download manually from Azure Pipelines — look for the Remove the source when you're done: dotnet nuget remove source skiasharp-pr-4818 |
|
📖 Documentation Preview The documentation for this PR has been deployed and is available at: 🔗 View Staging Site This preview will be updated automatically when you push new commits to this PR. This comment is automatically updated by the documentation staging workflow. |
📊 SkiaSharp benchmarks — PR #4818⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS
Highlights⏱️ Time — 🔴 40 slower · 🟢 30 faster
📦 Allocations — 🔴 1 more alloc · 🟢 0 less alloc
Full per-OS benchmark deltasLinux⏱️ Time (vs 🌙 nightly
📦 Allocations (vs 🌙 nightly
Windows⏱️ Time (vs 🌙 nightly
macOS⏱️ Time (vs 🌙 nightly
|
📦 Artifact size reportPackages from this PR (build Total Packages
+37 package(s) unchanged (< 50.0 KB). Per-file changes
|
| File | Size |
|---|---|
🧬 android-x86 (runtimes/android-x86/native/libSkiaSharp.so) |
11.8 MB → 11.0 MB (🟢 −802.2 KB) |
SkiaSharp.NativeAssets.WinUI
| File | Size |
|---|---|
runtimes/win-x64/native/libGLESv2.pdb |
66.6 MB → 66.5 MB (🟢 −96.0 KB) |
runtimes/win-arm64/native/libGLESv2.pdb |
64.5 MB → 64.4 MB (🟢 −80.0 KB) |
runtimes/win-x86/native/libGLESv2.pdb |
67.2 MB → 67.2 MB (🟢 −32.0 KB) |
Informational only — this never blocks the PR. Native binaries are labelled by os/arch.
Build all four shipping Android ABIs in the pinned Linux container, remove the Windows and macOS duplicates, and consume the Linux artifacts in native merge.\n\nCo-authored-by: Copilot App <[email protected]>\nCopilot-Session: aaededd0-4f67-43d2-9c48-94ae5d66f885
|
Combined into #4815 so the native setup, Linux Docker Android migration, and package build reductions can be reviewed and merged as one performance change. |
[performance] Build Android on Linux and reduce CI overhead (#4815) Context: #4816 Context: #4818 Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1557164 Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1559377 Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1559994 Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1560012 Context: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15017102 Context: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15030082 Context: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15032120 Context: https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15032942 Move Android native production to four Linux-container jobs, make native bootstrap setup match the work each job performs, and stop special-package creation from rebuilding managed outputs. The final cache-disabled public run completed in 3h30m15s instead of 6h17m44s for cold main; raw agent usage fell from 3,087.2 to 1,562.4 minutes. Main receives additional policy-injected work, so those are end-to-end operational figures; the direct task and topology measurements below are the causal evidence. The final public run succeeded end to end. DevDiv native and package/signing runs also succeeded. Its test run passed managed builds, samples, and every test job except a macOS tests-netcore job canceled at 180 minutes without a product or test error. Exact-main DevDiv and the automatic public PR run reproduced the same timeout, while the cache-disabled final run passed macOS tests, so the hang was accepted as pre-existing and non-blocking. ~~ Native bootstrap and checkout ~~ Container-native jobs installed Python, Ninja, and .NET on the host even though the toolchain and Cake invocation run inside the image. Native source jobs also initialized every submodule, while merge-only jobs fetched source they never used and configured build variables a second time on cache misses. Skip host Ninja and .NET for Docker-native jobs, retain Python whenever direct execution or cache-key computation needs it, and preserve every direct Windows/macOS prerequisite. Source jobs now initialize only Skia and depot_tools; merge jobs initialize no submodules; build variables are configured once. The new controls default to the old managed-job behavior. Across the paired runs, full recursive submodule checkouts fell from 65 to zero, replaced by 56 targeted native checkouts. Python selection fell from 88 to 38, Ninja installation from 61 to 15, and .NET installation from 85 to 39, while the 119 required artifact downloads were preserved. ~~ Android native production ~~ The four Android ABIs were built on Windows and duplicated on macOS even though native merge consumed only the Windows artifacts. Enable the existing Android Cake targets on Linux, build x86, x64, arm, and arm64 in four parallel Docker jobs, remove both host matrices, and make the Linux artifacts canonical merge inputs. The image tracks Microsoft's Azure Linux Android prerequisite tag, verifies NDK r27c (27.2.12479018) and Ninja, and installs .NET SDK 10.0.108 with the repository's standard dotnet-install script because the prerequisite image does not contain the SDK. Startup diagnostics record the NDK path, CPU count, and Ninja version. The moving base tag is not part of the output-cache key, so a remote tag update is consumed only after a cache miss, cache-disabled run, or tracked input change; it is deliberately not pinned by digest. This replaces eight host jobs with four Linux jobs. In the paired cold runs, Android agent usage fell from 429.9 to 61.6 minutes and the critical job from 1h14m10s to 15m34s. Across all four ABIs, both native libraries retained the four-file .so/.dbg inventory, matching ELF machines, exported dynamic symbols, DT_NEEDED sets, GNU debug links, and 0x4000 LOAD alignment. ~~ Special-package work ~~ nuget-special creates internal wrapper packages from existing native, normal NuGet, and symbol outputs, but its root target depended on libs and rebuilt the managed graph. Its separate job also installed Node, Android SDK/JDK, workloads, and every submodule even though none participates in wrapper creation. Remove the libs dependency while keeping normal and special packaging as separate, ordered jobs. Normal packaging keeps Node for TypeScript-backed projects and checks out only the API-docs submodule. Special packaging consumes the published normal/native artifacts, checks out no submodules, and skips Node, Android, and workload provisioning while retaining the .NET SDK, tool restore, and Visual Studio selection. Output rearrangement runs only on cache misses so restored artifacts keep their published layout. The package stage fell from 2h21m00s to 43m36s, with the special job falling from 1h08m07s to 12m51s. All six package artifacts remained, their sizes matched cold main within 1%, package scanning passed, and DevDiv signing completed. Co-authored-by: Matthew Leibowitz <[email protected]> Co-authored-by: Copilot App <[email protected]>
Description
Build the four shipping Android native ABIs in parallel on Linux using a dedicated thin Azure Linux Android container instead of provisioning Windows hosts.
The image uses Microsoft's prepared
dotnet-buildtools/prereqsAzure Linux 3.0 Android image pinned by immutable manifest digest. It validates the included NDK as r27c (27.2.12479018), installs .NET SDK 10.0.108 from the official archive after verifying its published SHA-512, and confirms Ninja is available. The startup log records the NDK path, Ninja version, and container CPU count.Windows and macOS Android jobs are removed per the final host-coverage decision. The four Linux artifacts become the canonical inputs to native merge. The existing Cake path still performs the same GN/NDK builds, feature configuration, debug-symbol extraction, stripping, GNU debug links, and 16 KiB LOAD-alignment checks.
Performance
Uncached public definition-345 runs:
This saves 22m17s / 26.8% of Android agent time and 5m09s / 24.4% on the Android critical path. The Linux jobs spent 1m54s-2m08s building the thin image and 11m13s-11m29s in the source bootstrapper. Native Linux stage duration was 26m15s; build queue wait was 6m25s.
Related issues
N/A.
Required skia PR
None.
Areas affected
binding/)externals/skia/src/c,include/c)Changes
None — CI-only; no public API, ABI, shipped Android ABI, package content, security scan, or observable runtime behavior changes.
Testing
Uncached public definition-345 build 1559377 validated merge commit
e047804f60d6c23673c501b38c256fb5eed39cadend to end:native_android_*_linuxartifacts;native,native_linux, andnative_wasmartifacts published successfully.libSkiaSharp.so,libSkiaSharp.so.dbg,libHarfBuzzSharp.so, andlibHarfBuzzSharp.so.dbg.DT_NEEDEDsets match exactly for all eight library comparisons..socontains its GNU debug link.buildAgentLinuxNative, with no Windows/macOS Android source jobs.The complete run succeeded before automation resumed, so downstream stages were not canceled in time; this does not affect the native timing or artifact evidence above.
Checklist
Changesabove lists all public API and behavioral changes (or "None.")mono/skiaPR required