Files
kryz-go-flutter/ci_stub_gen.py
T
robot 6679a1a00c
CI / Lint (pull_request) Successful in 19m23s
CI / Test (pull_request) Successful in 19m18s
CI / Build Android (pull_request) Failing after 24m16s
CI / Build iOS (pull_request) Canceled after 0s
fix(ci): stub appName must match test expectation 'KRYZ Go!'
2026-08-01 13:15:41 +00:00

100 lines
3.2 KiB
Python

#!/usr/bin/env python3
"""Generate stub lib/generated/*.dart files so flutter analyze passes
before the whitelabel build script has been run.
This is only needed for CI lint gates. The real build generates these
from theme.json via build_whitelabel.py.
"""
import os
import sys
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
GENERATED_DIR = os.path.join(PROJECT_ROOT, "lib", "generated")
DEFAULT_APP_CONFIG = '''// GENERATED STUB — DO NOT EDIT.
// This file is replaced by `python3 build_whitelabel.py` during actual builds.
// Exists only so that `flutter analyze` passes before whitelabel generation.
class AppConfig {
static const String callsign = 'KRYZ';
static const String appName = 'KRYZ Go!';
static const String tagline = '';
static const String frequency = '';
static const String streamUrl = '';
static const String? metadataUrl = null;
static const String defaultTitle = 'KRYZ Live Stream';
static const String defaultArtist = 'KRYZ Radio';
}
'''
DEFAULT_THEME_COLORS = '''// GENERATED STUB — DO NOT EDIT.
// This file is replaced by `python3 build_whitelabel.py` during actual builds.
// Exists only so that `flutter analyze` passes before whitelabel generation.
import 'package:flutter/material.dart';
import 'package:kryz_go_flutter/app_theme_business_object.dart';
class GeneratedThemeColors {
static const AppThemeColors lightColors = AppThemeColors(
headingColor: Color(0xFF1E293B),
accentColor: Color(0xFF6366F1),
scaffoldGradientStart: Color(0xFFF8F9FA),
scaffoldGradientEnd: Color(0xFFE9ECEF),
shellSurface: Color(0xFFFDFDFD),
shellBorder: Color(0xFFDEE2E6),
mutedText: Color(0xFF6C757D),
textOnDark: Color(0xFFFFFFFF),
textOnDarkSecondary: Color(0xFFE9ECEF),
controlsGradientStart: Color(0xFF1E293B),
controlsGradientEnd: Color(0xFF334155),
controlsShadow: Color(0x24000000),
bodyText: Color(0xFF333333),
cardSurface: Color(0x14FFFFFF),
cardBorder: Color(0x1FFFFFFF),
successColor: Color(0xFF28A745),
dangerColor: Color(0xFFDC3545),
);
static const AppThemeColors darkColors = AppThemeColors(
headingColor: Color(0xFF8B949E),
accentColor: Color(0xFF7C83FF),
scaffoldGradientStart: Color(0xFF0D1117),
scaffoldGradientEnd: Color(0xFF161B22),
shellSurface: Color(0xFF161B22),
shellBorder: Color(0xFF30363D),
mutedText: Color(0xFF6C757D),
textOnDark: Color(0xFFFFFFFF),
textOnDarkSecondary: Color(0xFFE9ECEF),
controlsGradientStart: Color(0xFF161B22),
controlsGradientEnd: Color(0xFF1E293B),
controlsShadow: Color(0x37000000),
bodyText: Color(0xFFC9D1D9),
cardSurface: Color(0x14FFFFFF),
cardBorder: Color(0x1FFFFFFF),
successColor: Color(0xFF28A745),
dangerColor: Color(0xFFDC3545),
);
}
'''
def main():
os.makedirs(GENERATED_DIR, exist_ok=True)
paths = [
(os.path.join(GENERATED_DIR, "app_config.dart"), DEFAULT_APP_CONFIG),
(os.path.join(GENERATED_DIR, "theme_colors.dart"), DEFAULT_THEME_COLORS),
]
for path, content in paths:
with open(path, "w") as f:
f.write(content)
print(f"Generated {path}")
print(f"Generated stubs in {GENERATED_DIR}")
if __name__ == "__main__":
main()