Audit portable Windows DLL dependencies before releasing
Gitea CI / Windows x64 and Android (pull_request) Canceled after 0s
Gitea CI / Gitea CI passed (pull_request) Canceled after 0s

This commit is contained in:
lingjhf committed 2026-10-06 03:11:15 +08:00
1 parent d20ce064a5
commit 2fb675e64c
4 files changed
+13 -2

No files matched your search

+1
View File
@@ -40,6 +40,7 @@ jobs:
- run: flutter test --reporter expanded - run: flutter test --reporter expanded
- run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64 - run: flutter build apk --release --flavor production --target-platform android-arm64,android-x64
- run: flutter build windows --release --flavor production - run: flutter build windows --release --flavor production
- run: python -m pip install pefile==2024.8.26
- name: Package application - name: Package application
run: python tool/gitea/package-app.py run: python tool/gitea/package-app.py
- name: Upload Android and Windows packages - name: Upload Android and Windows packages
+1
View File
@@ -9,6 +9,7 @@ on:
required: true required: true
permissions: permissions:
contents: write contents: write
actions: read
concurrency: concurrency:
group: cutdex-release group: cutdex-release
cancel-in-progress: false cancel-in-progress: false
+8
View File
@@ -4,6 +4,7 @@ import json
from pathlib import Path from pathlib import Path
import re import re
import shutil import shutil
import sys
import zipfile import zipfile
ROOT = Path(__file__).resolve().parents[2] ROOT = Path(__file__).resolve().parents[2]
@@ -25,6 +26,13 @@ def main():
if any(name.startswith('lib/armeabi-v7a/') for name in names): if any(name.startswith('lib/armeabi-v7a/') for name in names):
raise ValueError('APK must use supported 64-bit ABIs only') raise ValueError('APK must use supported 64-bit ABIs only')
shutil.copyfile(apk, output / f'cutdex-{version}-android.apk') shutil.copyfile(apk, output / f'cutdex-{version}-android.apk')
sys.path.insert(0, str(ROOT / 'tool/windows'))
from check_windows_release import audit
unused_jni = windows / 'dartjni.dll'
if unused_jni.exists():
unused_jni.unlink()
report = audit(windows, require_processing=False)
(output / 'windows-dependency-audit.json').write_text(json.dumps(report, indent=2) + '\n')
package = output / f'cutdex-{version}-windows-x64.zip' package = output / f'cutdex-{version}-windows-x64.zip'
with zipfile.ZipFile(package, 'w', compression=zipfile.ZIP_DEFLATED) as archive: with zipfile.ZipFile(package, 'w', compression=zipfile.ZIP_DEFLATED) as archive:
for path in sorted(windows.rglob('*')): for path in sorted(windows.rglob('*')):
+3 -2
View File
@@ -48,9 +48,10 @@ def pe_imports(path):
for item in getattr(pe, attribute, [])}) for item in getattr(pe, attribute, [])})
def audit(root, read_imports=pe_imports): def audit(root, read_imports=pe_imports, *, require_processing=True):
root = Path(root).resolve() root = Path(root).resolve()
missing = [name for name in REQUIRED if not (root / name).is_file()] required = REQUIRED if require_processing else tuple(name for name in REQUIRED if not name.startswith('processing/'))
missing = [name for name in required if not (root / name).is_file()]
if missing: if missing:
raise ValueError(f'Missing release files: {missing}') raise ValueError(f'Missing release files: {missing}')
if not (root / 'data/flutter_assets').is_dir(): if not (root / 'data/flutter_assets').is_dir():