Skip to content

[flutter_tools] Define ExtensionAssembleTarget and AssembleTarget in extension protocol - #193984

Merged
auto-submit[bot] merged 18 commits into
flutter:masterfrom
bkonyi:ft-ext-step07b-build-remaining-slice
Oct 22, 2026
Merged

auto-submit[bot] merged 18 commits into
flutter:masterfrom
bkonyi:ft-ext-step07b-build-remaining-slice

Conversation

@bkonyi

@bkonyi bkonyi commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Defines ExtensionAssembleTarget and AssembleTarget in the extension protocol, separating hermetic flutter assemble DAG targets from top-level flutter build subcommand targets.

Stack

  1. [flutter_tools] Define ExtensionAssembleTarget and AssembleTarget in extension protocol #193984 (this PR)
  2. [flutter_tools] Add flutter assemble support for tool extension assemble targets #194563 (diff)

Part of #190755
Part of #190752

Pre-launch Checklist

… targets

Extends `BuildService` and `package:flutter_tools_core` to support `flutter assemble` targets contributed by tool extensions (`ExtensionAssembleTarget`, `ExtensionTarget`, `ExtensionBuildContext`, `Source`, `Artifact`, `HostArtifact`, and `Target`), allowing extension targets to participate in the build graph alongside built-in targets.
@bkonyi bkonyi added the CICD Run CI/CD label Oct 8, 2026
@bkonyi
bkonyi requested review from a team as code owners October 8, 2026 02:50
@bkonyi
bkonyi requested review from mboetger and removed request for a team October 8, 2026 02:50
@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-android Owned by Android platform team team-ios Owned by iOS platform team team-macos Owned by the macOS platform team team-linux Owned by the Linux platform team labels Oct 8, 2026

@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 integrates custom build targets defined by tool extensions into the Flutter build system, updating AssembleCommand and BuildCommand to discover and execute these targets, and expanding the prototype Linux extension with several concrete build targets. The review feedback highlights potential crashes from unhandled ArgumentErrors when parsing invalid platform strings with TargetPlatform.fromName in ExtensionAssembleTarget, ArtifactResolver, and ExtensionBuildSubCommand, recommending wrapping these in try-catch blocks to throw user-friendly ToolExits. Additionally, a more robust path extraction method is suggested in the Linux prototype's directory copying logic to avoid potential truncation bugs when trailing separators are present.

@bkonyi
bkonyi removed request for a team and mboetger October 8, 2026 16:50
@LouiseHsu

Copy link
Copy Markdown
Contributor

from triage: is this ready for review? :)

@bkonyi
bkonyi marked this pull request as draft October 8, 2026 22:57
Keep host Source and Target untouched in flutter_tools and convert extension Sources inside ExtensionAssembleTarget, reverting changes to built-in targets and Source.fromProject.
@github-actions github-actions Bot removed team-android Owned by Android platform team team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Oct 8, 2026
@bkonyi

bkonyi commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

from triage: is this ready for review? :)

Not yet! I'll mark it as Draft :)

…le integration

- Prefix extension source and artifact types (`ExtensionSource`, `ExtensionArtifact`, `ExtensionHostArtifact`) and make `ExtensionSource` a sealed class.
- Keep `BuildMode` in `flutter_tools_core/lib/src/build.dart` and replace `SimpleTarget` with `BuiltInTargets` string constants.
- Revert host `build_system.dart` changes and rely on `-o` for `flutter assemble` output directories.
- Lazily query extension build targets in `AssembleCommand` only when a requested target is not built in, and remove duplicate Linux target entries.
- Trim AOT prototype targets and fix error handling and output draining in `flutter_tools_extension_linux_prototype`.
…rgetArtifacts

- Ignore `Exception` from `TargetPlatform.fromName(target.targetPlatform)` in `resolveExtensionTargetArtifacts` so custom embedder target platforms work without throwing `ToolExit`.
- Use `continue;` instead of `break;` on `ExtensionPatternSource` in `resolveExtensionTargetArtifacts`.
- Update unit and hermetic tests in `extension_test.dart` and `tool_extensions_build_test.dart`.
…ension PR reviews

- Prefix failure messages in `ExtensionAssembleTarget.build` with the target name and handle empty `errorMessage`.
- Remove `export 'src/build.dart';` from `flutter_tools_extension_linux_prototype.dart` so only `linuxExtensionEntryPoint` is exported.
- Expand Dartdoc on `targetPlatform`, `outputDir`, and `ExtensionSource.pattern`, and include all fields in `ExtensionBuildTarget.toString()`.
…ild-remaining-slice

# Conflicts:
#	packages/flutter_tools/packages/flutter_tools_core/lib/src/build.dart
#	packages/flutter_tools/packages/flutter_tools_extension/lib/src/build.dart
#	packages/flutter_tools/packages/flutter_tools_extension_linux_prototype/test/linux_build_test.dart
…nd sources

Splits `ExtensionAssembleContext` out of `ExtensionBuildContext` so top-level `BuildTarget`s do not receive `buildDir`, adds a constructor assertion on `ExtensionPatternSource`, wraps invalid `BuildMode` names in `ExtensionSource.fromJson` as `FormatException`, tightens the `outputDir` placeholder regex, and adds follow-up TODOs.

@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.

Looks good!

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 22, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 22, 2026
Merged via the queue into flutter:master with commit 7e2a464 Oct 22, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 22, 2026
This was referenced Oct 22, 2026
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…extension protocol (flutter#193984)

Defines `ExtensionAssembleTarget` and `AssembleTarget` in the extension
protocol, separating hermetic `flutter assemble` DAG targets from
top-level `flutter build` subcommand targets.

### Stack
1. **flutter#193984 (this PR)**
2. flutter#194563
([diff](bkonyi/flutter@ft-ext-step07b-build-remaining-slice...ft-ext-step07c-assemble-host-integration))

Part of flutter#190755
Part of flutter#190752

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
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