Skip to content

Commit c745428

Browse files
biggs0125natebiggsgemini-code-assist[bot]
authored
Add wasm_dry_run_package event to track public package names from wasm dry run findings. (#2279)
Co-authored-by: Nate Biggs <natebiggs@google.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent db90378 commit c745428

File tree

6 files changed

+61
-7
lines changed

6 files changed

+61
-7
lines changed

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 8.0.10
2+
- Added `Event.flutterWasmDryRunPackage` to track dart2wasm dry run metrics from Flutter
3+
including public package information.
4+
15
## 8.0.9
26
- Added `libraryDiagnosticsBundleFailures` to `Event.analysisStatistics`.
37

@@ -6,9 +10,9 @@
610

711
## 8.0.7
812
- Added optional fields `contextWorkspaceType` and `numberOfPackagesInWorkspace`
9-
to `Event.contextStructure` for workspace and packages distribution from the
13+
to `Event.contextStructure` for workspace and packages distribution from the
1014
Dart Analysis Server.
11-
- Removed `Event.contextStructure` optional fields `contextsFromBothFiles`,
15+
- Removed `Event.contextStructure` optional fields `contextsFromBothFiles`,
1216
`contextsFromOptionsFiles`,`contextsFromPackagesFiles`,`contextsWithoutFiles`.
1317

1418
## 8.0.6

pkgs/unified_analytics/lib/src/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const int kMaxLogFileSize = 25 * (1 << 20);
8787
const String kLogFileName = 'dart-flutter-telemetry.log';
8888

8989
/// The current version of the package, should be in line with pubspec version.
90-
const String kPackageVersion = '8.0.9';
90+
const String kPackageVersion = '8.0.10';
9191

9292
/// The minimum length for a session.
9393
const int kSessionDurationMinutes = 30;

pkgs/unified_analytics/lib/src/enums.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ enum DashEvent {
108108
description: 'Information for a dart2wasm dry run invoked from Flutter',
109109
toolOwner: DashTool.flutterTool,
110110
),
111+
flutterWasmDryRunPackage(
112+
label: 'wasm_dry_run_package',
113+
description:
114+
'Information for a dart2wasm dry run invoked from Flutter with package '
115+
'info',
116+
toolOwner: DashTool.flutterTool,
117+
),
111118
flutterInjectDarwinPlugins(
112119
label: 'flutter_inject_darwin_plugins',
113120
description: 'Information on plugins injected into an iOS/macOS project',

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,29 @@ final class Event {
673673
},
674674
);
675675

676+
/// Provides information about the results of a wasm dry run including public
677+
/// package names and versions.
678+
///
679+
/// [result] - dry run result summary
680+
///
681+
/// [exitCode] - the exit code of the dry run.
682+
///
683+
/// [findingsInfo] - findings for the dry run, keyed by finding index.
684+
/// The value is a comma-separated string containing flags and package
685+
/// information in `name:version` format, e.g., `'-ph,pkg1:1.2.3'`.
686+
Event.flutterWasmDryRunPackage({
687+
required String result,
688+
required int exitCode,
689+
required Map<String, String> findingsInfo,
690+
}) : this._(
691+
eventName: DashEvent.flutterWasmDryRunPackage,
692+
eventData: {
693+
'result': result,
694+
'exitCode': exitCode,
695+
...findingsInfo,
696+
},
697+
);
698+
676699
/// Provides information about the plugins injected into an iOS or macOS
677700
/// project.
678701
///

pkgs/unified_analytics/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: >-
55
# LINT.IfChange
66
# When updating this, keep the version consistent with the changelog and the
77
# value in lib/src/constants.dart.
8-
version: 8.0.9
8+
version: 8.0.10
99
# LINT.ThenChange(lib/src/constants.dart)
1010
repository: https://github.com/dart-lang/tools/tree/main/pkgs/unified_analytics
1111
issue_tracker: https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aunified_analytics

pkgs/unified_analytics/test/event_test.dart

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ void main() {
455455
expect(constructedEvent.eventData.length, 4);
456456
});
457457

458-
test('Event.flutterWasmDryRun constructed', () {
458+
test('Event.flutterWasmDryRun constructed no findings', () {
459459
Event generateEventNoFindings() => Event.flutterWasmDryRun(
460460
result: 'success',
461461
exitCode: 123,
@@ -469,7 +469,7 @@ void main() {
469469
expect(constructedEvent1.eventData['exitCode'], 123);
470470
expect(constructedEvent1.eventData.length, 2);
471471
});
472-
test('Event.flutterWasmDryRun constructed', () {
472+
test('Event.flutterWasmDryRun constructed with findings', () {
473473
Event generateEventNoFindings() => Event.flutterWasmDryRun(
474474
result: 'success',
475475
exitCode: 123,
@@ -496,6 +496,26 @@ void main() {
496496
expect(constructedEvent2.eventData.length, 3);
497497
});
498498

499+
test('Event.flutterWasmDryRunPackage constructed', () {
500+
Event generateEvent() => Event.flutterWasmDryRunPackage(
501+
result: 'success',
502+
exitCode: 123,
503+
findingsInfo: {
504+
'0': '-ph,pkg1:1.2.3,pkg2:5.4.3',
505+
'1': '-p,pkg3:9.2.44,pkg4:6.4.3',
506+
});
507+
508+
final constructedEvent1 = generateEvent();
509+
510+
expect(generateEvent, returnsNormally);
511+
expect(constructedEvent1.eventName, DashEvent.flutterWasmDryRunPackage);
512+
expect(constructedEvent1.eventData['result'], 'success');
513+
expect(constructedEvent1.eventData['exitCode'], 123);
514+
expect(constructedEvent1.eventData['0'], '-ph,pkg1:1.2.3,pkg2:5.4.3');
515+
expect(constructedEvent1.eventData['1'], '-p,pkg3:9.2.44,pkg4:6.4.3');
516+
expect(constructedEvent1.eventData.length, 4);
517+
});
518+
499519
test('Event.flutterInjectDarwinPlugins constructed', () {
500520
Event generateEvent() => Event.flutterInjectDarwinPlugins(
501521
platform: 'ios',
@@ -784,7 +804,7 @@ void main() {
784804

785805
// Change this integer below if your PR either adds or removes
786806
// an Event constructor
787-
final eventsAccountedForInTests = 31;
807+
final eventsAccountedForInTests = 32;
788808
expect(eventsAccountedForInTests, constructorCount,
789809
reason: 'If you added or removed an event constructor, '
790810
'ensure you have updated '

0 commit comments

Comments
 (0)