Unverified Commit 702f0144 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

[tool,web] track web-renderer, and Wasm build args in analytics (#125336)

Addresses part of https://github.com/flutter/flutter/issues/125164
parent f86b9220
......@@ -129,7 +129,10 @@ class WebBuilder {
BuildEvent(
'web-compile',
type: 'web',
settings: 'wasm-compile: ${compilerConfig.isWasm}',
settings: _buildEventAnalyticsSettings(
config: compilerConfig,
buildInfo: buildInfo,
),
flutterUsage: _flutterUsage,
).send();
......@@ -222,3 +225,20 @@ const Map<WebRendererMode, Map<NullSafetyMode, HostArtifact>> kDartSdkJsMapArtif
};
const String kWasmPreviewUri = 'https://flutter.dev/wasm';
String _buildEventAnalyticsSettings({
required WebCompilerConfig config,
required BuildInfo buildInfo,
}) {
final Map<String, Object> values = <String, Object>{
...config.buildEventAnalyticsValues,
'web-renderer': buildInfo.webRenderer.cliName,
};
final List<String> sortedList = values.entries
.map((MapEntry<String, Object> e) => '${e.key}: ${e.value};')
.toList()
..sort();
return sortedList.join(' ');
}
......@@ -11,6 +11,10 @@ abstract class WebCompilerConfig {
bool get isWasm;
Map<String, String> toBuildSystemEnvironment();
Map<String, Object> get buildEventAnalyticsValues => <String, Object>{
'wasm-compile': isWasm,
};
}
/// Configuration for the Dart-to-Javascript compiler (dart2js).
......@@ -165,4 +169,14 @@ class WasmCompilerConfig extends WebCompilerConfig {
List<String> toCommandOptions() => <String>[
if (omitTypeChecks) '--omit-type-checks',
];
@override
Map<String, Object> get buildEventAnalyticsValues => <String, Object>{
...super.buildEventAnalyticsValues,
for (MapEntry<String, String> entry in toBuildSystemEnvironment()
.entries
.where(
(MapEntry<String, String> element) => element.value == 'true'))
entry.key: entry.value,
};
}
......@@ -88,7 +88,7 @@ void main() {
'build',
'web',
label: 'web-compile',
parameters: CustomDimensions(buildEventSettings: 'wasm-compile: true')
parameters: CustomDimensions(buildEventSettings: 'wasm-compile: true; web-renderer: auto;')
),
]));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment