Repository navigation
[flutter_tools] Define ExtensionAssembleTarget and AssembleTarget in extension protocol - #193984
auto-submit[bot] merged 18 commits into
Conversation
… 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.
There was a problem hiding this comment.
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.
…and use pathSegments in prototype build
…d and align build APIs
|
from triage: is this ready for review? :) |
Keep host Source and Target untouched in flutter_tools and convert extension Sources inside ExtensionAssembleTarget, reverting changes to built-in targets and Source.fromProject.
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.
…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
Defines
ExtensionAssembleTargetandAssembleTargetin the extension protocol, separating hermeticflutter assembleDAG targets from top-levelflutter buildsubcommand targets.Stack
Part of #190755
Part of #190752
Pre-launch Checklist
///).