refactor(build): unify SDK configuration and release tooling

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 23:34:15 +08:00
1 parent a13a54d5ec
commit 0343e2f723
57 files changed
+1858 -375

No files matched your search

+9 -8
View File
@@ -8,17 +8,20 @@ import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT / 'tool'))
from project_tools import host_bash, tool_command
class CliTests(unittest.TestCase):
def test_python_help_and_unknown_option(self):
scripts = [
'check.py', 'macos/check_macos_release.py', 'macos/macos_updates.py',
'check.py', 'build.py', 'project_tools.py', 'macos/check_macos_release.py', 'macos/macos_updates.py',
'macos/build_macos_release.py', 'macos/sign_macos_app.py', 'macos/create_macos_dmg.py',
'macos/test_macos_release.py', 'macos/test_macos_updates.py',
'macos/test_check_macos_release.py', 'windows/check_windows_release.py',
'windows/package_windows_release.py', 'windows/prepare_windows_sandbox.py',
'windows/windows_updates.py', 'windows/test_windows_updates.py',
'gitea/package-app.py',
'gitea/package-app.py', 'gitea/verify_flutter_version.py',
'diagnostics/frame_budget.py',
]
for name in scripts:
@@ -29,10 +32,8 @@ class CliTests(unittest.TestCase):
self.assertEqual(result.returncode, code, result.stderr)
self.assertIn('usage:', (result.stdout + result.stderr).lower())
@unittest.skipUnless(shutil.which('dart'), 'Dart SDK unavailable')
def test_context_diagnostic_arguments_and_json_output(self):
command = [shutil.which('dart'), 'run',
str(ROOT / 'tool/diagnostics/benchmark_agent_context.dart')]
command = tool_command('dart', ['run', ROOT / 'tool/diagnostics/benchmark_agent_context.dart'])
for arguments, code in [(['--help'], 0), ([], 2)]:
result = subprocess.run(command + arguments, cwd=ROOT, capture_output=True,
text=True, timeout=60)
@@ -46,15 +47,15 @@ class CliTests(unittest.TestCase):
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(json.loads(result.stdout)['messages'], 0)
@unittest.skipUnless(shutil.which('bash'), 'bash unavailable')
@unittest.skipUnless(host_bash(), 'native bash unavailable')
def test_shell_help_and_argument_count(self):
for script in (ROOT / 'tool/macos').glob('*.sh'):
with self.subTest(script=script.name):
result = subprocess.run(['bash', str(script), '--help'],
result = subprocess.run([host_bash(), script.as_posix(), '--help'],
capture_output=True, text=True, timeout=10)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertIn('Usage:', result.stdout)
result = subprocess.run(['bash', str(script), 'one', 'two', 'three'],
result = subprocess.run([host_bash(), script.as_posix(), 'one', 'two', 'three'],
capture_output=True, text=True, timeout=10)
self.assertEqual(result.returncode, 2, result.stderr)