Skip to content

[flutter_tools] Add ExtensionPackageConfig manifest model and Isolate.spawnUri support - #194590

Merged
auto-submit[bot] merged 17 commits into
flutter:masterfrom
bkonyi:ft-ext-phase01-03-project-discovery
Oct 29, 2026
Merged

auto-submit[bot] merged 17 commits into
flutter:masterfrom
bkonyi:ft-ext-phase01-03-project-discovery

Conversation

@bkonyi

@bkonyi bkonyi commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Introduce ExtensionPackageConfig in package:flutter_tools_core for parsing extension/flutter_tools/config.yaml manifests, Isolate.spawnUri entrypoint support in ToolExtensionEntryPoint.run and package:flutter_tools_extension_linux_prototype, and ExtensionConnection.spawnUri (with expectedConfig capability validation) in flutter_tools.

Stack

Part of #190755

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

…tion, and safe mode

Introduce `ProjectExtensionFinder` (via `package:extension_discovery` and `extension/flutter_tools/config.yaml`), `ExtensionPackageConfig`, `ExtensionKernelCompiler` (`.dill` compilation with atomic writes and lockfiles), `--[no-]extensions` / `FLUTTER_NO_EXTENSIONS` safe mode, lazy capability filtering, and in-place `flutter create . --platforms=<custom>` support.
@bkonyi bkonyi added CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels. labels Oct 16, 2026
@github-actions github-actions Bot added the team-linux Owned by the Linux platform team label Oct 16, 2026
…onfig validation

- Acquire an exclusive lockfile (.dill.lock) via FileSystemLocking.runLocked and atomically rename temporary .dill.tmp and .d.tmp outputs in ExtensionKernelCompiler.compile.
- Ensure --extensions does not bypass FLUTTER_NO_EXTENSIONS=1 or enable tool extensions when the feature flag is disabled.
- Validate ExtensionPackageConfig.entrypoint against path traversal and filter platform template queries by requested custom platforms.
- Make FeatureFlags required on ExtensionManager and Artifacts required on ExtensionKernelCompiler, and refresh ExtensionBuildManager.getBuildTargets when new extension connections initialize.
… Isolate.spawnUri support

- Scope this branch to the ExtensionPackageConfig manifest model in flutter_tools_core, Isolate.spawnUri entrypoint support in flutter_tools_extension and flutter_tools_extension_linux_prototype, and ExtensionConnection.spawnUri in extension_discovery.dart.
- Split safe mode, ProjectExtensionFinder / ExtensionKernelCompiler, and dynamic discovery wiring into separate stacked PRs.
@bkonyi bkonyi changed the title [flutter_tools] Add project-scoped extension discovery, .dill compilation, and safe mode [flutter_tools] Add ExtensionPackageConfig manifest model and Isolate.spawnUri support Oct 19, 2026
…roject-discovery

# Conflicts:
#	packages/flutter_tools/lib/src/experimental/extension_discovery.dart
#	packages/flutter_tools/packages/flutter_tools_core/lib/flutter_tools_core.dart
#	packages/flutter_tools/packages/flutter_tools_extension/lib/src/protocol_base/provider.dart
… ExtensionConnection

- Mark `ExtensionConnection.spawn` as `@visibleForTesting` and suppress the
  transitional use in `ExtensionManager.initialize()` until flutter#194774.
- Add `ExtensionJsonParsing.stringSet` for parsing sets of unique strings,
  optionally trimming and rejecting empty entries.
- Require a non-empty `services` list in `ExtensionPackageConfig`, use
  `stringSet` for all list fields, accept `Map<String, Object?>` in
  `fromMap`, and document string identifier conventions.

Part of flutter#190755
… clean up ignore comment

- Use a comma instead of a second `//` in the transitional suppression in
  `ExtensionManager.initialize()`:
  `// ignore: invalid_use_of_visible_for_testing_member, transitional until flutter#194774.`
- Drop `protocol_version` from `ExtensionPackageConfig`, its schema
  documentation, and the Linux prototype `config.yaml`. Protocol
  compatibility is governed by `package:flutter_tools_extension`
  dependency versions and no runtime protocol negotiation is performed.

Part of flutter#190755
@bkonyi
bkonyi marked this pull request as ready for review October 21, 2026 21:31
@bkonyi
bkonyi requested a review from a team as a code owner October 21, 2026 21:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces dynamic extension discovery and spawning capabilities in Flutter tools. It adds ExtensionConnection.spawnUri to dynamically spawn extension isolates from a URI, introduces the ExtensionPackageConfig class to parse static metadata from an extension's config.yaml, and provides a prototype extension for Linux. Feedback on the changes suggests removing redundant type annotations on initializing formal parameters in ExtensionConnection._ and trimming string list inputs in the ExtensionPackageConfig constructor to ensure consistency and prevent whitespace-related bugs.

…nd trim config string lists

- Remove redundant `Isolate` type on initializing formal `this._isolate`.
- Trim `supportedPlatforms`, `services`, `buildTargets`, and `templates` in `ExtensionPackageConfig` constructor.

Part of flutter#190755
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Oct 21, 2026
…mode (flutter#194771)

Add the global `--[no-]extensions` CLI flag and
`FLUTTER_NO_EXTENSIONS=1` environment variable to bypass tool extension
discovery and isolate spawning, and require `FeatureFlags` on
`ExtensionManager`.

### Stack
- **PR 1A (parallel off `master`)**:
flutter#194590
(`ft-ext-phase01-03-project-discovery`)
- **PR 1B (this PR)**: flutter#194771
(`ft-ext-phase01b-safe-mode`)
- **PR 1C (stacked on 1A)**:
flutter#194772
(`ft-ext-phase01c-finder-and-compiler`)
- **PR 1D (stacked on 1B + 1C)**:
flutter#194774
(`ft-ext-phase01d-dynamic-discovery-wiring`)

Part of flutter#190755

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
LongCatIsLooong pushed a commit to LongCatIsLooong/flutter that referenced this pull request Oct 22, 2026
…mode (flutter#194771)

Add the global `--[no-]extensions` CLI flag and
`FLUTTER_NO_EXTENSIONS=1` environment variable to bypass tool extension
discovery and isolate spawning, and require `FeatureFlags` on
`ExtensionManager`.

### Stack
- **PR 1A (parallel off `master`)**:
flutter#194590
(`ft-ext-phase01-03-project-discovery`)
- **PR 1B (this PR)**: flutter#194771
(`ft-ext-phase01b-safe-mode`)
- **PR 1C (stacked on 1A)**:
flutter#194772
(`ft-ext-phase01c-finder-and-compiler`)
- **PR 1D (stacked on 1B + 1C)**:
flutter#194774
(`ft-ext-phase01d-dynamic-discovery-wiring`)

Part of flutter#190755

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
chingjun
chingjun previously approved these changes Oct 22, 2026
static Future<ExtensionConnection> spawnUri(
Uri entrypointUri, {
required Logger logger,
required Uri packageConfigUri,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? If entrypoint is pointing to a dill file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly required by the VM for a dill, but spawnUri also runs .dart scripts directly and we want to ensure the isolate doesn't inherit the tool's own package config if it does any runtime package resolution.

…-project-discovery

# Conflicts:
#	packages/flutter_tools/packages/flutter_tools_core/lib/flutter_tools_core.dart
#	packages/flutter_tools/packages/flutter_tools_core/lib/src/json_utils.dart
#	packages/flutter_tools/packages/flutter_tools_core/test/json_utils_test.dart
return Set<String>.unmodifiable(<String>{
for (final String item in items)
if (item.trim().isNotEmpty)
item.trim()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not obvious from the call site that rejectEmpty: true also trims values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split trim out into its own parameter.

if (services.isEmpty) {
throw const FormatException(
'Extension config.yaml must specify a non-empty list of services for "$servicesKey".',
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this too harsh? Imagine I'm creating a new extension and before I'd like to check that the tool accepts my new extension before I add my first service.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. Made services optional and able to accept an empty list :)

loic-sharma
loic-sharma previously approved these changes Oct 23, 2026

@loic-sharma loic-sharma left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, comments are only nits

…-project-discovery

# Conflicts:
#	packages/flutter_tools/lib/src/experimental/extension_discovery.dart
#	packages/flutter_tools/test/general.shard/extension_protocol/extension_discovery_test.dart
…xtension_discovery_test.dart

Use `package:flutter_tools/src/base/file_system.dart` and `LocalFileSystem.test(signals: LocalSignals.instance)` in `extension_discovery_test.dart` so `forbidden_imports_test.dart` passes on CI.
@bkonyi
bkonyi requested a review from loic-sharma October 28, 2026 19:48
@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 28, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 29, 2026
Merged via the queue into flutter:master with commit b458087 Oct 29, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 29, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…mode (flutter#194771)

Add the global `--[no-]extensions` CLI flag and
`FLUTTER_NO_EXTENSIONS=1` environment variable to bypass tool extension
discovery and isolate spawning, and require `FeatureFlags` on
`ExtensionManager`.

### Stack
- **PR 1A (parallel off `master`)**:
flutter#194590
(`ft-ext-phase01-03-project-discovery`)
- **PR 1B (this PR)**: flutter#194771
(`ft-ext-phase01b-safe-mode`)
- **PR 1C (stacked on 1A)**:
flutter#194772
(`ft-ext-phase01c-finder-and-compiler`)
- **PR 1D (stacked on 1B + 1C)**:
flutter#194774
(`ft-ext-phase01d-dynamic-discovery-wiring`)

Part of flutter#190755

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
bkonyi added a commit to bkonyi/flutter that referenced this pull request Oct 30, 2026
…fact-service

Adds the `artifact` service to the Linux prototype's `config.yaml` and to the `extension_discovery_test.dart` fixture as required by the manifest services check from flutter#194590, and fixes the `'artifacts'` namespace in the `ExtensionPackageConfig` docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD team-linux Owned by the Linux platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants