Move editor UI into the app and release verified Core dependencies (#14)
Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped

This commit was merged in pull request #14.
This commit is contained in:
lingjhf committed 2026-10-11 19:59:40 +00:00
1 parent abc1868550
commit 06f1c26681
452 files changed
+43806 -2329

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
"""Expose exact application dependencies to CI or update development commit pins."""
import argparse
import json
import os
from pathlib import Path
import re
import subprocess
ROOT = Path(__file__).resolve().parents[2]
DEPENDENCIES = ('core', 'nativeFlutter')
def validate_pins(pins):
if pins.get('schemaVersion') != 1:
raise ValueError('Unsupported application dependency lock schema.')
for name in DEPENDENCIES:
pin = pins[name]
if not re.fullmatch(r'[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+', pin['repository']):
raise ValueError(f'{name}: invalid repository identity.')
if not re.fullmatch(r'[a-f0-9]{40}', pin['revision']):
raise ValueError(f'{name}: dependency must pin a full commit SHA.')
reference = pin.get('ref', pin['revision'])
if reference != pin['revision'] and reference != 'v' + pin.get('version', ''):
raise ValueError(f'{name}: release ref must match the recorded version.')
if reference != pin['revision'] and not re.fullmatch(r'\d+\.\d+\.\d+', pin['version']):
raise ValueError(f'{name}: invalid release version.')
return pins
def write_outputs(pins, output):
validate_pins(pins)
for name in DEPENDENCIES:
pin = pins[name]
for key in ('repository', 'revision'):
output.write(f'{name}-{key}={pin[key]}\n')
output.write(f"{name}-ref={pin.get('ref', pin['revision'])}\n")
def verify_checkouts(pins):
validate_pins(pins)
for name, directory in (('core', 'cutdex_core'), ('nativeFlutter', 'cutdex_native_flutter')):
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
cwd=ROOT / '.dependencies' / directory, text=True).strip()
if revision != pins[name]['revision']:
raise ValueError(f'{name}: checkout does not match the recorded commit.')
print('Both dependency checkouts match their recorded commits.')
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--core', type=Path, help='Update the core pin from this committed checkout')
parser.add_argument('--native-flutter', type=Path, help='Update the native Flutter pin from this committed checkout')
parser.add_argument('--verify', action='store_true', help='Verify CI dependency checkouts match the recorded commits')
args = parser.parse_args()
path = ROOT / 'dependencies.json'
pins = json.loads(path.read_text())
if args.core or args.native_flutter:
for name, checkout in (('core', args.core), ('nativeFlutter', args.native_flutter)):
if checkout:
sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=checkout, text=True).strip()
manifest = 'native-dependencies.json' if name == 'nativeFlutter' else 'native-flutter-dependency.json'
subprocess.check_output(['git', 'show', f'{sha}:{manifest}'], cwd=checkout)
pubspec = subprocess.check_output(['git', 'show', f'{sha}:pubspec.yaml'], cwd=checkout, text=True)
pins[name].update(revision=sha, version=re.search(r'^version:\s*(\S+)\s*$', pubspec, re.M)[1])
pins[name].pop('ref', None)
validate_pins(pins)
path.write_text(json.dumps(pins, indent=2) + '\n')
print('Updated committed application dependency pins.')
elif args.verify:
verify_checkouts(pins)
else:
with Path(os.environ['GITHUB_OUTPUT']).open('a', encoding='utf-8') as output:
write_outputs(pins, output)
if __name__ == '__main__':
main()