Skip to content

Commit 0072174

Browse files
authored
Merge branch 'main' into oauth2-readme
2 parents 06b82e1 + 7bf22c9 commit 0072174

File tree

8 files changed

+116
-110
lines changed

8 files changed

+116
-110
lines changed

.github/workflows/markdown_flutter.yaml

Lines changed: 0 additions & 63 deletions
This file was deleted.

pkgs/unified_analytics/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 8.0.3
2+
- Changed `Event.contextStructure` to make optional data that's no longer being
3+
collected and to add data about the size of library cycles.
4+
5+
## 8.0.2
6+
- Added `Event.dartMCPEvent` for events from the `dart mcp-server` command.
7+
18
## 8.0.1
29
- Added `Event.flutterInjectDarwinPlugins` event for plugins injected into an iOS/macOS project.
310

pkgs/unified_analytics/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![package:unified_analytics](https://github.com/dart-lang/tools/actions/workflows/unified_analytics.yml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/unified_analytics.yml)
1+
[![package:unified_analytics](https://github.com/dart-lang/tools/actions/workflows/unified_analytics.yaml/badge.svg)](https://github.com/dart-lang/tools/actions/workflows/unified_analytics.yaml)
22
[![pub package](https://img.shields.io/pub/v/unified_analytics.svg)](https://pub.dev/packages/unified_analytics)
33
[![package publisher](https://img.shields.io/pub/publisher/unified_analytics.svg)](https://pub.dev/packages/unified_analytics/publisher)
44

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.1';
90+
const String kPackageVersion = '8.0.3';
9191

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

pkgs/unified_analytics/lib/src/enums.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ enum DashEvent {
5555
description: 'Pub package resolution details',
5656
toolOwner: DashTool.dartTool,
5757
),
58+
dartMCPEvent(
59+
label: 'dart_mcp_server',
60+
description: 'Information for a Dart MCP server event',
61+
toolOwner: DashTool.dartTool,
62+
),
5863

5964
// Events for Flutter devtools
6065

pkgs/unified_analytics/lib/src/event.dart

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -309,18 +309,6 @@ final class Event {
309309
/// Event that is emitted on shutdown to report the structure of the analysis
310310
/// contexts created immediately after startup.
311311
///
312-
/// [contextsFromBothFiles] - the number of contexts that were created because
313-
/// of both a package config and an analysis options file.
314-
///
315-
/// [contextsFromOptionsFiles] - the number of contexts that were created
316-
/// because of an analysis options file.
317-
///
318-
/// [contextsFromPackagesFiles] - the number of contexts that were created
319-
/// because of a package config file.
320-
///
321-
/// [contextsWithoutFiles] - the number of contexts that were created because
322-
/// of the lack of either a package config or an analysis options file.
323-
///
324312
/// [immediateFileCount] - the number of files in one of the analysis
325313
/// contexts.
326314
///
@@ -341,32 +329,54 @@ final class Event {
341329
///
342330
/// [transitiveFileUniqueLineCount] - the number of lines in the unique
343331
/// transitive files.
332+
///
333+
/// [libraryCycleLibraryCounts] - json encoded percentile values indicating
334+
/// the number of libraries in a single library cycle.
335+
///
336+
/// [libraryCycleLineCounts] - json encoded percentile values indicating the
337+
/// number of lines of code in all of the files in a single library cycle.
338+
///
339+
/// [contextsFromBothFiles] - the number of contexts that were created because
340+
/// of both a package config and an analysis options file.
341+
///
342+
/// [contextsFromOptionsFiles] - the number of contexts that were created
343+
/// because of an analysis options file.
344+
///
345+
/// [contextsFromPackagesFiles] - the number of contexts that were created
346+
/// because of a package config file.
347+
///
348+
/// [contextsWithoutFiles] - the number of contexts that were created because
349+
/// of the lack of either a package config or an analysis options file.
344350
Event.contextStructure({
345-
required int contextsFromBothFiles,
346-
required int contextsFromOptionsFiles,
347-
required int contextsFromPackagesFiles,
348-
required int contextsWithoutFiles,
349351
required int immediateFileCount,
350352
required int immediateFileLineCount,
351353
required int numberOfContexts,
352354
required int transitiveFileCount,
353355
required int transitiveFileLineCount,
354356
required int transitiveFileUniqueCount,
355357
required int transitiveFileUniqueLineCount,
358+
String libraryCycleLibraryCounts = '',
359+
String libraryCycleLineCounts = '',
360+
int contextsFromBothFiles = 0,
361+
int contextsFromOptionsFiles = 0,
362+
int contextsFromPackagesFiles = 0,
363+
int contextsWithoutFiles = 0,
356364
}) : this._(
357365
eventName: DashEvent.contextStructure,
358366
eventData: {
359-
'contextsFromBothFiles': contextsFromBothFiles,
360-
'contextsFromOptionsFiles': contextsFromOptionsFiles,
361-
'contextsFromPackagesFiles': contextsFromPackagesFiles,
362-
'contextsWithoutFiles': contextsWithoutFiles,
363367
'immediateFileCount': immediateFileCount,
364368
'immediateFileLineCount': immediateFileLineCount,
365369
'numberOfContexts': numberOfContexts,
366370
'transitiveFileCount': transitiveFileCount,
367371
'transitiveFileLineCount': transitiveFileLineCount,
368372
'transitiveFileUniqueCount': transitiveFileUniqueCount,
369373
'transitiveFileUniqueLineCount': transitiveFileUniqueLineCount,
374+
'libraryCycleLibraryCounts': libraryCycleLibraryCounts,
375+
'libraryCycleLineCounts': libraryCycleLineCounts,
376+
'contextsFromBothFiles': contextsFromBothFiles,
377+
'contextsFromOptionsFiles': contextsFromOptionsFiles,
378+
'contextsFromPackagesFiles': contextsFromPackagesFiles,
379+
'contextsWithoutFiles': contextsWithoutFiles,
370380
},
371381
);
372382

@@ -905,6 +915,32 @@ final class Event {
905915
},
906916
);
907917

918+
/// An event that is sent from the Dart MCP server.
919+
///
920+
/// The [client] is the name of the client, as given when it connected to the
921+
/// MCP server, and [clientVersion] is the version of the client.
922+
///
923+
/// The [serverVersion] is the version of the Dart MCP server.
924+
///
925+
/// The [type] identifies the kind of event this is, and [additionalData] is
926+
/// the actual data for the event.
927+
Event.dartMCPEvent({
928+
required String client,
929+
required String clientVersion,
930+
required String serverVersion,
931+
required String type,
932+
CustomMetrics? additionalData,
933+
}) : this._(
934+
eventName: DashEvent.dartMCPEvent,
935+
eventData: {
936+
'client': client,
937+
'clientVersion': clientVersion,
938+
'serverVersion': serverVersion,
939+
'type': type,
940+
...?additionalData?.toMap(),
941+
},
942+
);
943+
908944
@override
909945
int get hashCode => Object.hash(eventName, jsonEncode(eventData));
910946

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.1
8+
version: 8.0.3
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: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,35 @@ void main() {
8585

8686
test('Event.contextStructure constructed', () {
8787
Event generateEvent() => Event.contextStructure(
88-
contextsFromBothFiles: 1,
89-
contextsFromOptionsFiles: 2,
90-
contextsFromPackagesFiles: 3,
91-
contextsWithoutFiles: 4,
92-
immediateFileCount: 5,
93-
immediateFileLineCount: 6,
94-
numberOfContexts: 7,
95-
transitiveFileCount: 8,
96-
transitiveFileLineCount: 9,
97-
transitiveFileUniqueCount: 10,
98-
transitiveFileUniqueLineCount: 11,
88+
immediateFileCount: 1,
89+
immediateFileLineCount: 2,
90+
numberOfContexts: 3,
91+
transitiveFileCount: 4,
92+
transitiveFileLineCount: 5,
93+
transitiveFileUniqueCount: 6,
94+
transitiveFileUniqueLineCount: 7,
95+
libraryCycleLibraryCounts: 'a',
96+
libraryCycleLineCounts: 'b',
9997
);
10098

10199
final constructedEvent = generateEvent();
102100

103101
expect(generateEvent, returnsNormally);
104102
expect(constructedEvent.eventName, DashEvent.contextStructure);
105-
expect(constructedEvent.eventData['contextsFromBothFiles'], 1);
106-
expect(constructedEvent.eventData['contextsFromOptionsFiles'], 2);
107-
expect(constructedEvent.eventData['contextsFromPackagesFiles'], 3);
108-
expect(constructedEvent.eventData['contextsWithoutFiles'], 4);
109-
expect(constructedEvent.eventData['immediateFileCount'], 5);
110-
expect(constructedEvent.eventData['immediateFileLineCount'], 6);
111-
expect(constructedEvent.eventData['numberOfContexts'], 7);
112-
expect(constructedEvent.eventData['transitiveFileCount'], 8);
113-
expect(constructedEvent.eventData['transitiveFileLineCount'], 9);
114-
expect(constructedEvent.eventData['transitiveFileUniqueCount'], 10);
115-
expect(constructedEvent.eventData['transitiveFileUniqueLineCount'], 11);
116-
expect(constructedEvent.eventData.length, 11);
103+
expect(constructedEvent.eventData['immediateFileCount'], 1);
104+
expect(constructedEvent.eventData['immediateFileLineCount'], 2);
105+
expect(constructedEvent.eventData['numberOfContexts'], 3);
106+
expect(constructedEvent.eventData['transitiveFileCount'], 4);
107+
expect(constructedEvent.eventData['transitiveFileLineCount'], 5);
108+
expect(constructedEvent.eventData['transitiveFileUniqueCount'], 6);
109+
expect(constructedEvent.eventData['transitiveFileUniqueLineCount'], 7);
110+
expect(constructedEvent.eventData['libraryCycleLibraryCounts'], 'a');
111+
expect(constructedEvent.eventData['libraryCycleLineCounts'], 'b');
112+
expect(constructedEvent.eventData['contextsFromBothFiles'], 0);
113+
expect(constructedEvent.eventData['contextsFromOptionsFiles'], 0);
114+
expect(constructedEvent.eventData['contextsFromPackagesFiles'], 0);
115+
expect(constructedEvent.eventData['contextsWithoutFiles'], 0);
116+
expect(constructedEvent.eventData.length, 13);
117117
});
118118

119119
test('Event.dartCliCommandExecuted constructed', () {
@@ -655,6 +655,27 @@ void main() {
655655
expect(constructedEvent.eventData.length, 20);
656656
});
657657

658+
test('Event.dartMCPEvent constructed', () {
659+
final event = Event.dartMCPEvent(
660+
client: 'test client',
661+
clientVersion: '1.0.0',
662+
serverVersion: '1.1.0',
663+
type: 'some_event',
664+
additionalData:
665+
_TestMetrics(boolField: true, stringField: 'hello', intField: 1));
666+
expect(
667+
event.eventData,
668+
equals({
669+
'client': 'test client',
670+
'clientVersion': '1.0.0',
671+
'serverVersion': '1.1.0',
672+
'type': 'some_event',
673+
'boolField': true,
674+
'stringField': 'hello',
675+
'intField': 1,
676+
}));
677+
});
678+
658679
test('Confirm all constructors were checked', () {
659680
var constructorCount = 0;
660681
for (final declaration in reflectClass(Event).declarations.keys) {
@@ -667,7 +688,7 @@ void main() {
667688

668689
// Change this integer below if your PR either adds or removes
669690
// an Event constructor
670-
final eventsAccountedForInTests = 28;
691+
final eventsAccountedForInTests = 29;
671692
expect(eventsAccountedForInTests, constructorCount,
672693
reason: 'If you added or removed an event constructor, '
673694
'ensure you have updated '

0 commit comments

Comments
 (0)