Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/gradle-test-events.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// CI (the apk-macos job of .github/workflows/release.yml): `./gradlew --init-script <this> test` prints every unit
// CI (the apk and apk-macos jobs of .github/workflows/release.yml): `./gradlew --init-script <this> test` prints every unit
// test as it starts and ends, with the whole exception of a failure, so that a test that hangs is the last
// "STARTED" line of the log and a failure shows its message without the report. Changes nothing else of the build.
allprojects {
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/gpu-patch-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jobs:
pin=$(awk '$1=="metal2vulkan" {print $3}' scripts/setup/get-references.sh)
echo "pin=$pin" >> "$GITHUB_OUTPUT"
- name: Restore executable bits (an upload drops them)
run: git ls-files -z | xargs -0 grep -lZI '^#!' 2>/dev/null | xargs -0 -r chmod +x
# git grep -z: macOS's grep has no -Z, so the old ls-files|xargs grep pipeline handed chmod one
# newline-joined name and the step failed on every runner.
run: git grep -zIl -e '^#!' | xargs -0 -r chmod +x
- name: metal2vulkan at the pin
run: |
set -euo pipefail
Expand Down
165 changes: 165 additions & 0 deletions .github/workflows/metal-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Build the Metal plug-in (NativeAdrenoMetal.bundle) on a macOS runner: Xcode's iPhoneOS SDK, the pins'
# public sources, this tree's patches — no Apple image, no shared cache (the link uses the SDK's .tbd
# stubs; the plug-in's shared-cache addresses come from userland/metal/hooks/<product>-<build>.json, which
# is committed). Manual run only; download the artifact and stage it on the phone.
#
# Actions -> metal-plugin -> Run workflow, target "iPhone18,2 24A446"
#
# What it builds, and why the flags: docs/gpu.md section 7, userland/metal/build.sh. The bundle's
# oneios-target must be the guest's (the image set's build id), or `oneios-tool image tweaks` will not
# place it; the GPU addon is the same bundle as a kernelkc.gpuaddon sidecar (oneios-tool phone addon).
name: metal-plugin
on:
workflow_dispatch:
inputs:
target:
description: 'The guest to build for: "<product> <build>" (userland/metal/hooks/<product>-<build>.json)'
required: true
default: 'iPhone18,2 24A446'
permissions:
contents: read
jobs:
build:
# xcode-27 is the image that carries the toolchain and SDK this plug-in is built for (iOS 27, arm64e); the
# generic macos-15 label only has Xcode 26 and its queue was starved ("The job was not acquired by Runner of
# type hosted even after multiple attempts"), so two runs in a row built nothing at all.
runs-on: xcode-27
timeout-minutes: 180
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Restore executable bits (an upload drops them)
# git grep -z: macOS's grep has no -Z, so the old ls-files|xargs grep pipeline handed chmod one
# newline-joined name and the step failed on every runner.
run: git grep -zIl -e '^#!' | xargs -0 -r chmod +x
- name: Validate the requested guest target before fetching toolchains
env:
ONEIOS_METAL_TARGET: ${{ inputs.target }}
run: |
set -euo pipefail
target_slug=${ONEIOS_METAL_TARGET/ /-}
case "$target_slug" in
''|*..*|*[!A-Za-z0-9,._-]*) echo "::error::Invalid Metal target: $ONEIOS_METAL_TARGET"; exit 1 ;;
esac
if [[ "$ONEIOS_METAL_TARGET" != *" "* || "${ONEIOS_METAL_TARGET#* }" == *" "* ]]; then
echo "::error::Target must be '<product> <build>': $ONEIOS_METAL_TARGET"
exit 1
fi
hooks="userland/metal/hooks/$target_slug.json"
[ -s "$hooks" ] || { echo "::error::No checked-in shared-cache hooks for $ONEIOS_METAL_TARGET ($hooks)"; exit 1; }
echo "Using target $ONEIOS_METAL_TARGET with $hooks"
- name: Xcode with the iPhoneOS SDK
timeout-minutes: 5
run: |
set -euo pipefail
# The newest Xcode the runner has; the build only needs its clang, ld and iPhoneOS SDK.
pick=$(ls -d /Applications/Xcode*.app 2>/dev/null | sort -V | tail -1 || true)
if [ -n "$pick" ]; then sudo xcode-select -s "$pick/Contents/Developer"; fi
xcodebuild -version
sdk=$(xcrun --sdk iphoneos --show-sdk-path)
echo "iPhoneOS SDK: $sdk"
# The plug-in's deployment target: 27.0 when the SDK is 27 or newer, else the SDK's own.
ver=$(sed -n 's/.*"Version" *: *"\([0-9.]*\)".*/\1/p' "$sdk/SDKSettings.json" | head -1)
case "$ver" in
2[7-9]*|[3-9][0-9]*) min=27.0 ;;
*) min=${ver%.*} ; [ -n "$min" ] || min=26.0 ;;
esac
echo "SDK $ver, the plug-in's deployment target $min"
echo "IOS_MIN=$min" >> "$GITHUB_ENV"
echo "IOS_TARGET=arm64e-apple-ios$min" >> "$GITHUB_ENV"
- name: Homebrew's build tools
timeout-minutes: 20
run: brew install ninja glslang shaderc spirv-tools bison llvm uv
- name: Build dependencies for the pinned sources
timeout-minutes: 15
run: |
set -euo pipefail
# Keep the pinned builders' Python dependencies isolated from the runner image.
uv venv --python 3.12 "$RUNNER_TEMP/py"
uv pip install --python "$RUNNER_TEMP/py/bin/python" meson mako pyyaml packaging
echo "$RUNNER_TEMP/py/bin" >> "$GITHUB_PATH"
- name: Rust 1.98.0 with rust-src (the bridge builds std for the guest)
timeout-minutes: 15
run: |
set -euo pipefail
rustup toolchain install 1.98.0 --profile minimal
rustup +1.98.0 component add rust-src
cargo +1.98.0 --version
- name: The pinned sources
timeout-minutes: 45
run: |
set -euo pipefail
# The kernel base (Droid-VM-UniXNU, the plug-in's build scripts), then the six the plug-in compiles.
kernel/fetch.sh Droid-VM-UniXNU
scripts/setup/get-references.sh NativeMetal NativeAdreno NativeMobileDisplay AdrenoPM4 metal2vulkan mesa-droidvm
scripts/setup/get-references.sh -l
- name: Check the toolchain (the image's custom stubs are optional)
timeout-minutes: 5
run: |
set -euo pipefail
if report=$(scripts/setup/ios-toolchain.sh 2>&1); then
printf '%s\n' "$report"
elif [[ "$report" == "ios toolchain: missing: the iOS 27 stubs in "*" (scripts/setup/ios-toolchain.sh --tbd, after the image set is built)" ]]; then
printf '%s\n' "$report"
echo "Using Xcode SDK stubs; this workflow has no guest image-set input."
else
printf '%s\n' "$report" >&2
echo "::error::The iOS linker toolchain check failed."
exit 1
fi
- name: Build the bundle and the GPU addon
timeout-minutes: 120
env:
ONEIOS_METAL_TARGET: ${{ inputs.target }}
JOBS: '6'
run: |
set -euo pipefail
userland/metal/build.sh all 2>&1 | tee metal-build.log
- name: Verify the target-tagged bundle and GPU addon
env:
ONEIOS_METAL_TARGET: ${{ inputs.target }}
run: |
set -euo pipefail
bundle=out/userland/NativeAdrenoMetal.bundle
addon=out/userland/NativeAdrenoMetal.gpuaddon
record=out/userland/NativeAdrenoMetal.build.json
check=out/userland/NativeAdrenoMetal.check.txt
runtime=out/userland/NativeAdrenoMetal.runtime
for file in "$bundle/NativeAdrenoMetal" "$bundle/libvulkan_freedreno.dylib" "$bundle/oneios-target" "$addon" "$record" "$check" "$runtime"; do
[ -s "$file" ] || { echo "::error::Required Metal build output is missing or empty: $file"; exit 1; }
done
[ "$(cat "$bundle/oneios-target")" = "$ONEIOS_METAL_TARGET" ] || { echo "::error::Bundle target does not match $ONEIOS_METAL_TARGET"; exit 1; }
grep -Fq "\"target\": \"$ONEIOS_METAL_TARGET\"" "$record" || { echo "::error::Build record target does not match $ONEIOS_METAL_TARGET"; exit 1; }
grep -Fq '"arch": "arm64e"' "$record" || { echo "::error::Build record does not identify arm64e binaries"; exit 1; }
grep -Fq 'ios macho-check passed' "$record" || { echo "::error::Build record does not confirm the Mach-O check"; exit 1; }
manifest=out/userland/NativeAdrenoMetal.sha256
find "$bundle" -type f -print0 | xargs -0 shasum -a 256 > "$manifest"
shasum -a 256 "$addon" "$record" "$check" "$runtime" >> "$manifest"
cat "$manifest"
{
echo "### Metal plug-in outputs verified"
echo "- Target: \`$ONEIOS_METAL_TARGET\`"
echo "- Bridge runtime: \`$(cat "$runtime")\`"
echo "- Bundle, arm64e binaries, Mach-O check, build record, and NGPUADD2 sidecar are present."
echo "- SHA-256 manifest: \`out/userland/NativeAdrenoMetal.sha256\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: What was built
if: always()
timeout-minutes: 2
run: |
set -euo pipefail
{ ls -l out/userland 2>/dev/null || true; cat out/userland/NativeAdrenoMetal.build.json 2>/dev/null || true; } | tee -a metal-build.log
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
timeout-minutes: 10
with:
name: NativeAdrenoMetal
if-no-files-found: error
retention-days: 14
path: |
out/userland/NativeAdrenoMetal.bundle
out/userland/NativeAdrenoMetal.gpuaddon
out/userland/NativeAdrenoMetal.build.json
out/userland/NativeAdrenoMetal.check.txt
out/userland/NativeAdrenoMetal.runtime
out/userland/NativeAdrenoMetal.sha256
metal-build.log
51 changes: 21 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# │ phone and oneios-tool-VERSION-android-arm64 beside the package
# ├── apk (ubuntu-24.04) app/ at the head of the fork's branch, JDK 21, tribalfs' packages,
# │ ./gradlew test assembleFullDebug, the APK's assets checked
# ├── apk-macos (macos-15) ./gradlew test of the same checkout on a Mac (core:root's script tests)
# ├── apk-macos (xcode-27) ./gradlew test of the same checkout on a Mac (core:root's script tests)
# └──────────────── release needs runtime and apk; a tag v* or a dispatch only
#
# Triggers: a pull request or a push to main builds both and releases nothing. A tag vN.N.N[-suffix] on main builds
Expand Down Expand Up @@ -96,12 +96,12 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Cache the pinned NDK (setup-build.sh's sdkmanager install becomes a restore after the first run)
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 (Node 24)
with:
path: /usr/local/lib/android/sdk/ndk/28.2.13676358
key: ci-ndk-28.2.13676358
- name: Cache the Rust toolchain and cargo (the warm builds of the tool and of the runtime ride in their target dirs)
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 (Node 24)
with:
path: |
~/.rustup
Expand Down Expand Up @@ -179,8 +179,8 @@ jobs:
d=$(mktemp -d); zstd -dc out/release/oneios-runtime-$VERSION-arm64.tar.zst | tar -x -C "$d"
runtime/package/elf-check.sh "$d"
- name: The package holds the runtime's own folders only
# runtime.json, NOTICE, LICENSE, bin/, lib/, scripts/, kernel/xnu.macho and its record: nothing of the
# fork's tree (app/) or any other part of the checkout.
# runtime.json, NOTICE, LICENSE, bin/, lib/, scripts/, kernel/xnu.macho and its record, kernel/gpuaddon and its
# CDHashes: nothing of the fork's tree (app/) or any other part of the checkout.
run: |
set -euo pipefail
a=out/release/oneios-runtime-$VERSION-arm64.tar.zst
Expand Down Expand Up @@ -271,8 +271,9 @@ jobs:
- name: mksh for the script tests
run: sudo apt-get install -y --no-install-recommends mksh || echo "::warning::mksh could not be installed; the script tests run under dash only"
- name: Unit tests and the debug APK (full edition, no packed sets)
timeout-minutes: 55
working-directory: app/app-android
run: ./gradlew --max-workers=3 test assembleFullDebug
run: timeout --signal=TERM --kill-after=30s 50m ./gradlew --max-workers=3 --console=plain --init-script "$GITHUB_WORKSPACE/.github/scripts/gradle-test-events.gradle" test assembleFullDebug
- name: Name the APK, its version
id: apk
run: |
Expand Down Expand Up @@ -325,10 +326,14 @@ jobs:
# macOS. Homebrew's folders are taken off PATH for the tests, so core:root's harness uses its own stand-ins for
# GNU stat, sha256sum, timeout and tac over macOS's own tools (the fork's docs/oneios.md): the case of a Mac without
# coreutils. Not a release gate: the release needs runtime and apk only.
#
# xcode-27, not macos-15: both are arm64 macOS images with the Android SDK and JDK 21, but the 3-core macos-15 pool
# was starved ("The job was not acquired by Runner of type hosted even after multiple attempts") and GitHub
# cancelled the job after ~15 minutes, turning every push red while plan/runtime/apk had passed.
apk-macos:
needs: plan
if: needs.plan.outputs.apk == 'true'
runs-on: macos-15
runs-on: xcode-27
timeout-minutes: 60
permissions:
contents: read
Expand Down Expand Up @@ -360,37 +365,23 @@ jobs:
"$sdkmanager" "platforms;android-37.0" "build-tools;37.0.0"
- name: Guest app
run: app/scripts/build-guest-manager.sh --debug
- name: GNU coreutils for a bounded test run
run: brew install coreutils
- name: Unit tests on macOS (./gradlew test, core:root's script tests among them)
timeout-minutes: 55
working-directory: app/app-android
env:
# 45, not 30 (2026-11-23): a good run of the fork's tests took 28 min 54 s on main (707 tests), and two runs
# on a slower macos-15 runner were still passing tests at 30 min (680 and 675 done, a different test each
# time) when the watchdog stopped them. The job's own limit is 60 min; setup takes about 8.
WATCHDOG_MIN: 45
run: |
set -euo pipefail
brew_bin=$(command -v brew)
timeout_bin=$("$brew_bin" --prefix coreutils)/bin/gtimeout
[ -x "$timeout_bin" ] || { echo "::error::GNU timeout is missing at $timeout_bin"; exit 1; }
PATH=$(printf '%s' "$PATH" | tr ':' '\n' | grep -Ev '^(/opt/homebrew|/usr/local)(/|$)' | paste -sd: -)
export PATH
for t in gstat gsha256sum gtimeout gtac gsed; do command -v "$t" > /dev/null && echo "note: $t is still on PATH: $(command -v "$t")"; done
echo "macOS $(sw_vers -productVersion), sh: $(ls -l /bin/sh | awk '{print $NF}'), stat: $(command -v stat)"
# Every test's start and end in the log (.github/scripts/gradle-test-events.gradle). The watchdog: a run
# that is not done after WATCHDOG_MIN minutes prints the processes and the test JVMs' threads (where it
# hangs), then stops Gradle, so that the failed tests and the reports below still come out (the first
# runs, 2026-11-15, hung in :core:root:testDebugUnitTest until the job's limit cancelled everything).
./gradlew --max-workers=3 --continue --init-script "$GITHUB_WORKSPACE/.github/scripts/gradle-test-events.gradle" test &
g=$!
s=0
while kill -0 "$g" 2>/dev/null; do
sleep 10; s=$((s + 10))
if [ "$s" -ge $((WATCHDOG_MIN * 60)) ]; then
echo "::error::./gradlew test is still running after $WATCHDOG_MIN minutes: the processes and the test JVMs' threads follow, then Gradle is stopped"
ps -axww -o pid,ppid,etime,state,command | grep -Ev ' (/System/|/usr/libexec/|/usr/sbin/|/sbin/launchd)' | cut -c1-400
for p in $(jps -l | awk '/Gradle Test Executor|GradleWorkerMain/ { print $1 }'); do echo "=== jstack $p"; jstack "$p" | awk '/^"/ { keep = /Test worker|main/ } keep'; done
./gradlew --stop || true; kill "$g" 2>/dev/null || true
exit 1
fi
done
wait "$g"
# Plain per-test events identify the last test reached; GNU timeout bounds the process group without an
# unbounded jstack/Gradle-stop diagnostic path. The step leaves five minutes for summaries and artifacts.
"$timeout_bin" --signal=TERM --kill-after=30s 50m ./gradlew --max-workers=3 --console=plain --continue --init-script "$GITHUB_WORKSPACE/.github/scripts/gradle-test-events.gradle" test
- name: Failed tests
if: failure()
working-directory: app/app-android
Expand Down
4 changes: 2 additions & 2 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,8 @@ second time).
## 8. Releases

A tag `vN.N.N` on `main` (or a dispatch with a version) runs `.github/workflows/release.yml`, which builds the
runtime package with the pinned NDK and the fork's APK (submodule `app/`, the head of `oneios`) on two runners at
once, and attaches both with their `.sha256` to the release. No kernel, no image, no package set. See
S24 Ultra Metal and camera plug-ins with Xcode 27.2, then packages them into the runtime alongside the pinned kernel;
the fork's APK (submodule `app/`, the head of `oneios`) builds in parallel. No image or package set is released. See
[releases.md](releases.md).
Since 2026-11-25 a release takes each plug-in build (the Metal plug-in of 27.0.1 and of 27.2.1, the capture plug-in, the
A56's) from `out/release-cache/NAME/KEY/` when its inputs (the git trees it reads, the reference checkouts' commits, the
Expand Down
2 changes: 1 addition & 1 deletion docs/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ conf keeps it too. Test: `ios16_coreimage_fixup_is_left_out_only_with_the_a56_gl

## 7. The Metal plug-in (`userland/metal`)

**Build notes (2026-11-23, integration-switches; docs/switches.md "Found while building the Metal plug-in").**
**Build notes (2026-11-23, integration-switches; shader fixes enabled 2026-11-24).**
`build.sh turnip` removes `build/mesa-tu-ios27` when the inputs of its cross file changed (the SDK, the compilers,
the base script), since an existing directory only gets `meson configure`. The `9xxx` copies of
`patches/metal2vulkan`: since 2026-11-25 90101, 90102 and the switch 90110 are in the bridge's list (`ios
Expand Down
Loading
Loading