[tool] Remove some usages of deprecated usage package (#151359)
Partially addresses https://github.com/flutter/flutter/issues/150575 and https://github.com/flutter/flutter/issues/150665 Will require a g3fix.
This commit is contained in:
@@ -29,7 +29,6 @@ import '../convert.dart';
|
||||
import '../flutter_manifest.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import 'android_builder.dart';
|
||||
import 'android_studio.dart';
|
||||
import 'gradle_errors.dart';
|
||||
@@ -149,7 +148,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
required ProcessManager processManager,
|
||||
required FileSystem fileSystem,
|
||||
required Artifacts artifacts,
|
||||
required Usage usage,
|
||||
required Analytics analytics,
|
||||
required GradleUtils gradleUtils,
|
||||
required Platform platform,
|
||||
@@ -158,7 +156,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
_logger = logger,
|
||||
_fileSystem = fileSystem,
|
||||
_artifacts = artifacts,
|
||||
_usage = usage,
|
||||
_analytics = analytics,
|
||||
_gradleUtils = gradleUtils,
|
||||
_androidStudio = androidStudio,
|
||||
@@ -170,7 +167,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
final ProcessUtils _processUtils;
|
||||
final FileSystem _fileSystem;
|
||||
final Artifacts _artifacts;
|
||||
final Usage _usage;
|
||||
final Analytics _analytics;
|
||||
final GradleUtils _gradleUtils;
|
||||
final FileSystemUtils _fileSystemUtils;
|
||||
@@ -304,7 +300,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
@visibleForTesting int? maxRetries,
|
||||
}) async {
|
||||
if (!project.android.isSupportedVersion) {
|
||||
_exitWithUnsupportedProjectMessage(_usage, _logger.terminal, analytics: _analytics);
|
||||
_exitWithUnsupportedProjectMessage(_logger.terminal, _analytics);
|
||||
}
|
||||
|
||||
final List<ProjectMigrator> migrators = <ProjectMigrator>[
|
||||
@@ -322,10 +318,8 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
|
||||
final bool usesAndroidX = isAppUsingAndroidX(project.android.hostAppGradleRoot);
|
||||
if (usesAndroidX) {
|
||||
BuildEvent('app-using-android-x', type: 'gradle', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.flutterBuildInfo(label: 'app-using-android-x', buildType: 'gradle'));
|
||||
} else if (!usesAndroidX) {
|
||||
BuildEvent('app-not-using-android-x', type: 'gradle', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.flutterBuildInfo(label: 'app-not-using-android-x', buildType: 'gradle'));
|
||||
|
||||
_logger.printStatus("${_logger.terminal.warningMark} Your app isn't using AndroidX.", emphasis: true);
|
||||
@@ -485,7 +479,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
}
|
||||
|
||||
final Duration elapsedDuration = sw.elapsed;
|
||||
_usage.sendTiming('build', 'gradle', elapsedDuration);
|
||||
_analytics.send(Event.timing(
|
||||
workflow: 'build',
|
||||
variableName: 'gradle',
|
||||
@@ -494,7 +487,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
|
||||
if (exitCode != 0) {
|
||||
if (detectedGradleError == null) {
|
||||
BuildEvent('gradle-unknown-failure', type: 'gradle', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.flutterBuildInfo(label: 'gradle-unknown-failure', buildType: 'gradle'));
|
||||
|
||||
throwToolExit(
|
||||
@@ -529,7 +521,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
);
|
||||
final String successEventLabel = 'gradle-${detectedGradleError!.eventLabel}-success';
|
||||
|
||||
BuildEvent(successEventLabel, type: 'gradle', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.flutterBuildInfo(label: successEventLabel, buildType: 'gradle'));
|
||||
|
||||
return;
|
||||
@@ -538,7 +529,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
}
|
||||
}
|
||||
final String usageLabel = 'gradle-${detectedGradleError?.eventLabel}-failure';
|
||||
BuildEvent(usageLabel, type: 'gradle', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.flutterBuildInfo(label: usageLabel, buildType: 'gradle'));
|
||||
|
||||
throwToolExit(
|
||||
@@ -548,7 +538,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
}
|
||||
|
||||
if (isBuildingBundle) {
|
||||
final File bundleFile = findBundleFile(project, buildInfo, _logger, _usage, _analytics);
|
||||
final File bundleFile = findBundleFile(project, buildInfo, _logger, _analytics);
|
||||
final String appSize = (buildInfo.mode == BuildMode.debug)
|
||||
? '' // Don't display the size when building a debug variant.
|
||||
: ' (${getSizeAsPlatformMB(bundleFile.lengthSync())})';
|
||||
@@ -566,7 +556,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
}
|
||||
// Gradle produced APKs.
|
||||
final Iterable<String> apkFilesPaths = project.isModule
|
||||
? findApkFilesModule(project, androidBuildInfo, _logger, _usage, _analytics)
|
||||
? findApkFilesModule(project, androidBuildInfo, _logger, _analytics)
|
||||
: listApkPaths(androidBuildInfo);
|
||||
final Directory apkDirectory = getApkDirectory(project);
|
||||
|
||||
@@ -577,7 +567,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
project: project,
|
||||
fileExtension: '.apk',
|
||||
logger: _logger,
|
||||
usage: _usage,
|
||||
analytics: _analytics,
|
||||
);
|
||||
}
|
||||
@@ -608,7 +597,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
final SizeAnalyzer sizeAnalyzer = SizeAnalyzer(
|
||||
fileSystem: _fileSystem,
|
||||
logger: _logger,
|
||||
flutterUsage: _usage,
|
||||
analytics: _analytics,
|
||||
);
|
||||
final String archName = androidBuildInfo.targetArchs.single.archName;
|
||||
@@ -759,7 +747,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
status.stop();
|
||||
}
|
||||
final Duration elapsedDuration = sw.elapsed;
|
||||
_usage.sendTiming('build', 'gradle-aar', elapsedDuration);
|
||||
_analytics.send(Event.timing(
|
||||
workflow: 'build',
|
||||
variableName: 'gradle-aar',
|
||||
@@ -801,7 +788,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
);
|
||||
|
||||
final Duration elapsedDuration = sw.elapsed;
|
||||
_usage.sendTiming('print', 'android build variants', elapsedDuration);
|
||||
_analytics.send(Event.timing(
|
||||
workflow: 'print',
|
||||
variableName: 'android build variants',
|
||||
@@ -840,7 +826,6 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||
project: project,
|
||||
);
|
||||
final Duration elapsedDuration = sw.elapsed;
|
||||
_usage.sendTiming('outputs', 'app link settings', elapsedDuration);
|
||||
_analytics.send(Event.timing(
|
||||
workflow: 'outputs',
|
||||
variableName: 'app link settings',
|
||||
@@ -927,8 +912,7 @@ String _calculateSha(File file) {
|
||||
return _hex(sha1.convert(bytes).bytes);
|
||||
}
|
||||
|
||||
void _exitWithUnsupportedProjectMessage(Usage usage, Terminal terminal, {required Analytics analytics}) {
|
||||
BuildEvent('unsupported-project', type: 'gradle', eventError: 'gradle-plugin', flutterUsage: usage).send();
|
||||
void _exitWithUnsupportedProjectMessage(Terminal terminal, Analytics analytics) {
|
||||
analytics.send(Event.flutterBuildInfo(
|
||||
label: 'unsupported-project',
|
||||
buildType: 'gradle',
|
||||
@@ -959,7 +943,6 @@ Iterable<String> findApkFilesModule(
|
||||
FlutterProject project,
|
||||
AndroidBuildInfo androidBuildInfo,
|
||||
Logger logger,
|
||||
Usage usage,
|
||||
Analytics analytics,
|
||||
) {
|
||||
final Iterable<String> apkFileNames = _apkFilesFor(androidBuildInfo);
|
||||
@@ -995,7 +978,6 @@ Iterable<String> findApkFilesModule(
|
||||
project: project,
|
||||
fileExtension: '.apk',
|
||||
logger: logger,
|
||||
usage: usage,
|
||||
analytics: analytics,
|
||||
);
|
||||
}
|
||||
@@ -1035,7 +1017,12 @@ Iterable<String> listApkPaths(
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
File findBundleFile(FlutterProject project, BuildInfo buildInfo, Logger logger, Usage usage, Analytics analytics) {
|
||||
File findBundleFile(
|
||||
FlutterProject project,
|
||||
BuildInfo buildInfo,
|
||||
Logger logger,
|
||||
Analytics analytics,
|
||||
) {
|
||||
final List<File> fileCandidates = <File>[
|
||||
getBundleDirectory(project)
|
||||
.childDirectory(camelCase(buildInfo.modeName))
|
||||
@@ -1091,7 +1078,6 @@ File findBundleFile(FlutterProject project, BuildInfo buildInfo, Logger logger,
|
||||
project: project,
|
||||
fileExtension: '.aab',
|
||||
logger: logger,
|
||||
usage: usage,
|
||||
analytics: analytics,
|
||||
);
|
||||
}
|
||||
@@ -1101,7 +1087,6 @@ Never _exitWithExpectedFileNotFound({
|
||||
required FlutterProject project,
|
||||
required String fileExtension,
|
||||
required Logger logger,
|
||||
required Usage usage,
|
||||
required Analytics analytics,
|
||||
}) {
|
||||
|
||||
@@ -1110,11 +1095,6 @@ Never _exitWithExpectedFileNotFound({
|
||||
final String gradleBuildSettings = 'androidGradlePluginVersion: $androidGradlePluginVersion, '
|
||||
'fileExtension: $fileExtension';
|
||||
|
||||
BuildEvent('gradle-expected-file-not-found',
|
||||
type: 'gradle',
|
||||
settings: gradleBuildSettings,
|
||||
flutterUsage: usage,
|
||||
).send();
|
||||
analytics.send(Event.flutterBuildInfo(
|
||||
label: 'gradle-expected-file-not-found',
|
||||
buildType: 'gradle',
|
||||
|
||||
@@ -10,7 +10,6 @@ import '../base/process.dart';
|
||||
import '../base/terminal.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import 'gradle_utils.dart';
|
||||
|
||||
typedef GradleErrorTest = bool Function(String);
|
||||
|
||||
@@ -18,7 +18,6 @@ import '../build_info.dart';
|
||||
import '../cache.dart';
|
||||
import '../globals.dart' as globals;
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import 'android_sdk.dart';
|
||||
|
||||
// These are the versions used in the project templates.
|
||||
@@ -787,11 +786,6 @@ void writeLocalProperties(File properties) {
|
||||
}
|
||||
|
||||
void exitWithNoSdkMessage() {
|
||||
BuildEvent('unsupported-project',
|
||||
type: 'gradle',
|
||||
eventError: 'android-sdk-not-found',
|
||||
flutterUsage: globals.flutterUsage)
|
||||
.send();
|
||||
globals.analytics.send(Event.flutterBuildInfo(
|
||||
label: 'unsupported-project',
|
||||
buildType: 'gradle',
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:unified_analytics/unified_analytics.dart';
|
||||
import 'package:vm_snapshot_analysis/treemap.dart';
|
||||
|
||||
import '../convert.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import 'common.dart';
|
||||
import 'file_system.dart';
|
||||
import 'logger.dart';
|
||||
@@ -20,19 +19,16 @@ class SizeAnalyzer {
|
||||
SizeAnalyzer({
|
||||
required FileSystem fileSystem,
|
||||
required Logger logger,
|
||||
required Usage flutterUsage,
|
||||
required Analytics analytics,
|
||||
Pattern appFilenamePattern = 'libapp.so',
|
||||
}) : _flutterUsage = flutterUsage,
|
||||
_analytics = analytics,
|
||||
_fileSystem = fileSystem,
|
||||
_logger = logger,
|
||||
_appFilenamePattern = appFilenamePattern;
|
||||
}) : _analytics = analytics,
|
||||
_fileSystem = fileSystem,
|
||||
_logger = logger,
|
||||
_appFilenamePattern = appFilenamePattern;
|
||||
|
||||
final FileSystem _fileSystem;
|
||||
final Logger _logger;
|
||||
final Pattern _appFilenamePattern;
|
||||
final Usage _flutterUsage;
|
||||
final Analytics _analytics;
|
||||
String? _appFilename;
|
||||
|
||||
@@ -91,7 +87,6 @@ class SizeAnalyzer {
|
||||
);
|
||||
|
||||
assert(_appFilename != null);
|
||||
CodeSizeEvent(type, flutterUsage: _flutterUsage).send();
|
||||
_analytics.send(Event.codeSizeAnalysis(platform: type));
|
||||
return apkAnalysisJson;
|
||||
}
|
||||
@@ -145,7 +140,6 @@ class SizeAnalyzer {
|
||||
aotSnapshotJson: processedAotSnapshotJson,
|
||||
precompilerTrace: json.decode(precompilerTrace.readAsStringSync()) as Map<String, Object?>? ?? <String, Object?>{},
|
||||
);
|
||||
CodeSizeEvent(kind, flutterUsage: _flutterUsage).send();
|
||||
_analytics.send(Event.codeSizeAnalysis(platform: kind));
|
||||
return apkAnalysisJson;
|
||||
}
|
||||
|
||||
@@ -713,7 +713,6 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
||||
result,
|
||||
analytics: globals.analytics,
|
||||
fileSystem: globals.fs,
|
||||
flutterUsage: globals.flutterUsage,
|
||||
logger: globals.logger,
|
||||
platform: SupportedPlatform.ios,
|
||||
project: app.project.parent,
|
||||
@@ -726,7 +725,6 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
||||
final SizeAnalyzer sizeAnalyzer = SizeAnalyzer(
|
||||
fileSystem: globals.fs,
|
||||
logger: globals.logger,
|
||||
flutterUsage: globals.flutterUsage,
|
||||
analytics: analytics,
|
||||
appFilenamePattern: 'App'
|
||||
);
|
||||
|
||||
@@ -91,7 +91,6 @@ class BuildLinuxCommand extends BuildSubCommand {
|
||||
sizeAnalyzer: SizeAnalyzer(
|
||||
fileSystem: globals.fs,
|
||||
logger: logger,
|
||||
flutterUsage: globals.flutterUsage,
|
||||
analytics: analytics,
|
||||
),
|
||||
needCrossBuild: needCrossBuild,
|
||||
|
||||
@@ -67,7 +67,6 @@ class BuildMacosCommand extends BuildSubCommand {
|
||||
fileSystem: globals.fs,
|
||||
logger: globals.logger,
|
||||
appFilenamePattern: 'App',
|
||||
flutterUsage: globals.flutterUsage,
|
||||
analytics: analytics,
|
||||
),
|
||||
usingCISystem: usingCISystem,
|
||||
|
||||
@@ -71,7 +71,6 @@ class BuildWindowsCommand extends BuildSubCommand {
|
||||
fileSystem: globals.fs,
|
||||
logger: globals.logger,
|
||||
appFilenamePattern: 'app.so',
|
||||
flutterUsage: globals.flutterUsage,
|
||||
analytics: analytics,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -102,7 +102,6 @@ Future<T> runInContext<T>(
|
||||
processManager: globals.processManager,
|
||||
fileSystem: globals.fs,
|
||||
artifacts: globals.artifacts!,
|
||||
usage: globals.flutterUsage,
|
||||
analytics: globals.analytics,
|
||||
gradleUtils: globals.gradleUtils!,
|
||||
platform: globals.platform,
|
||||
|
||||
@@ -500,7 +500,6 @@ class IOSDevice extends Device {
|
||||
buildResult,
|
||||
analytics: globals.analytics,
|
||||
fileSystem: globals.fs,
|
||||
flutterUsage: globals.flutterUsage,
|
||||
logger: globals.logger,
|
||||
platform: SupportedPlatform.ios,
|
||||
project: package.project.parent,
|
||||
|
||||
@@ -30,7 +30,6 @@ import '../migrations/xcode_script_build_phase_migration.dart';
|
||||
import '../migrations/xcode_thin_binary_build_phase_input_paths_migration.dart';
|
||||
import '../plugins.dart';
|
||||
import '../project.dart';
|
||||
import '../reporting/reporting.dart';
|
||||
import 'application_package.dart';
|
||||
import 'code_signing.dart';
|
||||
import 'migrations/host_app_info_plist_migration.dart';
|
||||
@@ -155,7 +154,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
final FlutterProject project = FlutterProject.current();
|
||||
|
||||
final List<ProjectMigrator> migrators = <ProjectMigrator>[
|
||||
RemoveFrameworkLinkAndEmbeddingMigration(app.project, globals.logger, globals.flutterUsage, globals.analytics),
|
||||
RemoveFrameworkLinkAndEmbeddingMigration(app.project, globals.logger, globals.analytics),
|
||||
XcodeBuildSystemMigration(app.project, globals.logger),
|
||||
ProjectBaseConfigurationMigration(app.project, globals.logger),
|
||||
ProjectBuildLocationMigration(app.project, globals.logger),
|
||||
@@ -452,7 +451,6 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
+ getElapsedAsSeconds(sw.elapsed).padLeft(5),
|
||||
);
|
||||
final Duration elapsedDuration = sw.elapsed;
|
||||
globals.flutterUsage.sendTiming(xcodeBuildActionToString(buildAction), 'xcode-ios', elapsedDuration);
|
||||
globals.analytics.send(Event.timing(
|
||||
workflow: xcodeBuildActionToString(buildAction),
|
||||
variableName: 'xcode-ios',
|
||||
@@ -625,7 +623,6 @@ Future<void> diagnoseXcodeBuildFailure(
|
||||
required Analytics analytics,
|
||||
required Logger logger,
|
||||
required FileSystem fileSystem,
|
||||
required Usage flutterUsage,
|
||||
required SupportedPlatform platform,
|
||||
required FlutterProject project,
|
||||
}) async {
|
||||
@@ -639,13 +636,6 @@ Future<void> diagnoseXcodeBuildFailure(
|
||||
final String command = xcodeBuildExecution.buildCommands.toString();
|
||||
final String settings = xcodeBuildExecution.buildSettings.toString();
|
||||
|
||||
BuildEvent(
|
||||
label,
|
||||
type: buildType,
|
||||
command: command,
|
||||
settings: settings,
|
||||
flutterUsage: flutterUsage,
|
||||
).send();
|
||||
analytics.send(Event.flutterBuildInfo(
|
||||
label: label,
|
||||
buildType: buildType,
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:unified_analytics/unified_analytics.dart';
|
||||
import '../../base/common.dart';
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/project_migrator.dart';
|
||||
import '../../reporting/reporting.dart';
|
||||
import '../../xcode_project.dart';
|
||||
|
||||
// Xcode 11.4 requires linked and embedded frameworks to contain all targeted architectures before build phases are run.
|
||||
@@ -17,14 +16,11 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends ProjectMigrator {
|
||||
RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
IosProject project,
|
||||
super.logger,
|
||||
Usage usage,
|
||||
Analytics analytics,
|
||||
) : _xcodeProjectInfoFile = project.xcodeProjectInfoFile,
|
||||
_usage = usage,
|
||||
_analytics = analytics;
|
||||
|
||||
final File _xcodeProjectInfoFile;
|
||||
final Usage _usage;
|
||||
final Analytics _analytics;
|
||||
|
||||
@override
|
||||
@@ -95,7 +91,6 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends ProjectMigrator {
|
||||
|
||||
if (line.contains('/* App.framework ') || line.contains('/* Flutter.framework ')) {
|
||||
// Print scary message.
|
||||
UsageEvent('ios-migration', 'remove-frameworks', label: 'failure', flutterUsage: _usage).send();
|
||||
_analytics.send(Event.appleUsageEvent(
|
||||
workflow: 'ios-migration',
|
||||
parameter: 'remove-frameworks',
|
||||
|
||||
@@ -569,7 +569,6 @@ class IOSSimulator extends Device {
|
||||
buildResult,
|
||||
analytics: globals.analytics,
|
||||
fileSystem: globals.fs,
|
||||
flutterUsage: globals.flutterUsage,
|
||||
logger: globals.logger,
|
||||
platform: SupportedPlatform.ios,
|
||||
project: app.project.parent,
|
||||
|
||||
Reference in New Issue
Block a user