Skip to content

Commit 5dd9927

Browse files
authored
Inner loop improvements (#49159)
1 parent c67d9d9 commit 5dd9927

File tree

7 files changed

+47
-19
lines changed

7 files changed

+47
-19
lines changed

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
<PropertyGroup>
3131
<SdkSrcRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src'))</SdkSrcRoot>
32+
<TestHostFolder>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'redist', '$(Configuration)'))</TestHostFolder>
33+
<TestHostDotNetRoot>$([MSBuild]::NormalizeDirectory('$(TestHostFolder)', 'dotnet'))</TestHostDotNetRoot>
34+
<TestHostDotNetTool>$(TestHostDotNetRoot)$([System.IO.Path]::GetFileName('$(DotNetTool)'))</TestHostDotNetTool>
35+
3236
<PackageProjectUrl>https://github.com/dotnet/sdk</PackageProjectUrl>
3337
<PackageLicenseExpression>MIT</PackageLicenseExpression>
3438
<LangVersion>Preview</LangVersion>

src/BuiltInTools/dotnet-watch/dotnet-watch.csproj

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,33 @@
5454
<ProjectReference Include="..\DotNetWatchTasks\DotNetWatchTasks.csproj" PrivateAssets="All" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" UndefineProperties="TargetFramework;TargetFrameworks" OutputItemType="Content" CopyToOutputDirectory="PreserveNewest" />
5555
</ItemGroup>
5656

57+
<!-- Publish dotnet-watch files to the redist testhost folder so that in innerloop, redist doesn't need to be built again. -->
58+
<Target Name="PublishDotnetWatchToTestHost" BeforeTargets="AfterBuild">
59+
<ItemGroup>
60+
<!--
61+
To reduce the size of the SDK, we use the compiler dependencies that are located in the `Roslyn/bincore` location
62+
instead of shipping our own copies in the dotnet-watch tool. These assemblies will be resolved by path in the
63+
dotnet-watch executable.
64+
65+
We make an exception for the Microsoft.CodeAnalysis binaries deployed with the MSBuildWorkspace BuildHosts, since those don't
66+
have any logic to pick up Roslyn from another location. Those can be addressed a different way which tracked in
67+
https://github.com/dotnet/roslyn/issues/70945.
68+
69+
Keep excluded files in sync with the list in GenerateLayout.targets.
70+
-->
71+
<_DotnetWatchInputFile Include="$(TargetDir)**"
72+
Condition="('%(Filename)' != 'Microsoft.CodeAnalysis' and
73+
'%(Filename)' != 'Microsoft.CodeAnalysis.resources' and
74+
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp' and
75+
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp.resources') or
76+
$([MSBuild]::ValueOrDefault('%(FullPath)', '').Contains('BuildHost'))" />
77+
</ItemGroup>
78+
79+
<Copy SourceFiles="@(_DotnetWatchInputFile)"
80+
DestinationFiles="@(_DotnetWatchInputFile->'$(TestHostDotNetRoot)sdk\$(Version)\DotnetTools\dotnet-watch\$(Version)\tools\$(SdkTargetFramework)\any\%(RecursiveDir)%(Filename)%(Extension)')"
81+
SkipUnchangedFiles="true">
82+
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
83+
</Copy>
84+
</Target>
85+
5786
</Project>

src/Layout/redist/targets/OverlaySdkOnLKG.targets

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<Project>
22

3-
<PropertyGroup>
4-
<TestHostFolder>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</TestHostFolder>
5-
</PropertyGroup>
6-
73
<Target Name="OverlaySdkOnLKG" AfterTargets="AfterBuild" DependsOnTargets="GenerateInstallerLayout">
84
<PropertyGroup>
95
<_DotNetHiveRoot>$(DOTNET_INSTALL_DIR)</_DotNetHiveRoot>
@@ -18,12 +14,12 @@
1814
Exclude="$(_DotNetHiveRoot)sdk\**\*;
1915
$(_DotNetHiveRoot)templates\**\*;
2016
$(_DotNetHiveRoot)host\**\*"/>
21-
<OverlaySDKFile Include="@(_OverlaySDKFile->'$(TestHostFolder)%(RecursiveDir)%(Filename)%(Extension)')" Source="%(Identity)" />
17+
<OverlaySDKFile Include="@(_OverlaySDKFile->'$(TestHostDotNetRoot)%(RecursiveDir)%(Filename)%(Extension)')" Source="%(Identity)" />
2218
</ItemGroup>
2319

2420
<ItemGroup>
2521
<_InstallerOutputFile Include="$(RedistInstallerLayoutPath)**\*" />
26-
<InstallerOutputFile Include="@(_InstallerOutputFile->'$(TestHostFolder)%(RecursiveDir)%(Filename)%(Extension)')" Source="%(Identity)" />
22+
<InstallerOutputFile Include="@(_InstallerOutputFile->'$(TestHostDotNetRoot)%(RecursiveDir)%(Filename)%(Extension)')" Source="%(Identity)" />
2723
<!-- Use available live built artifacts instead of stage0 files. -->
2824
<InstallerOutputFile Include="@(OverlaySDKFile)" Exclude="@(InstallerOutputFile)" />
2925
</ItemGroup>
@@ -53,10 +49,10 @@
5349
</ItemGroup>
5450

5551
<Copy SourceFiles="@(WorkloadManifestContent)"
56-
DestinationFiles="@(WorkloadManifestContent->'$(TestHostFolder)sdk-manifests\$(VersionBand)\%(RecursiveDir)%(Filename)%(Extension)')" />
52+
DestinationFiles="@(WorkloadManifestContent->'$(TestHostDotNetRoot)sdk-manifests\$(VersionBand)\%(RecursiveDir)%(Filename)%(Extension)')" />
5753

5854
<Copy SourceFiles="@(WorkloadPackContent)"
59-
DestinationFiles="@(WorkloadPackContent->'$(TestHostFolder)packs\%(RecursiveDir)%(Filename)%(Extension)')" />
55+
DestinationFiles="@(WorkloadPackContent->'$(TestHostDotNetRoot)packs\%(RecursiveDir)%(Filename)%(Extension)')" />
6056
</Target>
6157

6258
</Project>

test/Directory.Build.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<ResultsStdOutPath>@(TestToRun->'%(ResultsStdOutPath)')</ResultsStdOutPath>
6262

6363
<TestArgs>-noautoreporters -noRepoInference</TestArgs>
64-
<TestArgs>$(TestArgs) -dotnetPath $(ArtifactsBinDir)redist\$(Configuration)\dotnet\dotnet</TestArgs>
64+
<TestArgs>$(TestArgs) -dotnetPath $(TestHostDotNetTool)</TestArgs>
6565
<TestArgs>$(TestArgs) -xml "$(ResultsXmlPath)"</TestArgs>
6666
<TestArgs>$(TestArgs) -html "$(ResultsHtmlPath)" $(TestRunnerAdditionalArguments)</TestArgs>
6767
<TestArgs>$(TestArgs) &gt; $(ResultsStdOutPath)</TestArgs>
@@ -70,7 +70,7 @@
7070

7171
<!-- Run "dotnet new" (which will just display usage and available templates) in order to print first time
7272
use message so that it doesn't interfere with tests which check the output of commands. -->
73-
<Exec Command="$(ArtifactsBinDir)redist\$(Configuration)\dotnet\dotnet new" />
73+
<Exec Command="$(TestHostDotNetTool) new" />
7474

7575
<Exec Command="dotnet tool run $(ToolCommandName) -- $(TestArgs)"
7676
WorkingDirectory="$(TestLocalToolFolder)"

test/UnitTests.proj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
<HelixPostCommands Condition="!$(IsPosixShell)">PowerShell -ExecutionPolicy ByPass "dotnet nuget locals all -l | ForEach-Object { $_.Split(' ')[1]} | Where-Object{$_ -like '*cache'} | Get-ChildItem -Recurse -File -Filter '*.dat' | Measure";$(HelixPostCommands)</HelixPostCommands>
136136
<HelixPostCommands Condition="!$(IsPosixShell)">PowerShell -ExecutionPolicy ByPass "Get-ChildItem -Recurse -File -Filter '*hangdump.dmp' | Copy-Item -Destination $env:HELIX_WORKITEM_UPLOAD_ROOT";$(HelixPostCommands)</HelixPostCommands>
137137
<HelixPostCommands Condition="$(IsPosixShell)">find "$HELIX_WORKITEM_UPLOAD_ROOT/../../.." -name '*hangdump.dmp' -exec cp {} "$HELIX_WORKITEM_UPLOAD_ROOT" \%3B;$(HelixPostCommands)</HelixPostCommands>
138-
<TestDotnetRoot>$(RepoRoot)artifacts\bin\redist\$(Configuration)\dotnet</TestDotnetRoot>
139138
<TestDotnetVersion>$(Version)</TestDotnetVersion>
140139
<MSBuildSdkResolverDir>$(RepoRoot)artifacts\bin\Microsoft.DotNet.MSBuildSdkResolver</MSBuildSdkResolverDir>
141140
<HelixStage0Targz>$(RepoRoot)artifacts\tmp\HelixStage0.tar.gz</HelixStage0Targz>
@@ -144,7 +143,7 @@
144143

145144
<TarGzFileCreateFromDirectory
146145
Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' "
147-
SourceDirectory="$(TestDotnetRoot)"
146+
SourceDirectory="$(TestHostDotNetRoot)"
148147
DestinationArchive="$(HelixStage0Targz)"
149148
OverwriteDestination="true" />
150149

@@ -158,8 +157,8 @@
158157
<Destination>d</Destination>
159158
</HelixCorrelationPayload>
160159

161-
<HelixCorrelationPayload Condition="$([MSBuild]::IsOSPlatform(`Windows`))" Include="$(TestDotnetRoot)">
162-
<PayloadDirectory>$(TestDotnetRoot)</PayloadDirectory>
160+
<HelixCorrelationPayload Condition="$([MSBuild]::IsOSPlatform(`Windows`))" Include="$(TestHostDotNetRoot)">
161+
<PayloadDirectory>$(TestHostDotNetRoot)</PayloadDirectory>
163162
<Destination>d</Destination>
164163
</HelixCorrelationPayload>
165164

@@ -174,13 +173,13 @@
174173
</HelixCorrelationPayload>
175174

176175
<HelixCorrelationPayload Include="SDKTestRunPackages.zip">
177-
<PayloadDirectory>$(TestDotnetRoot)</PayloadDirectory>
176+
<PayloadDirectory>$(TestHostDotNetRoot)</PayloadDirectory>
178177
<Destination>d/.nuget</Destination>
179178
<Uri>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/any/sdk-test-assets/SDKTestRunPackages.zip</Uri>
180179
</HelixCorrelationPayload>
181180

182181
<HelixCorrelationPayload Include="SDKTestRunPackages2.zip">
183-
<PayloadDirectory>$(TestDotnetRoot)</PayloadDirectory>
182+
<PayloadDirectory>$(TestHostDotNetRoot)</PayloadDirectory>
184183
<Destination>d/.nuget</Destination>
185184
<Uri>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/any/sdk-test-assets/SDKTestRunPackages2.zip</Uri>
186185
</HelixCorrelationPayload>

test/dotnet.Tests/dotnet.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<!-- Use layout folder for the output folder, to support in-process tests which expect to be running
2020
on a valid layout. -->
21-
<OutputPath>$(ArtifactsBinDir)redist\$(Configuration)</OutputPath>
21+
<OutputPath>$(TestHostFolder)</OutputPath>
2222
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
2323
</PropertyGroup>
2424

@@ -99,7 +99,7 @@
9999

100100
<Target Name="CompareCliSnapshots">
101101
<ItemGroup>
102-
<SnapshotFiles Include="$(ArtifactsBinDir)redist\$(Configuration)\snapshots\**\*.received.*" />
102+
<SnapshotFiles Include="$(TestHostFolder)snapshots\**\*.received.*" />
103103
</ItemGroup>
104104
<Copy SourceFiles="@(SnapshotFiles)" DestinationFolder="$(MSBuildThisFileDirectory)CompletionTests\snapshots\%(RecursiveDir)" SkipUnchangedFiles="true" />
105105
</Target>

test/trustedroots.Tests/trustedroots.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TargetFramework>$(ToolsetTargetFramework)</TargetFramework>
66
<OutputType>Exe</OutputType>
77
<CanRunTestAsTool>false</CanRunTestAsTool>
8-
<OutputPath>$(ArtifactsBinDir)redist\$(Configuration)</OutputPath>
8+
<OutputPath>$(TestHostFolder)</OutputPath>
99
</PropertyGroup>
1010

1111
<ItemGroup>

0 commit comments

Comments
 (0)