mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[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:
parent
5ebc993dff
commit
5103d75743
@ -912,9 +912,8 @@ Future<void> verifyNoTestImports(String workingDirectory) async {
|
||||
}
|
||||
// Fail if any errors
|
||||
if (errors.isNotEmpty) {
|
||||
final String s = errors.length == 1 ? '' : 's';
|
||||
foundError(<String>[
|
||||
'${bold}The following file$s import a test directly. Test utilities should be in their own file.$reset',
|
||||
'${bold}The following file(s) import a test directly. Test utilities should be in their own file.$reset',
|
||||
...errors,
|
||||
]);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -22,7 +22,6 @@ import 'package:flutter_tools/src/ios/mac.dart';
|
||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -71,7 +70,6 @@ final Platform notMacosPlatform = FakePlatform(
|
||||
|
||||
void main() {
|
||||
late MemoryFileSystem fileSystem;
|
||||
late TestUsage usage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
late BufferLogger logger;
|
||||
late FakeProcessManager processManager;
|
||||
@ -85,7 +83,6 @@ void main() {
|
||||
setUp(() {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
artifacts = Artifacts.test(fileSystem: fileSystem);
|
||||
usage = TestUsage();
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: fileSystem,
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
@ -570,9 +567,6 @@ void main() {
|
||||
|
||||
expect(logger.statusText, contains('A summary of your iOS bundle analysis can be found at'));
|
||||
expect(logger.statusText, contains('dart devtools --appSizeBase='));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'ios'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.codeSizeAnalysis(platform: 'ios')
|
||||
));
|
||||
@ -582,7 +576,6 @@ void main() {
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => macosPlatform,
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: macosPlatform),
|
||||
Usage: () => usage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
});
|
||||
@ -645,7 +638,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
platform: macosPlatform,
|
||||
),
|
||||
Usage: () => usage,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
@ -700,7 +692,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
platform: macosPlatform,
|
||||
),
|
||||
Usage: () => usage,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
FlutterProjectFactory: () => FlutterProjectFactory(
|
||||
fileSystem: fileSystem,
|
||||
|
@ -18,7 +18,6 @@ import 'package:flutter_tools/src/commands/build.dart';
|
||||
import 'package:flutter_tools/src/commands/build_ios.dart';
|
||||
import 'package:flutter_tools/src/ios/plist_parser.dart';
|
||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -79,7 +78,6 @@ class FakePlistUtils extends Fake implements PlistParser {
|
||||
|
||||
void main() {
|
||||
late MemoryFileSystem fileSystem;
|
||||
late TestUsage usage;
|
||||
late FakeProcessManager fakeProcessManager;
|
||||
late ProcessUtils processUtils;
|
||||
late FakePlistUtils plistUtils;
|
||||
@ -94,7 +92,6 @@ void main() {
|
||||
setUp(() {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
artifacts = Artifacts.test(fileSystem: fileSystem);
|
||||
usage = TestUsage();
|
||||
fakeProcessManager = FakeProcessManager.empty();
|
||||
logger = BufferLogger.test();
|
||||
processUtils = ProcessUtils(
|
||||
@ -1041,9 +1038,6 @@ void main() {
|
||||
|
||||
expect(logger.statusText, contains('A summary of your iOS bundle analysis can be found at'));
|
||||
expect(logger.statusText, contains('dart devtools --appSizeBase='));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'ios'),
|
||||
));
|
||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.codeSizeAnalysis(platform: 'ios')
|
||||
@ -1054,7 +1048,6 @@ void main() {
|
||||
ProcessManager: () => fakeProcessManager,
|
||||
Platform: () => macosPlatform,
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: macosPlatform),
|
||||
Usage: () => usage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
});
|
||||
|
@ -19,7 +19,6 @@ import 'package:flutter_tools/src/commands/build.dart';
|
||||
import 'package:flutter_tools/src/commands/build_linux.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -53,7 +52,6 @@ void main() {
|
||||
late FakeProcessManager processManager;
|
||||
late ProcessUtils processUtils;
|
||||
late Logger logger;
|
||||
late TestUsage usage;
|
||||
late Artifacts artifacts;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
@ -61,7 +59,6 @@ void main() {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
artifacts = Artifacts.test(fileSystem: fileSystem);
|
||||
Cache.flutterRoot = _kTestFlutterRoot;
|
||||
usage = TestUsage();
|
||||
logger = BufferLogger.test();
|
||||
processManager = FakeProcessManager.empty();
|
||||
processUtils = ProcessUtils(
|
||||
@ -751,9 +748,6 @@ set(BINARY_NAME "fizz_bar")
|
||||
|
||||
expect(testLogger.statusText, contains('A summary of your Linux bundle analysis can be found at'));
|
||||
expect(testLogger.statusText, contains('dart devtools --appSizeBase='));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'linux'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.codeSizeAnalysis(platform: 'linux')
|
||||
));
|
||||
@ -762,7 +756,6 @@ set(BINARY_NAME "fizz_bar")
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => linuxPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||
Usage: () => usage,
|
||||
OperatingSystemUtils: () => FakeOperatingSystemUtils(),
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
@ -808,9 +801,6 @@ set(BINARY_NAME "fizz_bar")
|
||||
|
||||
// check if libapp.so of "build/linux/arm64/release" directory can be referenced.
|
||||
expect(testLogger.statusText, contains('libapp.so (Dart AOT)'));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'linux'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.codeSizeAnalysis(platform: 'linux')
|
||||
));
|
||||
@ -819,7 +809,6 @@ set(BINARY_NAME "fizz_bar")
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => linuxPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||
Usage: () => usage,
|
||||
OperatingSystemUtils: () => CustomFakeOperatingSystemUtils(hostPlatform: HostPlatform.linux_arm64),
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
@ -20,7 +20,6 @@ import 'package:flutter_tools/src/commands/build_macos.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/ios/xcodeproj.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
@ -66,7 +65,6 @@ final Platform notMacosPlatform = FakePlatform(
|
||||
|
||||
void main() {
|
||||
late MemoryFileSystem fileSystem;
|
||||
late TestUsage usage;
|
||||
late FakeProcessManager fakeProcessManager;
|
||||
late ProcessUtils processUtils;
|
||||
late BufferLogger logger;
|
||||
@ -82,7 +80,6 @@ void main() {
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
artifacts = Artifacts.test(fileSystem: fileSystem);
|
||||
logger = BufferLogger.test();
|
||||
usage = TestUsage();
|
||||
fakeProcessManager = FakeProcessManager.empty();
|
||||
processUtils = ProcessUtils(
|
||||
logger: logger,
|
||||
@ -657,7 +654,6 @@ STDERR STUFF
|
||||
Platform: () => macosPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: macosPlatform),
|
||||
Usage: () => usage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
testUsingContext('Performs code size analysis and sends analytics from arm64 host', () async {
|
||||
@ -682,9 +678,6 @@ STDERR STUFF
|
||||
|
||||
expect(testLogger.statusText, contains('A summary of your macOS bundle analysis can be found at'));
|
||||
expect(testLogger.statusText, contains('dart devtools --appSizeBase='));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'macos'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(Event.codeSizeAnalysis(platform: 'macos')));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
@ -711,7 +704,6 @@ STDERR STUFF
|
||||
Platform: () => macosPlatform,
|
||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: macosPlatform),
|
||||
Usage: () => usage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/build_windows.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/windows/build_windows.dart';
|
||||
import 'package:flutter_tools/src/windows/visual_studio.dart';
|
||||
import 'package:test/fake.dart';
|
||||
@ -47,7 +46,6 @@ final Platform notWindowsPlatform = FakePlatform(
|
||||
void main() {
|
||||
late MemoryFileSystem fileSystem;
|
||||
late ProcessManager processManager;
|
||||
late TestUsage usage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
setUpAll(() {
|
||||
@ -58,7 +56,6 @@ void main() {
|
||||
setUp(() {
|
||||
fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
|
||||
Cache.flutterRoot = flutterRoot;
|
||||
usage = TestUsage();
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: fileSystem,
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
@ -997,9 +994,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
|
||||
expect(testLogger.statusText, contains('A summary of your Windows bundle analysis can be found at'));
|
||||
expect(testLogger.statusText, contains('dart devtools --appSizeBase='));
|
||||
expect(usage.events, contains(
|
||||
const TestUsageEvent('code-size-analysis', 'windows'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.codeSizeAnalysis(platform: 'windows')
|
||||
));
|
||||
@ -1009,7 +1003,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
ProcessManager: () => processManager,
|
||||
Platform: () => windowsPlatform,
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
|
||||
Usage: () => usage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
||||
|
@ -15,8 +15,8 @@ import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/build_apk.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/testing.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
import '../../src/android_common.dart';
|
||||
@ -31,11 +31,9 @@ void main() {
|
||||
|
||||
group('Usage', () {
|
||||
late Directory tempDir;
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_packages_test.');
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: MemoryFileSystem.test(),
|
||||
@ -50,9 +48,7 @@ void main() {
|
||||
testUsingContext('indicate the default target platforms', () async {
|
||||
final String projectPath = await createProject(tempDir,
|
||||
arguments: <String>['--no-pub', '--template=app']);
|
||||
final BuildApkCommand command = await runBuildApkCommand(projectPath);
|
||||
|
||||
expect((await command.usageValues).commandBuildApkTargetPlatform, 'android-arm,android-arm64,android-x64');
|
||||
await runBuildApkCommand(projectPath);
|
||||
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
@ -77,11 +73,19 @@ void main() {
|
||||
|
||||
final BuildApkCommand commandWithFlag = await runBuildApkCommand(projectPath,
|
||||
arguments: <String>['--split-per-abi']);
|
||||
expect((await commandWithFlag.usageValues).commandBuildApkSplitPerAbi, true);
|
||||
|
||||
expect(
|
||||
(await commandWithFlag.unifiedAnalyticsUsageValues('run'))
|
||||
.eventData['buildApkSplitPerAbi'],
|
||||
isTrue,
|
||||
);
|
||||
|
||||
final BuildApkCommand commandWithoutFlag = await runBuildApkCommand(projectPath);
|
||||
expect((await commandWithoutFlag.usageValues).commandBuildApkSplitPerAbi, false);
|
||||
|
||||
expect(
|
||||
(await commandWithoutFlag.unifiedAnalyticsUsageValues('run'))
|
||||
.eventData['buildApkSplitPerAbi'],
|
||||
isFalse
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidBuilder: () => FakeAndroidBuilder(),
|
||||
});
|
||||
@ -90,23 +94,27 @@ void main() {
|
||||
final String projectPath = await createProject(tempDir,
|
||||
arguments: <String>['--no-pub', '--template=app']);
|
||||
|
||||
final BuildApkCommand commandDefault = await runBuildApkCommand(projectPath);
|
||||
expect((await commandDefault.usageValues).commandBuildApkBuildMode, 'release');
|
||||
final BuildApkCommand defaultBuildCommand = await runBuildApkCommand(projectPath);
|
||||
final Event defaultBuildCommandUsageValues = await defaultBuildCommand.unifiedAnalyticsUsageValues('build');
|
||||
expect(defaultBuildCommandUsageValues.eventData['buildApkBuildMode'], 'release');
|
||||
|
||||
final BuildApkCommand commandInRelease = await runBuildApkCommand(projectPath,
|
||||
arguments: <String>['--release']);
|
||||
expect((await commandInRelease.usageValues).commandBuildApkBuildMode, 'release');
|
||||
final BuildApkCommand releaseBuildCommand = await runBuildApkCommand(projectPath, arguments: <String>['--release']);
|
||||
final Event releaseBuildCommandUsageValues = await releaseBuildCommand.unifiedAnalyticsUsageValues('build');
|
||||
expect(releaseBuildCommandUsageValues.eventData['buildApkBuildMode'], 'release');
|
||||
|
||||
final BuildApkCommand commandInDebug = await runBuildApkCommand(projectPath,
|
||||
arguments: <String>['--debug']);
|
||||
expect((await commandInDebug.usageValues).commandBuildApkBuildMode, 'debug');
|
||||
final BuildApkCommand debugBuildCommand = await runBuildApkCommand(projectPath, arguments: <String>['--debug']);
|
||||
final Event debugBuildCommandUsageValues = await debugBuildCommand.unifiedAnalyticsUsageValues('build');
|
||||
expect(debugBuildCommandUsageValues.eventData['buildApkBuildMode'], 'debug');
|
||||
|
||||
final BuildApkCommand commandInProfile = await runBuildApkCommand(projectPath,
|
||||
arguments: <String>['--profile']);
|
||||
expect((await commandInProfile.usageValues).commandBuildApkBuildMode, 'profile');
|
||||
final BuildApkCommand profileBuildCommand = await runBuildApkCommand(projectPath, arguments: <String>['--profile']);
|
||||
final Event profileBuildCommandUsageValues = await profileBuildCommand.unifiedAnalyticsUsageValues('build');
|
||||
expect(profileBuildCommandUsageValues.eventData['buildApkBuildMode'], 'profile');
|
||||
|
||||
fakeAnalytics.sentEvents.clear();
|
||||
await runBuildApkCommand(projectPath, arguments: <String>['--profile']);
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidBuilder: () => FakeAndroidBuilder(),
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
||||
testUsingContext('logs success', () async {
|
||||
@ -115,22 +123,22 @@ void main() {
|
||||
|
||||
await runBuildApkCommand(projectPath);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'tool-command-result',
|
||||
'apk',
|
||||
label: 'success',
|
||||
),
|
||||
));
|
||||
final Iterable<Event> successEvent = fakeAnalytics.sentEvents.where(
|
||||
(Event e) =>
|
||||
e.eventName == DashEvent.flutterCommandResult &&
|
||||
e.eventData['commandPath'] == 'create' &&
|
||||
e.eventData['result'] == 'success',
|
||||
);
|
||||
expect(successEvent, isNotEmpty, reason: 'Tool should send create success event');
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
AndroidBuilder: () => FakeAndroidBuilder(),
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
||||
group('Impeller AndroidManifest.xml setting', () {
|
||||
// Adds a key-value `<meta-data>` pair to the `<application>` tag in the
|
||||
// cooresponding `AndroidManifest.xml` file, right before the closing
|
||||
// corresponding `AndroidManifest.xml` file, right before the closing
|
||||
// `</application>` tag.
|
||||
void writeManifestMetadata({
|
||||
required String projectPath,
|
||||
@ -248,15 +256,18 @@ void main() {
|
||||
late FakeProcessManager processManager;
|
||||
late String gradlew;
|
||||
late AndroidSdk mockAndroidSdk;
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics analytics;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_packages_test.');
|
||||
gradlew = globals.fs.path.join(tempDir.path, 'flutter_project', 'android',
|
||||
globals.platform.isWindows ? 'gradlew.bat' : 'gradlew');
|
||||
processManager = FakeProcessManager.empty();
|
||||
mockAndroidSdk = FakeAndroidSdk(globals.fs.directory('irrelevant'));
|
||||
analytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: MemoryFileSystem.test(),
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
);
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
@ -449,14 +460,16 @@ void main() {
|
||||
containsIgnoringWhitespace('To learn more, see: https://developer.android.com/studio/build/shrink-code'),
|
||||
)
|
||||
);
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-r8-failure',
|
||||
parameters: CustomDimensions(),
|
||||
|
||||
expect(
|
||||
analytics.sentEvents,
|
||||
contains(
|
||||
Event.flutterBuildInfo(
|
||||
label: 'gradle-r8-failure',
|
||||
buildType: 'gradle',
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
@ -464,7 +477,7 @@ void main() {
|
||||
Java: () => null,
|
||||
FlutterProjectFactory: () => FakeFlutterProjectFactory(tempDir),
|
||||
ProcessManager: () => processManager,
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => analytics,
|
||||
AndroidStudio: () => FakeAndroidStudio(),
|
||||
});
|
||||
|
||||
@ -503,14 +516,14 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'app-not-using-android-x',
|
||||
parameters: CustomDimensions(),
|
||||
|
||||
expect(
|
||||
analytics.sentEvents,
|
||||
contains(
|
||||
Event.flutterBuildInfo(
|
||||
label: 'app-not-using-android-x', buildType: 'gradle'),
|
||||
),
|
||||
));
|
||||
);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
@ -518,7 +531,7 @@ void main() {
|
||||
FlutterProjectFactory: () => FakeFlutterProjectFactory(tempDir),
|
||||
Java: () => null,
|
||||
ProcessManager: () => processManager,
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => analytics,
|
||||
AndroidStudio: () => FakeAndroidStudio(),
|
||||
});
|
||||
|
||||
@ -550,14 +563,14 @@ void main() {
|
||||
))
|
||||
),
|
||||
);
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
|
||||
expect(
|
||||
analytics.sentEvents,
|
||||
contains(Event.flutterBuildInfo(
|
||||
label: 'app-using-android-x',
|
||||
parameters: CustomDimensions(),
|
||||
),
|
||||
));
|
||||
buildType: 'gradle',
|
||||
)),
|
||||
);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
@ -565,7 +578,7 @@ void main() {
|
||||
FlutterProjectFactory: () => FakeFlutterProjectFactory(tempDir),
|
||||
Java: () => null,
|
||||
ProcessManager: () => processManager,
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => analytics,
|
||||
AndroidStudio: () => FakeAndroidStudio(),
|
||||
});
|
||||
});
|
||||
|
@ -12,7 +12,6 @@ import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/build_appbundle.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -25,14 +24,12 @@ import '../../src/test_flutter_command_runner.dart';
|
||||
void main() {
|
||||
Cache.disableLocking();
|
||||
|
||||
group('Usage', () {
|
||||
group('analytics', () {
|
||||
late Directory tempDir;
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
setUp(() {
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_packages_test.');
|
||||
testUsage = TestUsage();
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: MemoryFileSystem.test(),
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
@ -46,9 +43,8 @@ void main() {
|
||||
testUsingContext('indicate the default target platforms', () async {
|
||||
final String projectPath = await createProject(tempDir,
|
||||
arguments: <String>['--no-pub', '--template=app']);
|
||||
final BuildAppBundleCommand command = await runBuildAppBundleCommand(projectPath);
|
||||
|
||||
expect((await command.usageValues).commandBuildAppBundleTargetPlatform, 'android-arm,android-arm64,android-x64');
|
||||
await runBuildAppBundleCommand(projectPath);
|
||||
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
@ -74,23 +70,56 @@ void main() {
|
||||
final String projectPath = await createProject(tempDir,
|
||||
arguments: <String>['--no-pub', '--template=app']);
|
||||
|
||||
final BuildAppBundleCommand commandDefault = await runBuildAppBundleCommand(projectPath);
|
||||
expect((await commandDefault.usageValues).commandBuildAppBundleBuildMode, 'release');
|
||||
await runBuildAppBundleCommand(projectPath);
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.commandUsageValues(
|
||||
workflow: 'appbundle',
|
||||
commandHasTerminal: false,
|
||||
buildAppBundleTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildAppBundleBuildMode: 'release',
|
||||
)),
|
||||
);
|
||||
|
||||
final BuildAppBundleCommand commandInRelease = await runBuildAppBundleCommand(projectPath,
|
||||
arguments: <String>['--release']);
|
||||
expect((await commandInRelease.usageValues).commandBuildAppBundleBuildMode, 'release');
|
||||
fakeAnalytics.sentEvents.clear();
|
||||
await runBuildAppBundleCommand(projectPath, arguments: <String>['--release']);
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.commandUsageValues(
|
||||
workflow: 'appbundle',
|
||||
commandHasTerminal: false,
|
||||
buildAppBundleTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildAppBundleBuildMode: 'release',
|
||||
)),
|
||||
);
|
||||
|
||||
final BuildAppBundleCommand commandInDebug = await runBuildAppBundleCommand(projectPath,
|
||||
arguments: <String>['--debug']);
|
||||
expect((await commandInDebug.usageValues).commandBuildAppBundleBuildMode, 'debug');
|
||||
fakeAnalytics.sentEvents.clear();
|
||||
await runBuildAppBundleCommand(projectPath, arguments: <String>['--debug']);
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.commandUsageValues(
|
||||
workflow: 'appbundle',
|
||||
commandHasTerminal: false,
|
||||
buildAppBundleTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildAppBundleBuildMode: 'debug',
|
||||
)),
|
||||
);
|
||||
|
||||
final BuildAppBundleCommand commandInProfile = await runBuildAppBundleCommand(projectPath,
|
||||
arguments: <String>['--profile']);
|
||||
expect((await commandInProfile.usageValues).commandBuildAppBundleBuildMode, 'profile');
|
||||
fakeAnalytics.sentEvents.clear();
|
||||
await runBuildAppBundleCommand(projectPath, arguments: <String>['--profile']);
|
||||
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.commandUsageValues(
|
||||
workflow: 'appbundle',
|
||||
commandHasTerminal: false,
|
||||
buildAppBundleTargetPlatform: 'android-arm,android-arm64,android-x64',
|
||||
buildAppBundleBuildMode: 'profile',
|
||||
)),
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidBuilder: () => FakeAndroidBuilder(),
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
|
||||
testUsingContext('logs success', () async {
|
||||
@ -99,27 +128,38 @@ void main() {
|
||||
|
||||
await runBuildAppBundleCommand(projectPath);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent('tool-command-result', 'appbundle', label: 'success'),
|
||||
));
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(
|
||||
Event.flutterCommandResult(
|
||||
commandPath: 'create',
|
||||
result: 'success',
|
||||
commandHasTerminal: false,
|
||||
maxRss: globals.processInfo.maxRss,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
AndroidBuilder: () => FakeAndroidBuilder(),
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => fakeAnalytics,
|
||||
});
|
||||
});
|
||||
|
||||
group('Gradle', () {
|
||||
late Directory tempDir;
|
||||
late FakeProcessManager processManager;
|
||||
late FakeAndroidSdk fakeAndroidSdk;
|
||||
late TestUsage testUsage;
|
||||
late FakeAndroidSdk androidSdk;
|
||||
late FakeAnalytics analytics;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
analytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: MemoryFileSystem.test(),
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
);
|
||||
tempDir = globals.fs.systemTempDirectory.createTempSync('flutter_tools_packages_test.');
|
||||
processManager = FakeProcessManager.any();
|
||||
fakeAndroidSdk = FakeAndroidSdk(globals.fs.directory('irrelevant'));
|
||||
androidSdk = FakeAndroidSdk(globals.fs.directory('irrelevant'));
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
@ -176,20 +216,18 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
expect(analytics.sentEvents, contains(
|
||||
Event.flutterBuildInfo(
|
||||
label: 'app-not-using-android-x',
|
||||
parameters: CustomDimensions(),
|
||||
buildType: 'gradle',
|
||||
),
|
||||
));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
AndroidSdk: () => fakeAndroidSdk,
|
||||
AndroidSdk: () => androidSdk,
|
||||
FlutterProjectFactory: () => FakeFlutterProjectFactory(tempDir),
|
||||
ProcessManager: () => processManager,
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => analytics,
|
||||
});
|
||||
|
||||
testUsingContext('reports when the app is using AndroidX', () async {
|
||||
@ -216,20 +254,18 @@ void main() {
|
||||
)
|
||||
);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
expect(analytics.sentEvents, contains(
|
||||
Event.flutterBuildInfo(
|
||||
label: 'app-using-android-x',
|
||||
parameters: CustomDimensions(),
|
||||
buildType: 'gradle',
|
||||
),
|
||||
));
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
AndroidSdk: () => fakeAndroidSdk,
|
||||
AndroidSdk: () => androidSdk,
|
||||
FlutterProjectFactory: () => FakeFlutterProjectFactory(tempDir),
|
||||
ProcessManager: () => processManager,
|
||||
Usage: () => testUsage,
|
||||
Analytics: () => analytics,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import 'package:flutter_tools/src/base/user_messages.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -44,7 +43,6 @@ const String minimalV2EmbeddingManifest = r'''
|
||||
void main() {
|
||||
group('gradle build', () {
|
||||
late BufferLogger logger;
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
late MemoryFileSystem fileSystem;
|
||||
late FakeProcessManager processManager;
|
||||
@ -52,7 +50,6 @@ void main() {
|
||||
setUp(() {
|
||||
processManager = FakeProcessManager.empty();
|
||||
logger = BufferLogger.test();
|
||||
testUsage = TestUsage();
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
Cache.flutterRoot = '';
|
||||
|
||||
@ -69,7 +66,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -149,16 +145,6 @@ void main() {
|
||||
|
||||
expect(handlerCalled, isTrue);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-random-event-label-failure',
|
||||
parameters: CustomDimensions(),
|
||||
),
|
||||
));
|
||||
expect(testUsage.events, hasLength(2));
|
||||
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
containsAll(<Event>[
|
||||
@ -187,7 +173,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -262,7 +247,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -355,15 +339,6 @@ void main() {
|
||||
expect(logger.statusText, contains('Retrying Gradle Build: #2, wait time: 200ms'));
|
||||
|
||||
expect(testFnCalled, equals(maxRetries + 1));
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-random-event-label-failure',
|
||||
parameters: CustomDimensions(),
|
||||
),
|
||||
));
|
||||
expect(testUsage.events, hasLength(4));
|
||||
|
||||
expect(fakeAnalytics.sentEvents, hasLength(7));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
@ -383,7 +358,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -463,16 +437,6 @@ void main() {
|
||||
|
||||
expect(handlerCalled, isTrue);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-random-event-label-failure',
|
||||
parameters: CustomDimensions(),
|
||||
),
|
||||
));
|
||||
expect(testUsage.events, hasLength(2));
|
||||
|
||||
expect(fakeAnalytics.sentEvents, hasLength(3));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.flutterBuildInfo(
|
||||
@ -492,7 +456,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -564,7 +527,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -654,14 +616,14 @@ void main() {
|
||||
),
|
||||
],
|
||||
);
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-random-event-label-success',
|
||||
parameters: CustomDimensions(),
|
||||
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(
|
||||
Event.flutterBuildInfo(
|
||||
label: 'gradle-random-event-label-success', buildType: 'gradle'),
|
||||
),
|
||||
));
|
||||
);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidStudio: () => FakeAndroidStudio(),
|
||||
@ -674,7 +636,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(
|
||||
@ -766,12 +727,10 @@ void main() {
|
||||
localGradleErrors: <GradleHandledError>[],
|
||||
);
|
||||
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent(
|
||||
'code-size-analysis',
|
||||
'apk',
|
||||
),
|
||||
));
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.codeSizeAnalysis(platform: 'apk')),
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
AndroidStudio: () => FakeAndroidStudio(),
|
||||
});
|
||||
@ -783,7 +742,6 @@ void main() {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -922,7 +880,6 @@ android {
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -968,7 +925,6 @@ BuildVariant: paidProfile
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1002,7 +958,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1043,7 +998,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1127,7 +1081,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1194,7 +1147,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1262,7 +1214,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1348,7 +1299,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm64', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1434,7 +1384,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x86', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1520,7 +1469,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x64', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1607,7 +1555,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.test(),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1674,7 +1621,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1771,7 +1717,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_arm64', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1867,7 +1812,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x86', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
@ -1963,7 +1907,6 @@ Gradle Crashed
|
||||
processManager: processManager,
|
||||
fileSystem: fileSystem,
|
||||
artifacts: Artifacts.testLocalEngine(localEngine: 'out/android_x64', localEngineHost: 'out/host_release'),
|
||||
usage: testUsage,
|
||||
analytics: fakeAnalytics,
|
||||
gradleUtils: FakeGradleUtils(),
|
||||
platform: FakePlatform(),
|
||||
|
@ -8,7 +8,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
@ -37,7 +36,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -56,7 +54,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -75,7 +72,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -94,7 +90,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -113,7 +108,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -132,7 +126,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -151,7 +144,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -170,7 +162,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -189,7 +180,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -208,7 +198,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -227,7 +216,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -241,7 +229,6 @@ void main() {
|
||||
project,
|
||||
BuildInfo.debug,
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -260,7 +247,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -279,7 +265,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -298,7 +283,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -309,17 +293,16 @@ void main() {
|
||||
testWithoutContext("Finds app bundle when flavor doesn't contain underscores in profile mode", () {
|
||||
final FlutterProject project = generateFakeAppBundle('fooProfile', 'app.aab', fileSystem);
|
||||
final File bundle = findBundleFile(
|
||||
project,
|
||||
const BuildInfo(
|
||||
BuildMode.profile,
|
||||
'foo',
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
project,
|
||||
const BuildInfo(
|
||||
BuildMode.profile,
|
||||
'foo',
|
||||
treeShakeIcons: false,
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
expect(bundle, isNotNull);
|
||||
expect(bundle.path, '/build/app/outputs/bundle/fooProfile/app.aab');
|
||||
@ -336,7 +319,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -355,7 +337,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -374,7 +355,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -393,7 +373,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -407,7 +386,6 @@ void main() {
|
||||
project,
|
||||
BuildInfo.debug,
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -426,7 +404,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -445,7 +422,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -464,7 +440,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -483,7 +458,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -503,7 +477,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -523,7 +496,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
TestUsage(),
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
@ -533,7 +505,6 @@ void main() {
|
||||
|
||||
testWithoutContext('AAB not found', () {
|
||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final TestUsage testUsage = TestUsage();
|
||||
expect(
|
||||
() {
|
||||
findBundleFile(
|
||||
@ -545,7 +516,6 @@ void main() {
|
||||
packageConfigPath: '.dart_tool/package_config.json',
|
||||
),
|
||||
BufferLogger.test(),
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
},
|
||||
@ -553,16 +523,6 @@ void main() {
|
||||
message:
|
||||
"Gradle build failed to produce an .aab file. It's likely that this file "
|
||||
"was generated under ${project.android.buildDirectory.path}, but the tool couldn't find it."));
|
||||
expect(testUsage.events, contains(
|
||||
TestUsageEvent(
|
||||
'build',
|
||||
'gradle',
|
||||
label: 'gradle-expected-file-not-found',
|
||||
parameters: CustomDimensions.fromMap(<String, String> {
|
||||
'cd37': 'androidGradlePluginVersion: 7.6.3, fileExtension: .aab',
|
||||
}),
|
||||
),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, hasLength(1));
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
|
@ -7,7 +7,6 @@ import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/analyze_size.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
@ -66,7 +65,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
appFilenamePattern: RegExp(r'lib.*app\.so'),
|
||||
flutterUsage: TestUsage(),
|
||||
analytics: const NoOpAnalytics(),
|
||||
);
|
||||
|
||||
@ -151,7 +149,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
appFilenamePattern: RegExp(r'lib.*app\.so'),
|
||||
flutterUsage: TestUsage(),
|
||||
analytics: const NoOpAnalytics(),
|
||||
);
|
||||
|
||||
@ -194,7 +191,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
appFilenamePattern: RegExp(r'lib.*app\.so'),
|
||||
flutterUsage: TestUsage(),
|
||||
analytics: const NoOpAnalytics(),
|
||||
);
|
||||
|
||||
@ -238,7 +234,6 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
appFilenamePattern: RegExp(r'lib.*app\.so'),
|
||||
flutterUsage: TestUsage(),
|
||||
analytics: const NoOpAnalytics(),
|
||||
);
|
||||
|
||||
|
@ -21,7 +21,6 @@ import 'package:flutter_tools/src/migrations/cocoapods_toolchain_directory_migra
|
||||
import 'package:flutter_tools/src/migrations/xcode_project_object_version_migration.dart';
|
||||
import 'package:flutter_tools/src/migrations/xcode_script_build_phase_migration.dart';
|
||||
import 'package:flutter_tools/src/migrations/xcode_thin_binary_build_phase_input_paths_migration.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/xcode_project.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
@ -32,15 +31,11 @@ import '../../src/fakes.dart';
|
||||
|
||||
void main () {
|
||||
group('iOS migration', () {
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
setUp(() {
|
||||
testUsage = TestUsage();
|
||||
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
fs: fs,
|
||||
fs: MemoryFileSystem.test(),
|
||||
fakeFlutterVersion: FakeFlutterVersion(),
|
||||
);
|
||||
});
|
||||
@ -69,11 +64,9 @@ void main () {
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
await iosProjectMigration.migrate();
|
||||
expect(testUsage.events, isEmpty);
|
||||
expect(fakeAnalytics.sentEvents, isEmpty);
|
||||
|
||||
expect(xcodeProjectInfoFile.existsSync(), isFalse);
|
||||
@ -90,11 +83,9 @@ void main () {
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
await iosProjectMigration.migrate();
|
||||
expect(testUsage.events, isEmpty);
|
||||
expect(fakeAnalytics.sentEvents, isEmpty);
|
||||
|
||||
expect(xcodeProjectInfoFile.lastModifiedSync(), projectLastModified);
|
||||
@ -112,7 +103,6 @@ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
await iosProjectMigration.migrate();
|
||||
@ -140,11 +130,9 @@ keep this 2
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
await iosProjectMigration.migrate();
|
||||
expect(testUsage.events, isEmpty);
|
||||
expect(fakeAnalytics.sentEvents, isEmpty);
|
||||
|
||||
expect(xcodeProjectInfoFile.readAsStringSync(), r'''
|
||||
@ -163,14 +151,11 @@ keep this 2
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
|
||||
expect(iosProjectMigration.migrate, throwsToolExit(message: 'Your Xcode project requires migration'));
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent('ios-migration', 'remove-frameworks', label: 'failure'),
|
||||
));
|
||||
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.appleUsageEvent(
|
||||
workflow: 'ios-migration',
|
||||
@ -188,13 +173,9 @@ keep this 2
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
expect(iosProjectMigration.migrate, throwsToolExit(message: 'Your Xcode project requires migration'));
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent('ios-migration', 'remove-frameworks', label: 'failure'),
|
||||
));
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.appleUsageEvent(
|
||||
workflow: 'ios-migration',
|
||||
@ -212,13 +193,10 @@ keep this 2
|
||||
final RemoveFrameworkLinkAndEmbeddingMigration iosProjectMigration = RemoveFrameworkLinkAndEmbeddingMigration(
|
||||
project,
|
||||
testLogger,
|
||||
testUsage,
|
||||
fakeAnalytics,
|
||||
);
|
||||
expect(iosProjectMigration.migrate, throwsToolExit(message: 'Your Xcode project requires migration'));
|
||||
expect(testUsage.events, contains(
|
||||
const TestUsageEvent('ios-migration', 'remove-frameworks', label: 'failure'),
|
||||
));
|
||||
|
||||
expect(fakeAnalytics.sentEvents, contains(
|
||||
Event.appleUsageEvent(
|
||||
workflow: 'ios-migration',
|
||||
|
@ -16,7 +16,6 @@ import 'package:flutter_tools/src/ios/code_signing.dart';
|
||||
import 'package:flutter_tools/src/ios/mac.dart';
|
||||
import 'package:flutter_tools/src/ios/xcresult.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -191,14 +190,12 @@ void main() {
|
||||
|
||||
group('Diagnose Xcode build failure', () {
|
||||
late Map<String, String> buildSettings;
|
||||
late TestUsage testUsage;
|
||||
late FakeAnalytics fakeAnalytics;
|
||||
|
||||
setUp(() {
|
||||
buildSettings = <String, String>{
|
||||
'PRODUCT_BUNDLE_IDENTIFIER': 'test.app',
|
||||
};
|
||||
testUsage = TestUsage();
|
||||
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
fakeAnalytics = getInitializedFakeAnalyticsInstance(
|
||||
@ -222,24 +219,12 @@ void main() {
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
platform: SupportedPlatform.ios,
|
||||
project: FakeFlutterProject(fileSystem: fs),
|
||||
);
|
||||
expect(testUsage.events, contains(
|
||||
TestUsageEvent(
|
||||
'build',
|
||||
'ios',
|
||||
label: 'xcode-bitcode-failure',
|
||||
parameters: CustomDimensions(
|
||||
buildEventCommand: buildCommands.toString(),
|
||||
buildEventSettings: buildSettings.toString(),
|
||||
),
|
||||
),
|
||||
));
|
||||
expect(
|
||||
fakeAnalytics.sentEvents,
|
||||
contains(Event.flutterBuildInfo(
|
||||
@ -323,7 +308,6 @@ Error launching application on iPhone.''',
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -369,7 +353,6 @@ Error launching application on iPhone.''',
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -417,7 +400,6 @@ Could not build the precompiled application for the device.''',
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -469,7 +451,6 @@ Could not build the precompiled application for the device.''',
|
||||
final MemoryFileSystem fs = MemoryFileSystem.test();
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -504,7 +485,6 @@ Could not build the precompiled application for the device.''',
|
||||
project.ios.podfile.createSync(recursive: true);
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -549,7 +529,6 @@ duplicate symbol '_$s29plugin_1_name23PluginNamePluginC9setDouble3key5valueySS_S
|
||||
project.ios.podfile.createSync(recursive: true);
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -591,7 +570,6 @@ duplicate symbol '_$s29plugin_1_name23PluginNamePluginC9setDouble3key5valueySS_S
|
||||
project.ios.podfile.createSync(recursive: true);
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -632,7 +610,6 @@ duplicate symbol '_$s29plugin_1_name23PluginNamePluginC9setDouble3key5valueySS_S
|
||||
project.ios.podfile.createSync(recursive: true);
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
@ -675,7 +652,6 @@ duplicate symbol '_$s29plugin_1_name23PluginNamePluginC9setDouble3key5valueySS_S
|
||||
.createSync(recursive: true);
|
||||
await diagnoseXcodeBuildFailure(
|
||||
buildResult,
|
||||
flutterUsage: testUsage,
|
||||
logger: logger,
|
||||
analytics: fakeAnalytics,
|
||||
fileSystem: fs,
|
||||
|
Loading…
Reference in New Issue
Block a user