flutter-build-it 0.1.2__tar.gz
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.
- flutter_build_it-0.1.2/PKG-INFO +325 -0
- flutter_build_it-0.1.2/README.md +289 -0
- flutter_build_it-0.1.2/build_it/__init__.py +41 -0
- flutter_build_it-0.1.2/build_it/__main__.py +4 -0
- flutter_build_it-0.1.2/build_it/cli/__init__.py +16 -0
- flutter_build_it-0.1.2/build_it/cli/main.py +435 -0
- flutter_build_it-0.1.2/build_it/core/__init__.py +46 -0
- flutter_build_it-0.1.2/build_it/core/builder.py +466 -0
- flutter_build_it-0.1.2/build_it/core/config.py +432 -0
- flutter_build_it-0.1.2/build_it/core/enums.py +127 -0
- flutter_build_it-0.1.2/build_it/core/models.py +292 -0
- flutter_build_it-0.1.2/build_it/core/parser.py +234 -0
- flutter_build_it-0.1.2/build_it/utils/__init__.py +28 -0
- flutter_build_it-0.1.2/build_it/utils/constants.py +95 -0
- flutter_build_it-0.1.2/build_it/utils/guards.py +69 -0
- flutter_build_it-0.1.2/build_it/utils/utils.py +90 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/PKG-INFO +325 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/SOURCES.txt +22 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/dependency_links.txt +1 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/entry_points.txt +2 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/requires.txt +12 -0
- flutter_build_it-0.1.2/flutter_build_it.egg-info/top_level.txt +1 -0
- flutter_build_it-0.1.2/pyproject.toml +59 -0
- flutter_build_it-0.1.2/setup.cfg +4 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flutter-build-it
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Flutter multi-flavor build automation CLI — reads flavorizr config and builds all your flavors in one command.
|
|
5
|
+
Author-email: "Dayane S. R. Assogba" <assogbadayane197@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/dasero197/build_it
|
|
8
|
+
Project-URL: Repository, https://github.com/dasero197/build_it
|
|
9
|
+
Project-URL: Issues, https://github.com/dasero197/build_it/issues
|
|
10
|
+
Keywords: flutter,flavorizr,build,cli,dart,mobile
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
23
|
+
Requires-Python: >=3.14
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: typer>=0.24.1
|
|
26
|
+
Requires-Dist: rich>=14.3.3
|
|
27
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
28
|
+
Requires-Dist: pydantic>=2.12.5
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=9.0.3; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-asyncio>=1.3.0; extra == "dev"
|
|
32
|
+
Requires-Dist: auto-py-to-exe>=2.50.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pyinstaller>=6.6.0; extra == "dev"
|
|
34
|
+
Requires-Dist: build>=1.2.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
36
|
+
|
|
37
|
+
# build_it
|
|
38
|
+
|
|
39
|
+
> **Flutter multi-flavor build automation CLI** — read your `flavorizr` config
|
|
40
|
+
> and build all your app flavors in a single command.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
build_it build --all --parallel
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
[](https://www.python.org/)
|
|
47
|
+
[](LICENSE)
|
|
48
|
+
[](https://pypi.org/project/flutter-build-it/)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Why build_it?
|
|
53
|
+
|
|
54
|
+
Managing Flutter builds across multiple flavors quickly becomes tedious:
|
|
55
|
+
different `applicationId`s, per-environment Dart defines, and varying build
|
|
56
|
+
targets require long, error-prone shell commands.
|
|
57
|
+
|
|
58
|
+
**build_it** turns this:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
flutter build apk --flavor apple --dart-define ENV=prod --dart-define-from-file config/apple.json
|
|
62
|
+
flutter build apk --flavor banana --dart-define ENV=prod --dart-define-from-file config/banana.json
|
|
63
|
+
flutter build ios --flavor apple --dart-define ENV=prod --dart-define-from-file config/apple.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Into this:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
build_it build --all --parallel
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
| Feature | Details |
|
|
77
|
+
|---|---|
|
|
78
|
+
| **All flavorizr syntaxes** | v1 (legacy flat keys), v2+ standalone `flavorizr.yaml`, embedded in `pubspec.yaml` |
|
|
79
|
+
| **Per-flavor dart-defines** | Global → flavor → CLI priority merge |
|
|
80
|
+
| **Smart parallel builds** | Automatic parallelism across different targets; sequential within the same target |
|
|
81
|
+
| **Build type control** | `--type release` (default) / `profile` / `debug` |
|
|
82
|
+
| **Rich terminal output** | Live progress, per-flavor logs, final summary table with durations |
|
|
83
|
+
| **Zero config to start** | Works out of the box; `.build_it.yaml` is optional |
|
|
84
|
+
| **pip / pipx installable** | Single command global install, no manual PATH setup |
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Via pipx (recommended — fully isolated global install)
|
|
92
|
+
pipx install flutter-build-it
|
|
93
|
+
|
|
94
|
+
# Via pip
|
|
95
|
+
pip install flutter-build-it
|
|
96
|
+
|
|
97
|
+
# Development mode (editable install from the cloned repo)
|
|
98
|
+
pip install -e ".[dev]"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Quick start
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Run from the root of your Flutter project
|
|
107
|
+
|
|
108
|
+
build_it info # check project detection and tool version
|
|
109
|
+
build_it list # list detected flavors and resolved config
|
|
110
|
+
build_it init # generate a .build_it.yaml starter config
|
|
111
|
+
|
|
112
|
+
build_it build --flavor apple # build one flavor
|
|
113
|
+
build_it build --all # build all flavors (sequential)
|
|
114
|
+
build_it build --all --parallel # build across targets in parallel
|
|
115
|
+
build_it build --all --target appbundle # force a specific target
|
|
116
|
+
build_it build --flavor apple --type profile # profile build
|
|
117
|
+
build_it build --all -D ENV=staging -y # extra defines, skip prompt
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Configuration — `.build_it.yaml`
|
|
123
|
+
|
|
124
|
+
Place this file at the root of your Flutter project (next to `pubspec.yaml`).
|
|
125
|
+
Generate a pre-populated version with `build_it init`.
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
# .build_it.yaml
|
|
129
|
+
|
|
130
|
+
global:
|
|
131
|
+
targets: [apk] # default targets for every flavor
|
|
132
|
+
dart_defines: # applied to every build job
|
|
133
|
+
ENV: production
|
|
134
|
+
dart_define_files:
|
|
135
|
+
- config/global.json
|
|
136
|
+
extra_args: []
|
|
137
|
+
|
|
138
|
+
flavors:
|
|
139
|
+
apple:
|
|
140
|
+
targets: [apk, ios] # overrides global targets for this flavor
|
|
141
|
+
dart_defines:
|
|
142
|
+
FLAVOR_NAME: apple
|
|
143
|
+
dart_define_files:
|
|
144
|
+
- config/apple.json
|
|
145
|
+
entry_point: lib/main_apple.dart # optional custom entry point
|
|
146
|
+
|
|
147
|
+
banana:
|
|
148
|
+
# no targets → inherits global.targets
|
|
149
|
+
dart_defines:
|
|
150
|
+
FLAVOR_NAME: banana
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
You can also embed the config directly in `pubspec.yaml` under the `build_it:` key.
|
|
154
|
+
|
|
155
|
+
### Dart-define priority (highest → lowest)
|
|
156
|
+
|
|
157
|
+
| Priority | Source |
|
|
158
|
+
|---|---|
|
|
159
|
+
| 1 (highest) | `--dart-define` / `--dart-define-from-file` on the CLI |
|
|
160
|
+
| 2 | Flavor-specific `dart_defines` in `.build_it.yaml` |
|
|
161
|
+
| 3 (lowest) | Global `dart_defines` in `.build_it.yaml` |
|
|
162
|
+
|
|
163
|
+
For **key/value pairs**, higher-priority values override lower-priority ones on key collision.
|
|
164
|
+
For **files**, all sources are concatenated: global → flavor → CLI.
|
|
165
|
+
|
|
166
|
+
### Target priority (highest → lowest)
|
|
167
|
+
|
|
168
|
+
| Priority | Source |
|
|
169
|
+
|---|---|
|
|
170
|
+
| 1 (highest) | `--target` on the CLI |
|
|
171
|
+
| 2 | Flavor `targets` in `.build_it.yaml` |
|
|
172
|
+
| 3 (lowest) | Global `targets` in `.build_it.yaml` |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Parallel mode
|
|
177
|
+
|
|
178
|
+
| Scenario | Behaviour |
|
|
179
|
+
|---|---|
|
|
180
|
+
| Multiple flavors, **same target** | Sequential — prevents `build/` directory corruption |
|
|
181
|
+
| Multiple flavors, **different targets** | Parallel automatically suggested |
|
|
182
|
+
| `--parallel` flag | Forced parallel — each job gets an isolated `--output-dir build/outputs/<flavor>_<target>/` |
|
|
183
|
+
|
|
184
|
+
Output directories are printed in the summary table at the end of every build.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Commands
|
|
189
|
+
|
|
190
|
+
| Command | Description |
|
|
191
|
+
|---|---|
|
|
192
|
+
| `build_it info` | Project detection status and tool version |
|
|
193
|
+
| `build_it list` | Detected flavors with resolved targets and dart-defines |
|
|
194
|
+
| `build_it init [--force]` | Generate `.build_it.yaml` pre-populated with detected flavors |
|
|
195
|
+
| `build_it build [OPTIONS]` | Build one or all flavors |
|
|
196
|
+
| `build_it --version` | Print the installed version |
|
|
197
|
+
|
|
198
|
+
### `build_it build` options
|
|
199
|
+
|
|
200
|
+
| Option | Short | Description |
|
|
201
|
+
|---|---|---|
|
|
202
|
+
| `--flavor NAME` | `-f` | Flavor to build (omit to build all) |
|
|
203
|
+
| `--target TARGET` | `-t` | Override build target |
|
|
204
|
+
| `--all` | `-a` | Build all detected flavors |
|
|
205
|
+
| `--parallel` | `-p` | Run builds in parallel across targets |
|
|
206
|
+
| `--type MODE` | `-T` | Build mode: `release` (default), `profile`, `debug` |
|
|
207
|
+
| `--dart-define K=V` | `-D` | Extra dart define, repeatable |
|
|
208
|
+
| `--dart-define-from-file PATH` | `-F` | Extra define file, repeatable |
|
|
209
|
+
| `--yes` | `-y` | Skip confirmation prompt |
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Supported targets
|
|
214
|
+
|
|
215
|
+
| Value | Flutter command | Supports `--output-dir` |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| `apk` | `flutter build apk` | ✓ |
|
|
218
|
+
| `appbundle` | `flutter build appbundle` | ✓ |
|
|
219
|
+
| `ios` | `flutter build ipa` | ✓ |
|
|
220
|
+
| `web` | `flutter build web` | ✓ |
|
|
221
|
+
| `macos` | `flutter build macos` | — |
|
|
222
|
+
| `windows` | `flutter build windows` | — |
|
|
223
|
+
| `linux` | `flutter build linux` | — |
|
|
224
|
+
|
|
225
|
+
> **Note** — iOS and macOS builds require macOS. They are automatically
|
|
226
|
+
> skipped with status `⊘ skipped` on Linux and Windows hosts.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Project layout
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
build_it/
|
|
234
|
+
├── pyproject.toml
|
|
235
|
+
├── README.md
|
|
236
|
+
├── .gitignore
|
|
237
|
+
├── scripts/
|
|
238
|
+
│ └── build_binaries.sh ← PyInstaller build script
|
|
239
|
+
├── build_it/
|
|
240
|
+
│ ├── __init__.py ← version & author
|
|
241
|
+
│ ├── core/
|
|
242
|
+
│ │ ├── enums.py ← BuildTarget, BuildStatus, BuildType
|
|
243
|
+
│ │ ├── models.py ← Pydantic models (FlavorInfo, BuildJob, …)
|
|
244
|
+
│ │ ├── parser.py ← flavorizr parser (syntaxes A, B, C)
|
|
245
|
+
│ │ ├── config.py ← .build_it.yaml loader + resolver
|
|
246
|
+
│ │ └── builder.py ← async runner, parallel/sequential, summary
|
|
247
|
+
│ ├── cli/
|
|
248
|
+
│ │ └── main.py ← Typer app: list / build / init / info
|
|
249
|
+
│ └── utils/
|
|
250
|
+
│ ├── constants.py ← project-wide constants (no circular deps)
|
|
251
|
+
│ ├── utils.py ← has_flutter_project(), safe_load_yaml()
|
|
252
|
+
│ └── guards.py ← require_flutter_project() pre-flight check
|
|
253
|
+
└── tests/
|
|
254
|
+
├── fixtures/
|
|
255
|
+
│ ├── syntax_a.yaml ← flavorizr v2+ standalone
|
|
256
|
+
│ ├── syntax_b.yaml ← flavorizr embedded in pubspec.yaml
|
|
257
|
+
│ └── syntax_c.yaml ← flavorizr v1 legacy (flat keys)
|
|
258
|
+
└── unit/
|
|
259
|
+
└── test_parser_config.py
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Development
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Clone and install in editable mode with dev dependencies
|
|
268
|
+
git clone https://github.com/dasero197/build_it.git
|
|
269
|
+
cd build_it
|
|
270
|
+
pip install -e ".[dev]"
|
|
271
|
+
|
|
272
|
+
# Run the test suite
|
|
273
|
+
pytest
|
|
274
|
+
|
|
275
|
+
# Build a standalone binary (requires PyInstaller)
|
|
276
|
+
bash scripts/build_binaries.sh
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Running tests
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
pytest -v
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The test suite covers:
|
|
286
|
+
|
|
287
|
+
- Parser — all three flavorizr syntaxes (A, B, C) and edge cases
|
|
288
|
+
- Config — loading, target resolution, dart-define merge priority
|
|
289
|
+
- `generate_default_config` — YAML validity and content
|
|
290
|
+
|
|
291
|
+
Tests never invoke `flutter` — the build runner is tested separately via mocks.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Roadmap
|
|
296
|
+
|
|
297
|
+
- [x] P0 — Standalone project structure & package skeleton
|
|
298
|
+
- [x] P1 — flavorizr parser (syntaxes A, B, C) + `.build_it.yaml` resolver
|
|
299
|
+
- [x] P2 — Builder (async runner) + CLI commands (`list`, `build`, `init`, `info`)
|
|
300
|
+
- [x] P3 — Distribution: PyPI publication + PyInstaller binary + GitHub CI/CD setup
|
|
301
|
+
- [ ] P4 — Polish: verbose/quiet logging, build report, extended test coverage
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 🤖 A Word from the Author: Human-AI Collaboration
|
|
306
|
+
|
|
307
|
+
This project was developed in collaboration with **Claude** and **Gemini** via the **Antigravity** agent.
|
|
308
|
+
|
|
309
|
+
In the modern era of AI, it is crucial not to fall into blind dependency, but rather to master the art of conciliating human architectural skills with the raw execution speed of AI.
|
|
310
|
+
By maintaining the role of the Architect—designing workflows, drafting precise skeletons, defining rules, and steering corrections—while delegating boilerplate, bash scripting, and exhaustive docstring generation to the AI, we were able to deliver a complete, robust, and pristine product in record time.
|
|
311
|
+
|
|
312
|
+
This repository stands as a testament to augmented software engineering: a powerful synergy between human vision and artificial intelligence.
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Contributing
|
|
317
|
+
|
|
318
|
+
Contributions, issues, and feature requests are welcome.
|
|
319
|
+
Please open an issue before submitting a PR so we can discuss the approach.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT © [Dayane S. R. Assogba](https://github.com/dasero197)
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# build_it
|
|
2
|
+
|
|
3
|
+
> **Flutter multi-flavor build automation CLI** — read your `flavorizr` config
|
|
4
|
+
> and build all your app flavors in a single command.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
build_it build --all --parallel
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
[](https://www.python.org/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://pypi.org/project/flutter-build-it/)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Why build_it?
|
|
17
|
+
|
|
18
|
+
Managing Flutter builds across multiple flavors quickly becomes tedious:
|
|
19
|
+
different `applicationId`s, per-environment Dart defines, and varying build
|
|
20
|
+
targets require long, error-prone shell commands.
|
|
21
|
+
|
|
22
|
+
**build_it** turns this:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
flutter build apk --flavor apple --dart-define ENV=prod --dart-define-from-file config/apple.json
|
|
26
|
+
flutter build apk --flavor banana --dart-define ENV=prod --dart-define-from-file config/banana.json
|
|
27
|
+
flutter build ios --flavor apple --dart-define ENV=prod --dart-define-from-file config/apple.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Into this:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
build_it build --all --parallel
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
| Feature | Details |
|
|
41
|
+
|---|---|
|
|
42
|
+
| **All flavorizr syntaxes** | v1 (legacy flat keys), v2+ standalone `flavorizr.yaml`, embedded in `pubspec.yaml` |
|
|
43
|
+
| **Per-flavor dart-defines** | Global → flavor → CLI priority merge |
|
|
44
|
+
| **Smart parallel builds** | Automatic parallelism across different targets; sequential within the same target |
|
|
45
|
+
| **Build type control** | `--type release` (default) / `profile` / `debug` |
|
|
46
|
+
| **Rich terminal output** | Live progress, per-flavor logs, final summary table with durations |
|
|
47
|
+
| **Zero config to start** | Works out of the box; `.build_it.yaml` is optional |
|
|
48
|
+
| **pip / pipx installable** | Single command global install, no manual PATH setup |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Via pipx (recommended — fully isolated global install)
|
|
56
|
+
pipx install flutter-build-it
|
|
57
|
+
|
|
58
|
+
# Via pip
|
|
59
|
+
pip install flutter-build-it
|
|
60
|
+
|
|
61
|
+
# Development mode (editable install from the cloned repo)
|
|
62
|
+
pip install -e ".[dev]"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Run from the root of your Flutter project
|
|
71
|
+
|
|
72
|
+
build_it info # check project detection and tool version
|
|
73
|
+
build_it list # list detected flavors and resolved config
|
|
74
|
+
build_it init # generate a .build_it.yaml starter config
|
|
75
|
+
|
|
76
|
+
build_it build --flavor apple # build one flavor
|
|
77
|
+
build_it build --all # build all flavors (sequential)
|
|
78
|
+
build_it build --all --parallel # build across targets in parallel
|
|
79
|
+
build_it build --all --target appbundle # force a specific target
|
|
80
|
+
build_it build --flavor apple --type profile # profile build
|
|
81
|
+
build_it build --all -D ENV=staging -y # extra defines, skip prompt
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Configuration — `.build_it.yaml`
|
|
87
|
+
|
|
88
|
+
Place this file at the root of your Flutter project (next to `pubspec.yaml`).
|
|
89
|
+
Generate a pre-populated version with `build_it init`.
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
# .build_it.yaml
|
|
93
|
+
|
|
94
|
+
global:
|
|
95
|
+
targets: [apk] # default targets for every flavor
|
|
96
|
+
dart_defines: # applied to every build job
|
|
97
|
+
ENV: production
|
|
98
|
+
dart_define_files:
|
|
99
|
+
- config/global.json
|
|
100
|
+
extra_args: []
|
|
101
|
+
|
|
102
|
+
flavors:
|
|
103
|
+
apple:
|
|
104
|
+
targets: [apk, ios] # overrides global targets for this flavor
|
|
105
|
+
dart_defines:
|
|
106
|
+
FLAVOR_NAME: apple
|
|
107
|
+
dart_define_files:
|
|
108
|
+
- config/apple.json
|
|
109
|
+
entry_point: lib/main_apple.dart # optional custom entry point
|
|
110
|
+
|
|
111
|
+
banana:
|
|
112
|
+
# no targets → inherits global.targets
|
|
113
|
+
dart_defines:
|
|
114
|
+
FLAVOR_NAME: banana
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
You can also embed the config directly in `pubspec.yaml` under the `build_it:` key.
|
|
118
|
+
|
|
119
|
+
### Dart-define priority (highest → lowest)
|
|
120
|
+
|
|
121
|
+
| Priority | Source |
|
|
122
|
+
|---|---|
|
|
123
|
+
| 1 (highest) | `--dart-define` / `--dart-define-from-file` on the CLI |
|
|
124
|
+
| 2 | Flavor-specific `dart_defines` in `.build_it.yaml` |
|
|
125
|
+
| 3 (lowest) | Global `dart_defines` in `.build_it.yaml` |
|
|
126
|
+
|
|
127
|
+
For **key/value pairs**, higher-priority values override lower-priority ones on key collision.
|
|
128
|
+
For **files**, all sources are concatenated: global → flavor → CLI.
|
|
129
|
+
|
|
130
|
+
### Target priority (highest → lowest)
|
|
131
|
+
|
|
132
|
+
| Priority | Source |
|
|
133
|
+
|---|---|
|
|
134
|
+
| 1 (highest) | `--target` on the CLI |
|
|
135
|
+
| 2 | Flavor `targets` in `.build_it.yaml` |
|
|
136
|
+
| 3 (lowest) | Global `targets` in `.build_it.yaml` |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Parallel mode
|
|
141
|
+
|
|
142
|
+
| Scenario | Behaviour |
|
|
143
|
+
|---|---|
|
|
144
|
+
| Multiple flavors, **same target** | Sequential — prevents `build/` directory corruption |
|
|
145
|
+
| Multiple flavors, **different targets** | Parallel automatically suggested |
|
|
146
|
+
| `--parallel` flag | Forced parallel — each job gets an isolated `--output-dir build/outputs/<flavor>_<target>/` |
|
|
147
|
+
|
|
148
|
+
Output directories are printed in the summary table at the end of every build.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Commands
|
|
153
|
+
|
|
154
|
+
| Command | Description |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `build_it info` | Project detection status and tool version |
|
|
157
|
+
| `build_it list` | Detected flavors with resolved targets and dart-defines |
|
|
158
|
+
| `build_it init [--force]` | Generate `.build_it.yaml` pre-populated with detected flavors |
|
|
159
|
+
| `build_it build [OPTIONS]` | Build one or all flavors |
|
|
160
|
+
| `build_it --version` | Print the installed version |
|
|
161
|
+
|
|
162
|
+
### `build_it build` options
|
|
163
|
+
|
|
164
|
+
| Option | Short | Description |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| `--flavor NAME` | `-f` | Flavor to build (omit to build all) |
|
|
167
|
+
| `--target TARGET` | `-t` | Override build target |
|
|
168
|
+
| `--all` | `-a` | Build all detected flavors |
|
|
169
|
+
| `--parallel` | `-p` | Run builds in parallel across targets |
|
|
170
|
+
| `--type MODE` | `-T` | Build mode: `release` (default), `profile`, `debug` |
|
|
171
|
+
| `--dart-define K=V` | `-D` | Extra dart define, repeatable |
|
|
172
|
+
| `--dart-define-from-file PATH` | `-F` | Extra define file, repeatable |
|
|
173
|
+
| `--yes` | `-y` | Skip confirmation prompt |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Supported targets
|
|
178
|
+
|
|
179
|
+
| Value | Flutter command | Supports `--output-dir` |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `apk` | `flutter build apk` | ✓ |
|
|
182
|
+
| `appbundle` | `flutter build appbundle` | ✓ |
|
|
183
|
+
| `ios` | `flutter build ipa` | ✓ |
|
|
184
|
+
| `web` | `flutter build web` | ✓ |
|
|
185
|
+
| `macos` | `flutter build macos` | — |
|
|
186
|
+
| `windows` | `flutter build windows` | — |
|
|
187
|
+
| `linux` | `flutter build linux` | — |
|
|
188
|
+
|
|
189
|
+
> **Note** — iOS and macOS builds require macOS. They are automatically
|
|
190
|
+
> skipped with status `⊘ skipped` on Linux and Windows hosts.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Project layout
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
build_it/
|
|
198
|
+
├── pyproject.toml
|
|
199
|
+
├── README.md
|
|
200
|
+
├── .gitignore
|
|
201
|
+
├── scripts/
|
|
202
|
+
│ └── build_binaries.sh ← PyInstaller build script
|
|
203
|
+
├── build_it/
|
|
204
|
+
│ ├── __init__.py ← version & author
|
|
205
|
+
│ ├── core/
|
|
206
|
+
│ │ ├── enums.py ← BuildTarget, BuildStatus, BuildType
|
|
207
|
+
│ │ ├── models.py ← Pydantic models (FlavorInfo, BuildJob, …)
|
|
208
|
+
│ │ ├── parser.py ← flavorizr parser (syntaxes A, B, C)
|
|
209
|
+
│ │ ├── config.py ← .build_it.yaml loader + resolver
|
|
210
|
+
│ │ └── builder.py ← async runner, parallel/sequential, summary
|
|
211
|
+
│ ├── cli/
|
|
212
|
+
│ │ └── main.py ← Typer app: list / build / init / info
|
|
213
|
+
│ └── utils/
|
|
214
|
+
│ ├── constants.py ← project-wide constants (no circular deps)
|
|
215
|
+
│ ├── utils.py ← has_flutter_project(), safe_load_yaml()
|
|
216
|
+
│ └── guards.py ← require_flutter_project() pre-flight check
|
|
217
|
+
└── tests/
|
|
218
|
+
├── fixtures/
|
|
219
|
+
│ ├── syntax_a.yaml ← flavorizr v2+ standalone
|
|
220
|
+
│ ├── syntax_b.yaml ← flavorizr embedded in pubspec.yaml
|
|
221
|
+
│ └── syntax_c.yaml ← flavorizr v1 legacy (flat keys)
|
|
222
|
+
└── unit/
|
|
223
|
+
└── test_parser_config.py
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Development
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Clone and install in editable mode with dev dependencies
|
|
232
|
+
git clone https://github.com/dasero197/build_it.git
|
|
233
|
+
cd build_it
|
|
234
|
+
pip install -e ".[dev]"
|
|
235
|
+
|
|
236
|
+
# Run the test suite
|
|
237
|
+
pytest
|
|
238
|
+
|
|
239
|
+
# Build a standalone binary (requires PyInstaller)
|
|
240
|
+
bash scripts/build_binaries.sh
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Running tests
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
pytest -v
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
The test suite covers:
|
|
250
|
+
|
|
251
|
+
- Parser — all three flavorizr syntaxes (A, B, C) and edge cases
|
|
252
|
+
- Config — loading, target resolution, dart-define merge priority
|
|
253
|
+
- `generate_default_config` — YAML validity and content
|
|
254
|
+
|
|
255
|
+
Tests never invoke `flutter` — the build runner is tested separately via mocks.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Roadmap
|
|
260
|
+
|
|
261
|
+
- [x] P0 — Standalone project structure & package skeleton
|
|
262
|
+
- [x] P1 — flavorizr parser (syntaxes A, B, C) + `.build_it.yaml` resolver
|
|
263
|
+
- [x] P2 — Builder (async runner) + CLI commands (`list`, `build`, `init`, `info`)
|
|
264
|
+
- [x] P3 — Distribution: PyPI publication + PyInstaller binary + GitHub CI/CD setup
|
|
265
|
+
- [ ] P4 — Polish: verbose/quiet logging, build report, extended test coverage
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 🤖 A Word from the Author: Human-AI Collaboration
|
|
270
|
+
|
|
271
|
+
This project was developed in collaboration with **Claude** and **Gemini** via the **Antigravity** agent.
|
|
272
|
+
|
|
273
|
+
In the modern era of AI, it is crucial not to fall into blind dependency, but rather to master the art of conciliating human architectural skills with the raw execution speed of AI.
|
|
274
|
+
By maintaining the role of the Architect—designing workflows, drafting precise skeletons, defining rules, and steering corrections—while delegating boilerplate, bash scripting, and exhaustive docstring generation to the AI, we were able to deliver a complete, robust, and pristine product in record time.
|
|
275
|
+
|
|
276
|
+
This repository stands as a testament to augmented software engineering: a powerful synergy between human vision and artificial intelligence.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Contributing
|
|
281
|
+
|
|
282
|
+
Contributions, issues, and feature requests are welcome.
|
|
283
|
+
Please open an issue before submitting a PR so we can discuss the approach.
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
MIT © [Dayane S. R. Assogba](https://github.com/dasero197)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
build_it — Flutter multi-flavor build automation CLI.
|
|
3
|
+
=====================================================
|
|
4
|
+
|
|
5
|
+
build_it is a standalone Python CLI that reads your ``flavorizr`` configuration
|
|
6
|
+
and builds all your Flutter app flavors in a single command — with support for
|
|
7
|
+
per-flavor dart-defines, parallel execution, and rich terminal output.
|
|
8
|
+
|
|
9
|
+
Quick start
|
|
10
|
+
-----------
|
|
11
|
+
::
|
|
12
|
+
|
|
13
|
+
# From the root of your Flutter project
|
|
14
|
+
build_it info # check project detection
|
|
15
|
+
build_it list # list flavors and resolved config
|
|
16
|
+
build_it init # generate .build_it.yaml starter config
|
|
17
|
+
build_it build --all # build every flavor sequentially
|
|
18
|
+
build_it build --all --parallel # build across targets in parallel
|
|
19
|
+
|
|
20
|
+
Package layout
|
|
21
|
+
--------------
|
|
22
|
+
::
|
|
23
|
+
|
|
24
|
+
build_it/
|
|
25
|
+
├── __init__.py ← version and author (this file)
|
|
26
|
+
├── core/
|
|
27
|
+
│ ├── enums.py ← BuildTarget, BuildStatus, BuildType
|
|
28
|
+
│ ├── models.py ← Pydantic models: FlavorInfo, BuildJob, …
|
|
29
|
+
│ ├── parser.py ← flavorizr parser (syntaxes A, B, C)
|
|
30
|
+
│ ├── config.py ← .build_it.yaml loader and resolver
|
|
31
|
+
│ └── builder.py ← async runner, parallel/sequential logic
|
|
32
|
+
├── cli/
|
|
33
|
+
│ └── main.py ← Typer app: list / build / init / info
|
|
34
|
+
└── utils/
|
|
35
|
+
├── constants.py ← project-wide constants (no circular deps)
|
|
36
|
+
├── utils.py ← has_flutter_project(), safe_load_yaml()
|
|
37
|
+
└── guards.py ← require_flutter_project() pre-flight check
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
__version__ = "0.1.2"
|
|
41
|
+
__author__ = "Dayane S. R. Assogba"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
build_it.cli
|
|
3
|
+
============
|
|
4
|
+
Typer-based command-line interface for build_it.
|
|
5
|
+
|
|
6
|
+
The entry point registered in ``pyproject.toml`` is:
|
|
7
|
+
|
|
8
|
+
[project.scripts]
|
|
9
|
+
build_it = "build_it.cli.main:app"
|
|
10
|
+
|
|
11
|
+
Modules
|
|
12
|
+
-------
|
|
13
|
+
main
|
|
14
|
+
The :data:`~build_it.cli.main.app` Typer application with all four
|
|
15
|
+
sub-commands: ``list``, ``build``, ``init``, ``info``.
|
|
16
|
+
"""
|