refactor(build): unify SDK configuration and release tooling
Gitea CI / Check code and tests (pull_request) Failing after 8m56s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped
Gitea CI / Gitea CI passed (pull_request) Failing after 4s

Pin Flutter with FVM and share local environment loading across IDE, Python, and Dart entrypoints. Keep CI on the verified preinstalled SDK and skip local overrides.

Extract common build presets, process execution, and file hashing. Propagate project roots through SDK selection and release commands, and migrate macOS release, signing, and DMG orchestration to Python.

Reuse local check suites in CI, support Android source overrides, and update documentation and regression tests.
This commit is contained in:
lingjhf committed 2026-10-06 22:24:32 +08:00
1 parent ca2efdaf18
commit 152c051a29
57 files changed
+1858 -375

No files matched your search

+19 -27
View File
@@ -1,27 +1,28 @@
"""Package audited Windows releases with Velopack, or serve a loopback test feed."""
import argparse
from functools import partial
import hashlib
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
import json
from pathlib import Path
import re
import subprocess
import sys
from urllib.parse import urljoin, urlparse
from urllib.request import url2pathname
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from common.files import file_sha256
from common.process import ROOT, cli, run
from check_windows_release import audit
from update_versions import numeric_version, update_version
ROOT = Path(__file__).resolve().parents[2]
SDK_VERSION = '1.2.161'
def resolved_deskup():
config = ROOT / '.dart_tool/package_config.json'
if not config.is_file():
raise ValueError('Run flutter pub get before using Windows update tools')
raise ValueError('Run fvm dart tool/flutter_local.dart pub get before using Windows update tools')
packages = json.loads(config.read_text(encoding='utf-8'))['packages']
package = next(item for item in packages if item['name'] == 'deskup')
uri = urlparse(urljoin(config.as_uri(), package['rootUri']))
@@ -48,7 +49,7 @@ def vpk_command(path):
def check_tool(command):
result = subprocess.run(command + ['--help'], capture_output=True, text=True,
result = run(command + ['--help'], cwd=Path.cwd(), capture_output=True, text=True,
encoding='utf-8', errors='replace', check=True, timeout=30)
if not re.search(rf'(?<![\d.]){re.escape(SDK_VERSION)}(?![\d.])', result.stdout + result.stderr):
raise ValueError(f'Use vpk {SDK_VERSION} to match the native SDK')
@@ -56,11 +57,11 @@ def check_tool(command):
def pack_release(command, *, app, output, package_id, version, title):
numeric_version(version)
subprocess.run(command + ['pack', '--packId', package_id, '--packVersion', version,
run(command + ['pack', '--packId', package_id, '--packVersion', version,
'--packDir', str(app), '--mainExe', 'cutdex.exe',
'--packTitle', title, '--runtime', 'win-x64',
'--channel', 'win-x64', '--outputDir', str(output),
'--delta', 'none'], check=True)
'--delta', 'none'], cwd=Path.cwd(), check=True)
def file_version(app):
@@ -103,9 +104,8 @@ def verify_manifest(app):
file = candidate.resolve()
if not file.is_relative_to(app) or candidate.is_symlink():
raise ValueError(f'Invalid manifest path: {name}')
with file.open('rb') as stream:
if hashlib.file_digest(stream, 'sha256').hexdigest().lower() != expected.lower():
raise ValueError(f'Release checksum mismatch: {name}')
if file_sha256(file).lower() != expected.lower():
raise ValueError(f'Release checksum mismatch: {name}')
def package_app(app, output, vpk, *, development=False, require_processing=True):
@@ -159,23 +159,15 @@ def main():
server.add_argument('--directory', type=Path, required=True)
server.add_argument('--port', type=int, default=8765)
args = parser.parse_args()
try:
if args.command == 'pack':
verify_sdk_version()
print(json.dumps(package_app(args.app, args.output, args.vpk,
development=args.development)))
elif args.command == 'verify-sdk':
print(f'Velopack SDK {verify_sdk_version()} verified')
else:
serve(args.directory, args.port)
except KeyboardInterrupt:
return
except (ValueError, OSError) as error:
print(str(error), file=sys.stderr)
raise SystemExit(1) from error
except subprocess.CalledProcessError as error:
raise SystemExit(error.returncode) from error
if args.command == 'pack':
verify_sdk_version()
print(json.dumps(package_app(args.app, args.output, args.vpk,
development=args.development)))
elif args.command == 'verify-sdk':
print(f'Velopack SDK {verify_sdk_version()} verified')
else:
serve(args.directory, args.port)
if __name__ == '__main__':
main()
sys.exit(cli(main))