fix(build): helper script edits no longer invalidate the prepared runtime, and every build uses CI's NDK (#3116)

* fix(build): helper script edits no longer invalidate the prepared runtime, and every build uses CI's NDK

* docs(agents): helper script edits no longer need build_local.sh
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-23 21:55:27 -05:00
1 parent fcaaf4dde0
commit 95aab3703f
9 files changed
+97 -12

No files matched your search

+12
View File
@@ -1,6 +1,7 @@
from pathlib import Path
import importlib.util
import re
import shutil
import sys
from zipfile import ZipFile
@@ -34,6 +35,14 @@ def source_assets(overlay=OVERLAY):
return result
def stage(target=OVERLAY.parents[2] / 'app/src/main', overlay=OVERLAY):
for source, asset in source_assets(overlay).items():
path = target / asset
if not path.is_file() or path.read_bytes() != source.read_bytes():
path.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source, path)
def check(apk, overlay=OVERLAY):
errors = check_extraction(overlay, SESSION_FILES.read_text()) if overlay == OVERLAY else []
with ZipFile(apk) as package:
@@ -60,6 +69,9 @@ def check(apk, overlay=OVERLAY):
if __name__ == '__main__':
if sys.argv[1:] == ['--stage']:
stage()
sys.exit()
errors = check(sys.argv[1])
if errors:
sys.exit('\n'.join(errors))
+24 -1
View File
@@ -48,8 +48,19 @@ def digest(path):
return result.hexdigest()
def copied(root):
# Helper scripts are staged verbatim on every Gradle build and checked against the APK by
# check_session_assets.py, so they are neither preparation inputs nor prepared outputs.
if str(Path(__file__).resolve().parent) not in sys.path:
sys.path.insert(0, str(Path(__file__).resolve().parent))
from check_session_assets import OVERLAY, source_assets
found = source_assets() if root == ROOT else source_assets(root / OVERLAY.relative_to(ROOT))
return {source.relative_to(root).as_posix(): 'app/src/main/' + asset for source, asset in found.items()}
def sources(root):
files, builds = [], set()
skipped = set(copied(root))
for name in SOURCE_PATHS:
path = root / name
files.extend(path.rglob('*') if path.is_dir() else [path])
@@ -57,14 +68,18 @@ def sources(root):
builds.update(manifest.parent / 'target' for manifest in path.rglob('Cargo.toml'))
return {path.relative_to(root).as_posix(): digest(path) for path in sorted(set(files))
if path.is_file() and '__pycache__' not in path.parts and path.suffix != '.pyc'
and path.relative_to(root).as_posix() not in skipped
and not any(build in path.parents for build in builds)}
def outputs(root):
result = {}
skipped = set(copied(root).values())
for tree in ['linuxfs', 'directaudio', 'droiddeck-esync', 'desktop-removal', 'hybris']:
base = root / 'app/src/main/assets' / tree
for path in base.rglob('*'):
if path.relative_to(root).as_posix() in skipped:
continue
if path.is_file() and not any(part.startswith('.') for part in path.relative_to(base).parts):
result['assets/' + tree + '/' + path.relative_to(base).as_posix()] = path.relative_to(root).as_posix()
for library in ['libproot.so', 'libproot-loader.so', 'libdirectaudiorelay.so']:
@@ -84,7 +99,6 @@ def required():
for name in ['turnip26.3.0-a6xx', 'turnip26.3.0-quest2']]
paths += ['assets/linuxfs/' + name for name in ['libfakeinput.so', 'libddsession.so',
'libddfastpath.so', 'libddnatv-hook.so', 'libssbs.so', 'usr/local/bin/droiddeck-clipboard',
'usr/local/bin/droiddeck-gog-maintenance',
'usr/local/bin/gamescope', 'usr/local/lib/droiddeck/uruntime',
'usr/local/lib/droiddeck-pipewire.tzst']]
for arch in ['x86_64', 'i386']:
@@ -178,6 +192,10 @@ def verify(root=ROOT, stale_sources_ok=False):
raise ValueError('Runtime inputs have not been prepared. Run tools/build_local.sh.')
if data.get('version') != 1:
raise ValueError('Runtime sources changed since preparation. Run tools/build_local.sh.')
copies = copied(root)
data['sources'] = {name: value for name, value in (data.get('sources') or {}).items() if name not in copies}
data['outputs'] = {name: output for name, output in (data.get('outputs') or {}).items()
if output.get('path') not in copies.values()}
current = sources(root)
if data.get('sources') != current:
if not stale_sources_ok:
@@ -195,6 +213,11 @@ def verify(root=ROOT, stale_sources_ok=False):
raise ValueError('Missing or changed runtime input: ' + name + '. Run tools/build_local.sh.')
if outputs(root) != {name: output['path'] for name, output in data['outputs'].items()}:
raise ValueError('Runtime file set changed. Run tools/build_local.sh.')
for source, asset in copies.items():
path = root / asset
if not path.is_file() or path.read_bytes() != (root / source).read_bytes():
raise ValueError(asset + ' is not a current copy of ' + source
+ '. Run python3 tools/release/check_session_assets.py --stage.')
return data