Skip to content

RFC 510.0000: Targeting Custom Embedders with Flutter Tools - #40

Open
bkonyi wants to merge 7 commits into
flutter:mainfrom
bkonyi:rfc-510-tool-extensions
Open

bkonyi wants to merge 7 commits into
flutter:mainfrom
bkonyi:rfc-510-tool-extensions

Conversation

@bkonyi

@bkonyi bkonyi commented Oct 30, 2026 •

Copy link
Copy Markdown

Proposes a first-class, isolate-based platform extension architecture for the Flutter CLI (flutter_tools) that decouples custom and embedded target platform tooling from the core Flutter SDK into project-scoped Dart packages (package:flutter_tools_extension and package:flutter_tools_core).

Extensions are discovered from direct dev_dependencies via package:extension_discovery (extension/flutter_tools/config.yaml), compiled to cached kernel .dill snapshots, and spawned in background isolates communicating over a bidirectional JSON-RPC 2.0 protocol (package:json_rpc_2). This allows third-party and custom embedder authors to integrate devices, emulators, build and assemble targets, platform scaffolding templates, SDK artifacts, configuration flags/actions, and doctor diagnostics directly into standard flutter commands without forking the Flutter SDK or maintaining wrapper CLIs.

Tracking issue: flutter/flutter#190755

Pre-launch Checklist

  • I read RFC 000.0001: Taxonomy and followed the file and path naming and metadata standards.
  • I read RFC 000.0002: Process and confirmed this proposal meets the threshold for a full RFC.
  • I read and agree to the Code of Conduct.
  • I signed the CLA.
  • I have linked an issue from flutter/flutter with the label design doc.
  • All existing and new tests are passing.
  • I have enabled "Allow edits from maintainers" on this PR so the bot can automatically assign an RFC number (or I will run dart run bin/assign_rfc_number.dart locally when instructed).

If you need help, consider asking for advice on the #hackers channel on Discord.

Proposes a first-class, isolate-based platform extension architecture for the Flutter CLI (`flutter_tools`) that decouples custom and embedded target platform tooling from the core Flutter SDK into project-scoped Dart packages (`package:flutter_tools_extension` and `package:flutter_tools_core`).
@bkonyi
bkonyi force-pushed the rfc-510-tool-extensions branch from a6b1ae9 to 93d53ea Compare October 30, 2026 18:27
@bkonyi
bkonyi marked this pull request as ready for review November 2, 2026 18:08
…ing options

- Add `ToolExtensionService.getConfigurationValues()` (`extension.getConfigurationValues`) for reading extension-owned `flutter config` settings at runtime in service subclasses, and pass `ExtensionBuildContext.configuration` into `BuildTarget` and `AssembleTarget` so `flutter assemble` tracks configuration changes.
- Expand `ExtensionBuildContext` and `ExtensionAssembleContext` with `codeSizeDirectory`, `dartObfuscation`, `extraFrontEndOptions`, `extraGenSnapshotOptions`, `splitDebugInfo`, `targetDeviceId`, `trackWidgetCreation`, and `treeShakeIcons`.
- Define `ExtensionDebuggingOptions` with `engineSwitches`, `deviceVmServicePort`, `hostVmServicePort`, `dartEntrypointArgs`, `route`, and `uninstallFirst`.
…cal artifacts

- Add `ToolExtensionService.promptForInput()` (`terminal.promptForInput`) for free-form text and passphrase input in interactive `ConfigAction` flows.
- Add `targetOs` and `shaderTargets` (`ExtensionShaderTarget`) to `BuildTarget` for `BuiltInTargets.kernelSnapshot`, `BuiltInTargets.copyAssets`, and `flutter run` shader hot reload.
- Specify `TemplateService.generatePluginPlatformConfig`, `flutter create --no-platforms`, `BuildTarget.resolveNativeAssetsConfig`, `DeviceService.launchApp` `prebuiltApplication`, `ArtifactDependency.local`, and `flutter daemon` multi-root discovery.
Adds `DeviceService.resolveApplication` (`ExtensionApplicationResolutionContext` and `ExtensionApplicationPackage`), `appId` parameters across `launchApp`, `startLogStream`, `getVmServiceUri`, and `stopApp`, and `prebuiltApplication` on `installApp` to support `flutter logs`, `flutter install`, `flutter drive`, and `flutter test integration_test -d <device>`. Also clarifies absolute `ExtensionBuildContext.mainPath` semantics and `TargetDevice.supportsInstall` gating across `installApp`, `uninstallApp`, and `isAppInstalled`.
…fact executables in RFC 510.0000

- Expand `TemplateService` with custom CLI `flags` (`TemplateFlag`) and `options` (`TemplateOption`), dynamic `resolvePlatformTemplate` (`ExtensionPlatformTemplate` with validated `overwritePaths` and insert-if-missing `dependencies`), `ffiPluginPlatformTemplates`, `*Platforms` discovery getters (`appPlatforms`, `pluginPlatforms`, `ffiPluginPlatforms`), `templateType` on `generatePluginPlatformConfig`, and add-to-app module build guidance.
- Add `ExtensionBuildResult.bundleDirectoryUri` and `aotSnapshotFileName` to support host `SizeAnalyzer.analyzeAotSnapshot` when `--analyze-size` is passed to `flutter build <name>`.
- Add `DeviceService.createEmulator` returning `TargetEmulator` and specify `--platform` disambiguation on `flutter emulators --create`.
- Align `ArtifactService` on `listRequiredArtifacts`, `ArchiveFormat`, `RemoteArtifactDependency` (`executables` and `isExecutable` for POSIX `chmod +x`), and `const factory ArtifactDependency.local` (`LocalArtifactDependency`).

Pure RFC documentation update; verified with `bin/rfc_lint.dart --enforce-drafts` and `bin/validate_rfc_number.dart --base-branch origin/main` (no unit tests apply).
- Replace `extension/flutter_tools/config.yaml` and `package:extension_discovery` with direct-dependency `pubspec.yaml` discovery of `extension/flutter_tools/extension.dart`, typed `supportedHostPlatforms` (`Set<HostPlatform>?`) on `ToolExtensionEntryPoint.run` (with `final class HostPlatform` static constants), and cached `ToolExtensionCapabilities` handshake metadata.
- Specify two-tier `.dill` cache keying across exact Dart SDK revisions and immutable (`hosted`/`git`) dependency closures, plus `extension.dill.stamp` freshness ordering for mutable (`path:`/workspace) extensions and multi-project `flutter daemon` sessions.
- Document why pure-Dart wire and diagnostic models live in `package:flutter_tools_core` rather than re-exporting `package:code_assets` or `package:hooks`.
- Clarify the three-package boundary between `package:flutter_tools_core`, `package:flutter_tools_extension`, and `package:flutter_tools` with a horizontal Mermaid architecture diagram, add the `flutter daemon` IDE integration summary bullet, and fix the `flutter-tizen` reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants