Repository navigation
Commit 453cb46
[flutter_tools] Implement Templates slice and flutter create integration (flutter#191748)
## Description
This PR implements Step 5 of Flutter Tools Extensibility: the Templates
extension slice and `flutter create` dynamic template integration.
### Architectural Overview
1. **`package:flutter_tools_core`**:
- Defines core, platform-agnostic template models: `ProjectTemplate` and
`ExtensionProjectTemplate` with JSON serialization, equality, and
unordered set hashing.
2. **`package:flutter_tools_extension`**:
- Defines the `TemplateService` RPC interface and handlers for
`template.getAppTemplates`, `template.getPluginTemplates`,
`template.getProjectTemplates`, and
`template.generateTemplateParameters`.
3. **`package:flutter_tools_extension_linux_prototype`**:
- Implements `LinuxTemplateService` and `LinuxProjectTemplate` declaring
custom template `'custom-linux-app'` with `templateDependencies:
{'app'}`.
- Adds prototype template assets for `'custom-linux-app'`.
4. **`packages/flutter_tools`**:
- Implements `ExtensionTemplateManager` to discover custom templates
over RPC concurrently, cache them, resolve directories, and delegate
parameter generation.
- Updates `Template.fromDirectories` to merge directory sources over
base template dependencies.
- Integrates dynamic `--template` CLI options and help text into
`CreateCommand` using `ExtensionArgParserMixin`.
- Supports `ExtensionProjectTemplateType` in `FlutterProjectMetadata`
and `ParsedFlutterTemplateType`.
- Wires `ExtensionTemplateManager` through `executable.dart` into
`CreateCommand`.
## Related Issues
Part of flutter#190692
## Tests
- Added
`packages/flutter_tools/packages/flutter_tools_core/test/templates_test.dart`
- Added
`packages/flutter_tools/packages/flutter_tools_extension_linux_prototype/test/linux_template_test.dart`
- Added
`packages/flutter_tools/test/general.shard/extension_protocol/template_service_test.dart`
- Updated
`packages/flutter_tools/test/general.shard/flutter_project_metadata_test.dart`
- Updated
`packages/flutter_tools/test/integration.shard/tool_extensions_test.dart`
---------
Co-authored-by: Loïc Sharma <[email protected]>1 parent b7362ab commit 453cb46
22 files changed
Lines changed: 1381 additions & 115 deletions
File tree
- packages/flutter_tools
- lib
- src
- commands
- experimental
- reporting
- packages
- flutter_tools_core
- lib
- src
- test
- flutter_tools_extension_linux_prototype
- lib
- src
- templates/custom-linux-app
- lib
- test
- flutter_tools_extension/lib
- src
- test
- general.shard
- extension_protocol
- integration.shard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
120 | 127 | | |
121 | 128 | | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| 132 | + | |
125 | 133 | | |
126 | 134 | | |
127 | 135 | | |
| |||
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
| 236 | + | |
228 | 237 | | |
229 | 238 | | |
230 | 239 | | |
| |||
301 | 310 | | |
302 | 311 | | |
303 | 312 | | |
304 | | - | |
| 313 | + | |
305 | 314 | | |
306 | 315 | | |
307 | 316 | | |
| |||
0 commit comments