Skip to content

Commit

Permalink
[workloads] Add telemetry for mobile and wasm workloads (#90208)
Browse files Browse the repository at this point in the history
This change adds CLI telemetry for common mobile and wasm scenarios.

Total app size is another element we plan on tracking and that will be added in a follow up.

Fixes #88844
  • Loading branch information
steveisok authored Aug 12, 2023
1 parent 39c0dbf commit b02e5e1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
<WorkloadManifestPath>$(IntermediateOutputPath)WorkloadManifest.json</WorkloadManifestPath>
<WorkloadManifestTargetsPath>$(IntermediateOutputPath)WorkloadManifest.targets</WorkloadManifestTargetsPath>
<WorkloadManifestWasiTargetsPath>$(IntermediateOutputPath)WorkloadManifest.Wasi.targets</WorkloadManifestWasiTargetsPath>
<WorkloadManifestTelemetryTargetsPath>$(MSBuildThisFileDirectory)WorkloadTelemetry.targets</WorkloadManifestTelemetryTargetsPath>
</PropertyGroup>

<ItemGroup>
<PackageFile Include="$(WorkloadManifestPath)" TargetPath="data" />
<PackageFile Include="$(WorkloadManifestTargetsPath)" TargetPath="data" />
<PackageFile Include="$(WorkloadManifestWasiTargetsPath)" TargetPath="data" />
<PackageFile Include="$(WorkloadManifestTelemetryTargetsPath)" TargetPath="data" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,7 @@
BeforeTargets="Build">
<Error Text="WebAssembly workloads can only support one active threading mode at a time. Either set WasmEnableThreads or WasmEnablePerfTracing to true, but not both." />
</Target>

<Import Condition="'$(TargetsCurrent)' == 'true' and ('$(UsingBrowserRuntimeWorkload)' == 'true' or '$(UsingMobileWorkload)' == 'true')"
Project="$(MSBuildThisFileDirectory)WorkloadTelemetry.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<Target Name="_WorkloadTelemetry"
Condition="'$(_MonoWorkloadTargetsMobile)' == 'true' and '$(TargetsCurrent)' == 'true'"
AfterTargets="Publish"
DependsOnTargets="_WorkloadGatherTelemetryData">

<ItemGroup>
<WorkloadPublishProperties Include="TargetPlatformIdentifier" Value="$(TargetPlatformIdentifier)" />
<WorkloadPublishProperties Include="RuntimeIdentifier" Value="$(RuntimeIdentifier)" />
<WorkloadPublishProperties Include="BlazorWasm" Value="$(_WorkloadUsesBlazorWasm)" />
<WorkloadPublishProperties Include="WasmSDK" Value="$(_WorkloadUsesWasmSDK)" />
<WorkloadPublishProperties Include="UsesMaui" Value="$(UseMaui)" />
<WorkloadPublishProperties Include="UsesMobileSDKOnly" Value="$(_WorkloadUsesMobileSDKOnly)" />
<WorkloadPublishProperties Include="UsesOtherMobileSDK" Value="$(_WorkloadUsesOther)" />
<WorkloadPublishProperties Include="MonoAOT" Value="$(_WorkloadUsesMonoAOT)" />
<WorkloadPublishProperties Include="NativeAOT" Value="$(_WorkloadUsesNativeAOT)" />
<WorkloadPublishProperties Include="Interp" Value="$(_WorkloadUsesInterpreter)" />
<WorkloadPublishProperties Include="LibraryMode" Value="$(_WorkloadUsesLibraryMode)" />
<WorkloadPublishProperties Include="HybridGlobalization" Value="$(HybridGlobalization)" />
<WorkloadPublishProperties Include="ResolvedRuntimePack" Value="$(_MonoWorkloadRuntimePackPackageVersion)" />
</ItemGroup>

<AllowEmptyTelemetry EventName="WorkloadPublishProperties" EventData="@(WorkloadPublishProperties)" />
</Target>

<Target Name="_WorkloadGatherTelemetryData">
<PropertyGroup>
<_WorkloadUsesBlazorWasm>$(UsingMicrosoftNETSdkBlazorWebAssembly)</_WorkloadUsesBlazorWasm>
<_WorkloadUsesWasmSDK>$(UsingMicrosoftNETSdkWebAssembly)</_WorkloadUsesWasmSDK>
<_WorkloadUsesMonoAOT>$(RunAOTCompilation)</_WorkloadUsesMonoAOT>
<_WorkloadUsesMonoAOT Condition="'$(RunAOTCompilation)' == '' and '$(PublishAot)' != 'true' and ('$(TargetPlatformIdentifier)' == 'maccatalyst' or '$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos')">$(_RunAotCompiler)</_WorkloadUsesMonoAOT>
<_WorkloadUsesNativeAOT>$(PublishAot)</_WorkloadUsesNativeAOT>
<_WorkloadUsesInterpreter>$(MonoForceInterpreter)</_WorkloadUsesInterpreter>
<_WorkloadUsesInterpreter Condition="'$(_WorkloadUsesInterpreter)' == '' and '$(UseInterpreter)' == 'true'">true</_WorkloadUsesInterpreter>
<_WorkloadUsesInterpreter Condition="'$(_WorkloadUsesInterpreter)' == '' and '$(RunAOTCompilation)' != 'true' and ('$(_WorkloadUsesBlazorWasm)' == 'true' or '$(_WorkloadUsesWasmSDK)' == 'true')">true</_WorkloadUsesInterpreter>
<_WorkloadUsesLibraryMode Condition="'$(NativeLib)' != '' and ('$(_WorkloadUsesMonoAOT)' == 'true' or '$(_WorkloadUsesNativeAOT)' == 'true')">true</_WorkloadUsesLibraryMode>
</PropertyGroup>

<PropertyGroup>
<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesOther>
<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'uno.dll'">true</_WorkloadUsesOther>
<_WorkloadUsesMobileSDKOnly Condition="'$(RuntimeIdentifier)' != 'browser-wasm' and '$(UseMaui)' != 'true' and '$(_WorkloadUsesOther)' != 'true'">true</_WorkloadUsesMobileSDKOnly>
</PropertyGroup>
</Target>
</Project>

0 comments on commit b02e5e1

Please sign in to comment.