Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workloads] Add telemetry for mobile and wasm workloads #90208

Merged
merged 4 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -191,4 +191,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,45 @@
<!-- 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 '$(TargetsNet8)' == 'true'"
steveisok marked this conversation as resolved.
Show resolved Hide resolved
AfterTargets="Publish"
DependsOnTargets="_WorkloadGatherTelemetryData">

<ItemGroup>
<WorkloadPublishProperties Include="TargetPlatformIdentifier" Value="$(TargetPlatformIdentifier)" />
<WorkloadPublishProperties Include="RuntimeIdentifier" Value="$(RuntimeIdentifier)" />
<WorkloadPublishProperties Include="UseMaui" Value="$(UseMaui)" />
<WorkloadPublishProperties Include="BlazorWasm" Value="$(_WorkloadUsesBlazorWasm)" />
<WorkloadPublishProperties Include="WasmSDK" Value="$(_WorkloadUsesWasmSDK)" />
<WorkloadPublishProperties Include="Avalonia" Value="$(_WorkloadUsesAvalonia)" />
<WorkloadPublishProperties Include="Uno" Value="$(_WorkloadUsesUno)" />
<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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we should do in the workloads in xamarin-macios instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but I would prefer if we track this all in one place.

<_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>
<_WorkloadUsesAvalonia Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesAvalonia>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would checking the PackageReference work too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an avalonia ios sample, it'll have Avalonia.iOS as the PackageReference. I think it's simpler to use the referencepath since there's a consistent avalonia.dll.

<_WorkloadUsesUno Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'uno.dll'">true</_WorkloadUsesUno>
</PropertyGroup>
steveisok marked this conversation as resolved.
Show resolved Hide resolved
</Target>
</Project>