everydaydevops-luff 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- everydaydevops_luff-3.0.0.data/data/share/luff/skills/flutter-audit/SKILL.md +30 -0
- everydaydevops_luff-3.0.0.data/data/share/luff/skills/flutter-create/SKILL.md +27 -0
- everydaydevops_luff-3.0.0.data/data/share/luff/skills/flutter-feature/SKILL.md +30 -0
- everydaydevops_luff-3.0.0.data/data/share/luff/skills/flutter-migrate/SKILL.md +30 -0
- everydaydevops_luff-3.0.0.data/data/share/luff/skills/flutter-verify/SKILL.md +12 -0
- everydaydevops_luff-3.0.0.dist-info/METADATA +50 -0
- everydaydevops_luff-3.0.0.dist-info/RECORD +40 -0
- everydaydevops_luff-3.0.0.dist-info/WHEEL +5 -0
- everydaydevops_luff-3.0.0.dist-info/entry_points.txt +3 -0
- everydaydevops_luff-3.0.0.dist-info/licenses/LICENSE +21 -0
- everydaydevops_luff-3.0.0.dist-info/top_level.txt +1 -0
- flutter_setup/__init__.py +0 -0
- flutter_setup/appender.py +46 -0
- flutter_setup/bootstrap.py +1655 -0
- flutter_setup/cicd_generator.py +885 -0
- flutter_setup/cli.py +1193 -0
- flutter_setup/config.py +156 -0
- flutter_setup/config_manager.py +160 -0
- flutter_setup/core.py +204 -0
- flutter_setup/exceptions.py +37 -0
- flutter_setup/flutter_manager.py +579 -0
- flutter_setup/platform.py +15 -0
- flutter_setup/prerequisites.py +39 -0
- flutter_setup/prerequisites_linux.py +140 -0
- flutter_setup/prerequisites_macos.py +226 -0
- flutter_setup/project_cli.py +397 -0
- flutter_setup/project_creator.py +91 -0
- flutter_setup/standards.py +99 -0
- flutter_setup/standards_data/everyday-devops-flutter-1.0.0.json +97 -0
- flutter_setup/standards_data/manifest-v1.schema.json +209 -0
- flutter_setup/templates/everyday/AGENTS.md +5 -0
- flutter_setup/templates/everyday/app_log.dart +6 -0
- flutter_setup/templates/everyday/home_content.dart +9 -0
- flutter_setup/templates/everyday/home_repository.dart +8 -0
- flutter_setup/templates/everyday/home_screen.dart +60 -0
- flutter_setup/templates/everyday/offline_store.dart +5 -0
- flutter_setup/templates/everyday/sentry_startup.dart +16 -0
- flutter_setup/templates/everyday/theme.dart +12 -0
- flutter_setup/templates.py +73 -0
- flutter_setup/verification.py +160 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Luff project manifest v1",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"schema_version": {
|
|
8
|
+
"type": "integer",
|
|
9
|
+
"const": 1
|
|
10
|
+
},
|
|
11
|
+
"profile": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"properties": {
|
|
15
|
+
"id": {
|
|
16
|
+
"const": "everyday-devops-flutter"
|
|
17
|
+
},
|
|
18
|
+
"version": {
|
|
19
|
+
"const": "1.0.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"id",
|
|
24
|
+
"version"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"capabilities": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"properties": {
|
|
31
|
+
"persistence": {
|
|
32
|
+
"type": "boolean"
|
|
33
|
+
},
|
|
34
|
+
"authentication": {
|
|
35
|
+
"type": "boolean"
|
|
36
|
+
},
|
|
37
|
+
"offline": {
|
|
38
|
+
"type": "boolean"
|
|
39
|
+
},
|
|
40
|
+
"sentry": {
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"rules": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"propertyNames": {
|
|
48
|
+
"enum": [
|
|
49
|
+
"architecture.feature-first",
|
|
50
|
+
"state.riverpod",
|
|
51
|
+
"navigation.go-router",
|
|
52
|
+
"design.material-3",
|
|
53
|
+
"design.responsive",
|
|
54
|
+
"design.accessibility",
|
|
55
|
+
"data.drift",
|
|
56
|
+
"auth.port",
|
|
57
|
+
"data.offline",
|
|
58
|
+
"observability.logging",
|
|
59
|
+
"observability.sentry",
|
|
60
|
+
"test.unit-widget",
|
|
61
|
+
"test.mocktail",
|
|
62
|
+
"test.patrol",
|
|
63
|
+
"ci.github-actions",
|
|
64
|
+
"dependencies.management",
|
|
65
|
+
"sdk.pinned",
|
|
66
|
+
"docs.development",
|
|
67
|
+
"agents.instructions"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": {
|
|
71
|
+
"enum": [
|
|
72
|
+
"error",
|
|
73
|
+
"warning",
|
|
74
|
+
"info"
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"exceptions": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"propertyNames": {
|
|
81
|
+
"enum": [
|
|
82
|
+
"architecture.feature-first",
|
|
83
|
+
"state.riverpod",
|
|
84
|
+
"navigation.go-router",
|
|
85
|
+
"design.material-3",
|
|
86
|
+
"design.responsive",
|
|
87
|
+
"design.accessibility",
|
|
88
|
+
"data.drift",
|
|
89
|
+
"auth.port",
|
|
90
|
+
"data.offline",
|
|
91
|
+
"observability.logging",
|
|
92
|
+
"observability.sentry",
|
|
93
|
+
"test.unit-widget",
|
|
94
|
+
"test.mocktail",
|
|
95
|
+
"test.patrol",
|
|
96
|
+
"ci.github-actions",
|
|
97
|
+
"dependencies.management",
|
|
98
|
+
"sdk.pinned",
|
|
99
|
+
"docs.development",
|
|
100
|
+
"agents.instructions"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"additionalProperties": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"properties": {
|
|
107
|
+
"reason": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"pattern": "\\S"
|
|
110
|
+
},
|
|
111
|
+
"expires": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"format": "date"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": [
|
|
117
|
+
"reason"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"project": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"properties": {
|
|
125
|
+
"name": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"pattern": "^[a-z][a-z0-9_]*$"
|
|
128
|
+
},
|
|
129
|
+
"platforms": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": {
|
|
132
|
+
"enum": [
|
|
133
|
+
"ios",
|
|
134
|
+
"android",
|
|
135
|
+
"linux",
|
|
136
|
+
"web",
|
|
137
|
+
"macos",
|
|
138
|
+
"windows"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"minItems": 1,
|
|
142
|
+
"uniqueItems": true
|
|
143
|
+
},
|
|
144
|
+
"org": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9_]*(\\.[a-zA-Z][a-zA-Z0-9_]*)+$"
|
|
147
|
+
},
|
|
148
|
+
"flutter_version": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
|
|
151
|
+
},
|
|
152
|
+
"architecture": {
|
|
153
|
+
"enum": [
|
|
154
|
+
"basic",
|
|
155
|
+
"clean"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"template": {
|
|
159
|
+
"enum": [
|
|
160
|
+
"app",
|
|
161
|
+
"plugin"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"testing": {
|
|
165
|
+
"enum": [
|
|
166
|
+
"standard",
|
|
167
|
+
"mocktail"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"e2e_testing": {
|
|
171
|
+
"enum": [
|
|
172
|
+
"integration_test",
|
|
173
|
+
"patrol"
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
"ios_language": {
|
|
177
|
+
"enum": [
|
|
178
|
+
"swift",
|
|
179
|
+
"objc"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"android_language": {
|
|
183
|
+
"enum": [
|
|
184
|
+
"kotlin",
|
|
185
|
+
"java"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"cloud_database": {
|
|
189
|
+
"enum": [
|
|
190
|
+
"none",
|
|
191
|
+
"firestore"
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"notifications_provider": {
|
|
195
|
+
"enum": [
|
|
196
|
+
"none",
|
|
197
|
+
"firebase"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"luff_version": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"schema_version"
|
|
208
|
+
]
|
|
209
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Flutter project instructions
|
|
2
|
+
|
|
3
|
+
Read `.luff.yaml` before editing. Preserve the pinned Flutter version and the selected capabilities. Keep presentation, domain, and data code within the relevant feature. Use Riverpod and GoRouter where the manifest selects clean architecture.
|
|
4
|
+
|
|
5
|
+
Before handoff, run `flutter analyze`, `flutter test`, and hosted builds for supported declared platforms. Exercise accessibility semantics, text scaling, and phone and tablet layouts when changing UI. Keep credentials, signing files, and local service configuration out of Git.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
3
|
+
|
|
4
|
+
import '../../../core/theme/app_theme.dart';
|
|
5
|
+
import '../data/home_repository.dart';
|
|
6
|
+
import '../domain/home_content.dart';
|
|
7
|
+
|
|
8
|
+
final homeRepository = Provider<HomeRepository>((ref) => const LocalHomeRepository());
|
|
9
|
+
|
|
10
|
+
class HomeScreen extends ConsumerWidget {
|
|
11
|
+
const HomeScreen({super.key});
|
|
12
|
+
|
|
13
|
+
@override
|
|
14
|
+
Widget build(BuildContext context, WidgetRef ref) {
|
|
15
|
+
final content = ref.watch(homeRepository).load();
|
|
16
|
+
return Scaffold(
|
|
17
|
+
appBar: AppBar(title: const Text('Home')),
|
|
18
|
+
body: SafeArea(
|
|
19
|
+
child: SingleChildScrollView(
|
|
20
|
+
padding: const EdgeInsets.all(AppTheme.spacing),
|
|
21
|
+
child: Center(
|
|
22
|
+
child: ConstrainedBox(
|
|
23
|
+
constraints: const BoxConstraints(maxWidth: AppTheme.contentWidth),
|
|
24
|
+
child: LayoutBuilder(
|
|
25
|
+
builder: (context, constraints) {
|
|
26
|
+
final width = constraints.maxWidth;
|
|
27
|
+
final cardWidth = width >= AppTheme.tabletBreakpoint
|
|
28
|
+
? (width - AppTheme.spacing) / 2
|
|
29
|
+
: width;
|
|
30
|
+
return Wrap(
|
|
31
|
+
spacing: AppTheme.spacing,
|
|
32
|
+
runSpacing: AppTheme.spacing,
|
|
33
|
+
children: [
|
|
34
|
+
for (final section in content.sections)
|
|
35
|
+
SizedBox(
|
|
36
|
+
width: cardWidth,
|
|
37
|
+
child: Card(
|
|
38
|
+
child: Padding(
|
|
39
|
+
padding: const EdgeInsets.all(AppTheme.spacing),
|
|
40
|
+
child: Semantics(
|
|
41
|
+
header: true,
|
|
42
|
+
child: Text(
|
|
43
|
+
section,
|
|
44
|
+
style: Theme.of(context).textTheme.titleLarge,
|
|
45
|
+
),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
],
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
),
|
|
57
|
+
),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import 'package:sentry_flutter/sentry_flutter.dart';
|
|
2
|
+
|
|
3
|
+
Future<void> runObservedApp(Future<void> Function() start) async {
|
|
4
|
+
const dsn = String.fromEnvironment('SENTRY_DSN');
|
|
5
|
+
if (dsn.isEmpty) {
|
|
6
|
+
await start();
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
await SentryFlutter.init(
|
|
10
|
+
(options) {
|
|
11
|
+
options.dsn = dsn;
|
|
12
|
+
options.sendDefaultPii = false;
|
|
13
|
+
},
|
|
14
|
+
appRunner: start,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
|
|
3
|
+
abstract final class AppTheme {
|
|
4
|
+
static const spacing = 24.0;
|
|
5
|
+
static const tabletBreakpoint = 600.0;
|
|
6
|
+
static const contentWidth = 960.0;
|
|
7
|
+
|
|
8
|
+
static ThemeData light() => ThemeData(
|
|
9
|
+
useMaterial3: true,
|
|
10
|
+
colorScheme: ColorScheme.fromSeed(seedColor: Colors.indigo),
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Copy packaged Flutter application resources into a newly created project."""
|
|
2
|
+
|
|
3
|
+
from importlib.resources import files
|
|
4
|
+
|
|
5
|
+
from .config import Config
|
|
6
|
+
|
|
7
|
+
EVERYDAY = {
|
|
8
|
+
"theme.dart": "lib/src/core/theme/app_theme.dart",
|
|
9
|
+
"app_log.dart": "lib/src/core/logging/app_log.dart",
|
|
10
|
+
"home_content.dart": "lib/src/features/home/domain/home_content.dart",
|
|
11
|
+
"home_repository.dart": "lib/src/features/home/data/home_repository.dart",
|
|
12
|
+
"home_screen.dart": "lib/src/features/home/presentation/home_screen.dart",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def apply_templates(config: Config) -> None:
|
|
17
|
+
root = config.project_path
|
|
18
|
+
resources = files("flutter_setup").joinpath("templates", "everyday")
|
|
19
|
+
selected = {"AGENTS.md": "AGENTS.md"}
|
|
20
|
+
if config.architecture == "clean":
|
|
21
|
+
selected.update(EVERYDAY)
|
|
22
|
+
app = root / "lib/src/app/app.dart"
|
|
23
|
+
content = app.read_text().replace(
|
|
24
|
+
"import 'router.dart';",
|
|
25
|
+
"import '../core/theme/app_theme.dart';\nimport 'router.dart';",
|
|
26
|
+
)
|
|
27
|
+
app.write_text(
|
|
28
|
+
content.replace("ThemeData(useMaterial3: true)", "AppTheme.light()")
|
|
29
|
+
)
|
|
30
|
+
if config.offline:
|
|
31
|
+
selected["offline_store.dart"] = "lib/src/core/offline/offline_store.dart"
|
|
32
|
+
if config.sentry:
|
|
33
|
+
selected["sentry_startup.dart"] = (
|
|
34
|
+
"lib/src/core/observability/sentry_startup.dart"
|
|
35
|
+
)
|
|
36
|
+
main = root / "lib/main.dart"
|
|
37
|
+
content = main.read_text()
|
|
38
|
+
content = (
|
|
39
|
+
("import 'src/core/observability/sentry_startup.dart';\n" + content)
|
|
40
|
+
.replace(
|
|
41
|
+
"Future<void> main() async {",
|
|
42
|
+
"Future<void> main() async {\n await runObservedApp(() async {",
|
|
43
|
+
1,
|
|
44
|
+
)
|
|
45
|
+
.rstrip()
|
|
46
|
+
)
|
|
47
|
+
content = content.removesuffix("}") + " });\n}\n"
|
|
48
|
+
main.write_text(content)
|
|
49
|
+
for source, target in selected.items():
|
|
50
|
+
destination = root / target
|
|
51
|
+
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
52
|
+
destination.write_bytes(resources.joinpath(source).read_bytes())
|
|
53
|
+
readme = root / "README.md"
|
|
54
|
+
with readme.open("a", encoding="utf-8") as file:
|
|
55
|
+
file.write(
|
|
56
|
+
"\n## Luff standards\n\nRun `flutter analyze` and `flutter test` with the Flutter version recorded in `.luff.yaml`.\n"
|
|
57
|
+
)
|
|
58
|
+
if config.offline:
|
|
59
|
+
file.write(
|
|
60
|
+
"\nImplement an app-specific cache behind the generated offline store contract.\n"
|
|
61
|
+
)
|
|
62
|
+
if config.sentry:
|
|
63
|
+
file.write(
|
|
64
|
+
"\nSentry starts only when supplied `--dart-define=SENTRY_DSN=...`. Review telemetry before enabling it.\n"
|
|
65
|
+
)
|
|
66
|
+
if (
|
|
67
|
+
config.auth_provider != "none"
|
|
68
|
+
or config.cloud_database != "none"
|
|
69
|
+
or config.notifications_provider != "none"
|
|
70
|
+
):
|
|
71
|
+
file.write(
|
|
72
|
+
"\nConfigure your own Firebase project with FlutterFire before enabling or using its adapters. Firebase startup is off by default.\n"
|
|
73
|
+
)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""Run explicit, reportable quality gates for generated Flutter projects."""
|
|
2
|
+
|
|
3
|
+
import platform
|
|
4
|
+
import shutil
|
|
5
|
+
import subprocess
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from .standards import load_manifest
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def build_command(target: str, executable: Path) -> list[str] | None:
|
|
13
|
+
host = platform.system()
|
|
14
|
+
tools = {"ios": "Darwin", "macos": "Darwin", "windows": "Windows", "linux": "Linux"}
|
|
15
|
+
if target in tools and host != tools[target]:
|
|
16
|
+
return None
|
|
17
|
+
options = {"ios": ["ios", "--simulator", "--no-codesign"], "android": ["apk"]}
|
|
18
|
+
return [
|
|
19
|
+
str(executable),
|
|
20
|
+
"build",
|
|
21
|
+
*options.get(target, [target]),
|
|
22
|
+
"--debug",
|
|
23
|
+
"--no-pub",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def verify_project(
|
|
28
|
+
directory: Path, sdk: Path | None, device: str | None, skip_builds: bool
|
|
29
|
+
) -> dict[str, Any]:
|
|
30
|
+
from .project_cli import run_sdk, sdk_executable, sdk_version
|
|
31
|
+
|
|
32
|
+
checks: list[dict[str, Any]] = []
|
|
33
|
+
|
|
34
|
+
def record(name: str, status: str, detail: str = "") -> None:
|
|
35
|
+
checks.append({"name": name, "status": status, "detail": detail})
|
|
36
|
+
|
|
37
|
+
def run(name: str, command: list[str]) -> bool:
|
|
38
|
+
try:
|
|
39
|
+
result = run_sdk(command, directory)
|
|
40
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
41
|
+
record(name, "blocked", str(exc))
|
|
42
|
+
return False
|
|
43
|
+
detail = (
|
|
44
|
+
(result.stderr or result.stdout).strip()[-3000:]
|
|
45
|
+
if result.returncode
|
|
46
|
+
else ""
|
|
47
|
+
)
|
|
48
|
+
record(name, "failed" if result.returncode else "passed", detail)
|
|
49
|
+
return result.returncode == 0
|
|
50
|
+
|
|
51
|
+
def finish() -> dict[str, Any]:
|
|
52
|
+
failed = any(check["status"] in ("failed", "blocked") for check in checks)
|
|
53
|
+
return {"status": "failed" if failed else "passed", "checks": checks}
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
manifest = load_manifest(directory / ".luff.yaml")
|
|
57
|
+
settings = manifest.get("project", {})
|
|
58
|
+
if not (directory / "pubspec.yaml").is_file():
|
|
59
|
+
raise ValueError("pubspec.yaml is missing")
|
|
60
|
+
if not settings.get("flutter_version") or not settings.get("platforms"):
|
|
61
|
+
raise ValueError(
|
|
62
|
+
"Use a resolved manifest with Flutter version and target platforms"
|
|
63
|
+
)
|
|
64
|
+
record("manifest", "passed")
|
|
65
|
+
except ValueError as exc:
|
|
66
|
+
record("manifest", "failed", str(exc))
|
|
67
|
+
return finish()
|
|
68
|
+
|
|
69
|
+
gates = ("dependencies", "format", "analysis", "unit", "widget", "integration")
|
|
70
|
+
try:
|
|
71
|
+
executable = sdk_executable(sdk)
|
|
72
|
+
detected = sdk_version(executable, directory)
|
|
73
|
+
required = settings["flutter_version"]
|
|
74
|
+
if detected != required:
|
|
75
|
+
raise ValueError(f"Flutter {required} required, found {detected}")
|
|
76
|
+
record("sdk", "passed", detected)
|
|
77
|
+
except (ValueError, OSError, subprocess.SubprocessError) as exc:
|
|
78
|
+
record("sdk", "blocked", str(exc))
|
|
79
|
+
for gate in (*gates, *(f"build:{target}" for target in settings["platforms"])):
|
|
80
|
+
record(gate, "blocked", "SDK is unavailable or incompatible")
|
|
81
|
+
return finish()
|
|
82
|
+
|
|
83
|
+
flutter = str(executable)
|
|
84
|
+
if not run("dependencies", [flutter, "pub", "get", "--enforce-lockfile"]):
|
|
85
|
+
for gate in (
|
|
86
|
+
*gates[1:],
|
|
87
|
+
*(f"build:{target}" for target in settings["platforms"]),
|
|
88
|
+
):
|
|
89
|
+
record(gate, "blocked", "Dependency resolution failed")
|
|
90
|
+
return finish()
|
|
91
|
+
paths = [
|
|
92
|
+
path
|
|
93
|
+
for path in ("lib", "test", "integration_test", "patrol_test")
|
|
94
|
+
if (directory / path).is_dir()
|
|
95
|
+
]
|
|
96
|
+
if paths:
|
|
97
|
+
run(
|
|
98
|
+
"format",
|
|
99
|
+
[
|
|
100
|
+
str(executable.with_name("dart")),
|
|
101
|
+
"format",
|
|
102
|
+
"--output=none",
|
|
103
|
+
"--set-exit-if-changed",
|
|
104
|
+
*paths,
|
|
105
|
+
],
|
|
106
|
+
)
|
|
107
|
+
else:
|
|
108
|
+
record("format", "skipped", "No Dart source directories")
|
|
109
|
+
run("analysis", [flutter, "analyze", "--no-pub"])
|
|
110
|
+
for gate in ("unit", "widget"):
|
|
111
|
+
path = Path("test") / gate
|
|
112
|
+
if list((directory / path).rglob("*_test.dart")):
|
|
113
|
+
run(gate, [flutter, "test", "--no-pub", str(path)])
|
|
114
|
+
else:
|
|
115
|
+
record(gate, "skipped", f"No tests under {path}")
|
|
116
|
+
extra = [
|
|
117
|
+
str(path.relative_to(directory))
|
|
118
|
+
for path in (directory / "test").rglob("*_test.dart")
|
|
119
|
+
if path.relative_to(directory).parts[1] not in {"unit", "widget"}
|
|
120
|
+
]
|
|
121
|
+
if extra:
|
|
122
|
+
run("other_tests", [flutter, "test", "--no-pub", *sorted(extra)])
|
|
123
|
+
patrol_mode = settings.get("e2e_testing") == "patrol"
|
|
124
|
+
integration_path = "patrol_test" if patrol_mode else "integration_test"
|
|
125
|
+
if not list((directory / integration_path).rglob("*_test.dart")):
|
|
126
|
+
record("integration", "skipped", "No integration tests")
|
|
127
|
+
elif not device:
|
|
128
|
+
record("integration", "skipped", "Select a test device with --device")
|
|
129
|
+
elif patrol_mode:
|
|
130
|
+
patrol = shutil.which("patrol")
|
|
131
|
+
if patrol:
|
|
132
|
+
run(
|
|
133
|
+
"integration",
|
|
134
|
+
[patrol, "test", "--flutter-command", flutter, "-d", device],
|
|
135
|
+
)
|
|
136
|
+
else:
|
|
137
|
+
record(
|
|
138
|
+
"integration", "blocked", "Install the Patrol CLI and select a device"
|
|
139
|
+
)
|
|
140
|
+
else:
|
|
141
|
+
run(
|
|
142
|
+
"integration",
|
|
143
|
+
[flutter, "test", "--no-pub", "-d", device, "integration_test"],
|
|
144
|
+
)
|
|
145
|
+
for target in settings["platforms"]:
|
|
146
|
+
label = f"build:{target}"
|
|
147
|
+
command = build_command(target, executable)
|
|
148
|
+
if skip_builds:
|
|
149
|
+
record(label, "skipped", "Builds disabled with --skip-builds")
|
|
150
|
+
elif command is None:
|
|
151
|
+
record(
|
|
152
|
+
label, "unsupported", f"Cannot build {target} on {platform.system()}"
|
|
153
|
+
)
|
|
154
|
+
elif settings.get("template") == "plugin":
|
|
155
|
+
record(
|
|
156
|
+
label, "unsupported", "Plugin builds require verifying the example app"
|
|
157
|
+
)
|
|
158
|
+
else:
|
|
159
|
+
run(label, command)
|
|
160
|
+
return finish()
|