diff --git a/engine/src/flutter/tools/engine_tool/lib/src/commands/build_command.dart b/engine/src/flutter/tools/engine_tool/lib/src/commands/build_command.dart index 70fa5b8feb..6094ffd2db 100644 --- a/engine/src/flutter/tools/engine_tool/lib/src/commands/build_command.dart +++ b/engine/src/flutter/tools/engine_tool/lib/src/commands/build_command.dart @@ -72,6 +72,20 @@ et build //flutter/fml:fml_benchmarks # Build a specific target in `//flutter/f allTargets.addAll(targets.map((target) => target.label)); } + // Warn that we've discarded some targets. + // Other warnings should have been emitted above, so if this ends up being + // unneccesarily noisy, we can remove it or limit it to verbose mode. + if (allTargets.length < commandLineTargets.length) { + // Report which targets were not found. + final notFound = commandLineTargets.where( + (target) => !allTargets.contains(Label.parse(target)), + ); + environment.logger.warning( + 'One or more targets specified did not match any build targets:\n\n' + '${notFound.join('\n')}', + ); + } + return runBuild( environment, plan.build, diff --git a/engine/src/flutter/tools/engine_tool/lib/src/gn.dart b/engine/src/flutter/tools/engine_tool/lib/src/gn.dart index c2e6b71af5..9ad883f092 100644 --- a/engine/src/flutter/tools/engine_tool/lib/src/gn.dart +++ b/engine/src/flutter/tools/engine_tool/lib/src/gn.dart @@ -1,3 +1,8 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:collection/collection.dart'; import 'package:meta/meta.dart'; import 'package:path/path.dart' as p; @@ -106,6 +111,9 @@ interface class Gn { JsonObject(properties), ); if (target == null) { + _environment.logger.warning( + 'Unknown target type for $label: type=${properties['type']}', + ); return null; } return target; @@ -180,6 +188,11 @@ sealed class BuildTarget { testOnly: testOnly, json: json, ), + 'group' => GroupBuildTarget( + label: Label.parseGn(label), + testOnly: testOnly, + deps: json.stringList('deps').map(Label.parseGn).toList(), + ), _ => null, }; } @@ -281,3 +294,36 @@ final class ExecutableBuildTarget extends BuildTarget { String toString() => 'ExecutableBuildTarget($label, testOnly=$testOnly, executable=$executable)'; } + +/// A build target that [group]s a meta-target of other build targets. +/// +/// [group]: https://gn.googlesource.com/gn/+/main/docs/reference.md#func_group +final class GroupBuildTarget extends BuildTarget { + /// Construct a group build target. + const GroupBuildTarget({ + required super.label, + required super.testOnly, + required this.deps, + }); + + /// The list of dependencies for this group target. + final List