Skip to content

Commit 7be1038

Browse files
committed
[ProfiledAot] Update profiled aot proj
1 parent dc540b3 commit 7be1038

File tree

1 file changed

+48
-11
lines changed

1 file changed

+48
-11
lines changed

src/profiled-aot/build.proj

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
1-
<Project DefaultTargets="Record">
1+
<Project DefaultTargets="LegacyRecordProfile">
22
<Import Project="Directory.Build.props" />
33
<PropertyGroup>
4-
<!-- The template name -->
5-
<App Condition=" '$(App)' == '' ">android</App>
6-
<RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == '' ">android-arm64</RuntimeIdentifier>
4+
<App Condition="'$(App)' == ''">android</App>
75
<Intermediate>obj/$(App)/</Intermediate>
86
<CSProj>$(Intermediate)$(App).csproj</CSProj>
7+
<RuntimeIdentifier Condition=" '$(RuntimeIdentifier)' == '' ">android-arm64</RuntimeIdentifier>
8+
<_RecordProfileDependsOnTargets>
9+
_CheckDiagnosticsTools;
10+
_SetupAppForProfiling;
11+
_Restore;
12+
</_RecordProfileDependsOnTargets>
13+
<_LegacyRecordProfileDependsOnTargets>
14+
_SetupAppForProfiling;
15+
_Restore;
16+
</_LegacyRecordProfileDependsOnTargets>
917
</PropertyGroup>
10-
<Target Name="Record">
11-
<RemoveDir Directories="$(Intermediate)" />
12-
<Exec Command="&quot;$(DotNetPreviewTool)&quot; new $(App) -o $(Intermediate)" EnvironmentVariables="DOTNET_MULTILEVEL_LOOKUP=0" />
13-
<!-- Copy replacement files-->
18+
19+
<Target Name="_CheckDiagnosticsTools">
20+
<Exec Command="$(DotNetPreviewTool) tool list -g | grep dotnet-trace" ContinueOnError="true">
21+
<Output TaskParameter="ExitCode" PropertyName="TraceToolInstalled" />
22+
</Exec>
23+
<Error Condition="'$(TraceToolInstalled)' != '0'" Text="dotnet-trace tool is not installed. Please install it using 'dotnet tool install -g dotnet-trace'." />
24+
25+
<Exec Command="$(DotNetPreviewTool) tool list -g | grep dotnet-dsrouter" ContinueOnError="true">
26+
<Output TaskParameter="ExitCode" PropertyName="DsRouterToolInstalled" />
27+
</Exec>
28+
<Error Condition="'$(DsRouterToolInstalled)' != '0'" Text="dotnet-dsrouter tool is not installed. Please install it using 'dotnet tool install -g dotnet-dsrouter'." />
29+
</Target>
30+
31+
<Target Name="_SetupAppForProfiling">
32+
<PropertyGroup>
33+
<EnvVars>DOTNET_MULTILEVEL_LOOKUP=0</EnvVars>
34+
</PropertyGroup>
1435
<ItemGroup>
15-
<_FilesToCopy Include="$(App)/*" />
36+
<_FilesToCopy Include="src/$(App)/*" />
1637
</ItemGroup>
38+
39+
<RemoveDir Directories="$(Intermediate)" />
40+
41+
<Exec Command="$(DotNetPreviewTool) new $(App) -o $(Intermediate)" EnvironmentVariables="$(EnvVars)" />
42+
43+
<!-- Copy replacement files-->
1744
<Copy SourceFiles="@(_FilesToCopy)" DestinationFolder="$(Intermediate)" />
18-
<!-- Restore as a separate step due to: https://github.com/dotnet/sdk/issues/21877 -->
45+
</Target>
46+
47+
<!-- Restore as a separate step due to: https://github.com/dotnet/sdk/issues/21877 -->
48+
<Target Name="_Restore" DependsOnTargets="_SetupAppForProfiling">
1949
<MSBuild Projects="$(CSProj)" Targets="Restore" />
20-
<MSBuild Projects="$(CSProj)" Targets="Record" Properties="App=$(App);RuntimeIdentifier=$(RuntimeIdentifier)" />
50+
</Target>
51+
52+
<Target Name="RecordProfile" DependsOnTargets="$(_RecordProfileDependsOnTargets)">
53+
<MSBuild Projects="$(CSProj)" Targets="Record" Properties="App=$(App);RuntimeIdentifier=$(RuntimeIdentifier);AndroidEnableProfiler=true" />
54+
</Target>
55+
56+
<Target Name="LegacyRecordProfile" DependsOnTargets="$(_LegacyRecordProfileDependsOnTargets)">
57+
<MSBuild Projects="$(CSProj)" Targets="LegacyRecord" Properties="App=$(App);RuntimeIdentifier=$(RuntimeIdentifier)" />
2158
</Target>
2259
</Project>

0 commit comments

Comments
 (0)