From 1902fb27a6187a42aaf392a659801ff286c97625 Mon Sep 17 00:00:00 2001
From: "auto-submit[bot]" <98614782+auto-submit[bot]@users.noreply.github.com>
Date: Fri, 31 Jan 2025 01:28:19 +0000
Subject: [PATCH] Reverts "Delete `FlutterCommand.usageValues` (#162468)"
(#162494)
Reverts: flutter/flutter#162468
Initiated by: jtmcdole
Reason for reverting: tree broken (see Mac_arm64 module_test_ios)
Original PR Author: andrewkolos
Reviewed By: {bkonyi}
This change reverts the following previous change:
toward https://github.com/flutter/flutter/issues/150575. More simple
deletes.
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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[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
Co-authored-by: auto-submit[bot]
---
.../lib/src/commands/assemble.dart | 7 ++
.../lib/src/commands/build_aar.dart | 18 +++
.../lib/src/commands/build_apk.dart | 10 ++
.../lib/src/commands/build_appbundle.dart | 22 ++++
.../lib/src/commands/build_bundle.dart | 13 ++
.../lib/src/commands/create.dart | 10 ++
.../lib/src/commands/packages.dart | 31 +++++
.../flutter_tools/lib/src/commands/run.dart | 19 +++
.../lib/src/runner/flutter_command.dart | 18 ++-
.../hermetic/create_usage_test.dart | 55 +++------
.../commands.shard/hermetic/pub_test.dart | 38 +++---
.../commands.shard/hermetic/run_test.dart | 111 ++++++++----------
.../permeable/build_aar_test.dart | 59 +++-------
.../permeable/build_bundle_test.dart | 8 +-
.../permeable/packages_test.dart | 5 +
15 files changed, 252 insertions(+), 172 deletions(-)
diff --git a/packages/flutter_tools/lib/src/commands/assemble.dart b/packages/flutter_tools/lib/src/commands/assemble.dart
index 78898de311..07cfbc4cd3 100644
--- a/packages/flutter_tools/lib/src/commands/assemble.dart
+++ b/packages/flutter_tools/lib/src/commands/assemble.dart
@@ -24,6 +24,7 @@ import '../cache.dart';
import '../convert.dart';
import '../globals.dart' as globals;
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart';
/// All currently implemented targets.
@@ -162,6 +163,12 @@ class AssembleCommand extends FlutterCommand {
@override
String get category => FlutterCommandCategory.project;
+ @override
+ Future get usageValues async => CustomDimensions(
+ commandBuildBundleTargetPlatform: _environment.defines[kTargetPlatform],
+ commandBuildBundleIsModule: _flutterProject.isModule,
+ );
+
@override
Future unifiedAnalyticsUsageValues(String commandPath) async => Event.commandUsageValues(
workflow: commandPath,
diff --git a/packages/flutter_tools/lib/src/commands/build_aar.dart b/packages/flutter_tools/lib/src/commands/build_aar.dart
index aabf0f41fc..05e8a85e91 100644
--- a/packages/flutter_tools/lib/src/commands/build_aar.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aar.dart
@@ -14,6 +14,7 @@ import '../build_info.dart';
import '../cache.dart';
import '../globals.dart' as globals;
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart';
@@ -75,6 +76,23 @@ class BuildAarCommand extends BuildSubCommand {
@override
late final FlutterProject project = _getProject();
+ @override
+ Future get usageValues async {
+ final String projectType;
+ if (project.manifest.isModule) {
+ projectType = 'module';
+ } else if (project.manifest.isPlugin) {
+ projectType = 'plugin';
+ } else {
+ projectType = 'app';
+ }
+
+ return CustomDimensions(
+ commandBuildAarProjectType: projectType,
+ commandBuildAarTargetPlatform: stringsArg('target-platform').join(','),
+ );
+ }
+
@override
Future unifiedAnalyticsUsageValues(String commandPath) async {
final String projectType;
diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart
index adf2e1c0c8..a8a48b410f 100644
--- a/packages/flutter_tools/lib/src/commands/build_apk.dart
+++ b/packages/flutter_tools/lib/src/commands/build_apk.dart
@@ -11,6 +11,7 @@ import '../build_info.dart';
import '../cache.dart';
import '../globals.dart' as globals;
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart';
@@ -114,6 +115,15 @@ class BuildApkCommand extends BuildSubCommand {
' * https://developer.android.com/guide/app-bundle\n'
' * https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split';
+ @override
+ Future get usageValues async {
+ return CustomDimensions(
+ commandBuildApkTargetPlatform: _targetArchs.join(','),
+ commandBuildApkBuildMode: _buildMode.cliName,
+ commandBuildApkSplitPerAbi: boolArg('split-per-abi'),
+ );
+ }
+
@override
Future unifiedAnalyticsUsageValues(String commandPath) async {
return Event.commandUsageValues(
diff --git a/packages/flutter_tools/lib/src/commands/build_appbundle.dart b/packages/flutter_tools/lib/src/commands/build_appbundle.dart
index ca5f110dbe..6efb317e73 100644
--- a/packages/flutter_tools/lib/src/commands/build_appbundle.dart
+++ b/packages/flutter_tools/lib/src/commands/build_appbundle.dart
@@ -14,6 +14,7 @@ import '../build_info.dart';
import '../cache.dart';
import '../globals.dart' as globals;
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart';
@@ -91,6 +92,27 @@ class BuildAppBundleCommand extends BuildSubCommand {
"debugging and a quick development cycle. 'release' builds don't support debugging and are "
'suitable for deploying to app stores. \n app bundle improves your app size';
+ @override
+ Future get usageValues async {
+ String buildMode;
+
+ if (boolArg('release')) {
+ buildMode = 'release';
+ } else if (boolArg('debug')) {
+ buildMode = 'debug';
+ } else if (boolArg('profile')) {
+ buildMode = 'profile';
+ } else {
+ // The build defaults to release.
+ buildMode = 'release';
+ }
+
+ return CustomDimensions(
+ commandBuildAppBundleTargetPlatform: stringsArg('target-platform').join(','),
+ commandBuildAppBundleBuildMode: buildMode,
+ );
+ }
+
@override
Future unifiedAnalyticsUsageValues(String commandPath) async {
final String buildMode;
diff --git a/packages/flutter_tools/lib/src/commands/build_bundle.dart b/packages/flutter_tools/lib/src/commands/build_bundle.dart
index 7ccf9a645c..423cf2c6b6 100644
--- a/packages/flutter_tools/lib/src/commands/build_bundle.dart
+++ b/packages/flutter_tools/lib/src/commands/build_bundle.dart
@@ -11,6 +11,7 @@ import '../bundle_builder.dart';
import '../features.dart';
import '../globals.dart' as globals;
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart';
import 'build.dart';
@@ -82,6 +83,18 @@ class BuildBundleCommand extends BuildSubCommand {
'application code and resources; they are used by some Flutter Android and'
' iOS runtimes.';
+ @override
+ Future get usageValues async {
+ final String projectDir = globals.fs.file(targetFile).parent.parent.path;
+ final FlutterProject flutterProject = FlutterProject.fromDirectory(
+ globals.fs.directory(projectDir),
+ );
+ return CustomDimensions(
+ commandBuildBundleTargetPlatform: stringArg('target-platform'),
+ commandBuildBundleIsModule: flutterProject.isModule,
+ );
+ }
+
@override
Future unifiedAnalyticsUsageValues(String commandPath) async {
final String projectDir = globals.fs.file(targetFile).parent.parent.path;
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 5f085e3828..fd90ef3e5b 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -24,6 +24,7 @@ import '../ios/code_signing.dart';
import '../macos/swift_package_manager.dart';
import '../macos/swift_packages.dart';
import '../project.dart';
+import '../reporting/reporting.dart';
import '../runner/flutter_command.dart';
import 'create_base.dart';
@@ -154,6 +155,15 @@ class CreateCommand extends FlutterCommand with CreateBase {
@override
String get invocation => '${runner?.executableName} $name