Skip to content

Bring back PublishDotnetWatch #48793

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions src/BuiltInTools/dotnet-watch/dotnet-watch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<Import Project="..\HotReloadAgent.PipeRpc\Microsoft.DotNet.HotReload.Agent.PipeRpc.projitems" Label="Shared" />
<Import Project="..\HotReloadAgent.Data\Microsoft.DotNet.HotReload.Agent.Data.projitems" Label="Shared" />

<Import Project="$(RepoRoot)\src\Layout\redist\targets\PublishDotnetWatch.targets" />

<PropertyGroup>
<TargetFramework>$(SdkTargetFramework)</TargetFramework>
<OutputType>exe</OutputType>
Expand Down Expand Up @@ -44,4 +46,11 @@
<ProjectReference Include="..\DotNetWatchTasks\DotNetWatchTasks.csproj" PrivateAssets="All" ReferenceOutputAssembly="false" SkipGetTargetFrameworkProperties="true" UndefineProperties="TargetFramework;TargetFrameworks" OutputItemType="Content" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<!--
Publish the dotnet-watch binaries to the redist directory (artifacts\bin\redist\{config}\dotnet\sdk\{version}\DotnetTools).
These files are used for layout generation in redist project.
Tests are also running dotnet.exe from redist artifacts.
-->
<Target Name="PublishToRedist" DependsOnTargets="PublishDotnetWatchToRedist" BeforeTargets="AfterBuild" />

</Project>
1 change: 1 addition & 0 deletions src/Layout/redist/targets/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<ImportGroup Condition="'$(GenerateSdkBundleOnly)' != 'true'">
<Import Project="BundledSdks.targets" />
<Import Project="PublishDotnetWatch.targets" />
<Import Project="BundledDotnetTools.targets" />
<Import Project="GenerateBundledVersions.targets" />
<Import Project="GeneratePackagePruneData.targets" />
Expand Down
28 changes: 0 additions & 28 deletions src/Layout/redist/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -415,34 +415,6 @@
AssetPath="%(NuPkgContentForMSBuildExtensionsRelativePaths.Identity)" />
</Target>

<Target Name="PublishDotnetWatchToRedist">
<ItemGroup>
<_DotnetWatchBuildOutput Include="$(ArtifactsBinDir)dotnet-watch\$(Configuration)\$(SdkTargetFramework)\**"/>

<!--
To reduce the size of the SDK, we use the compiler dependencies that are located in the `Roslyn/bincore` location
instead of shipping our own copies in the dotnet-watch tool. These assemblies will be resolved by path in the
dotnet-watch executable.

We make an exception for the Microsoft.CodeAnalysis binaries deployed with the MSBuildWorkspace BuildHosts, since those don't
have any logic to pick up Roslyn from another location. Those can be addressed a different way which tracked in
https://github.com/dotnet/roslyn/issues/70945.
-->
<_DotnetWatchInputFile Include="@(_DotnetWatchBuildOutput)"
Condition="('%(Filename)' != 'Microsoft.CodeAnalysis' and
'%(Filename)' != 'Microsoft.CodeAnalysis.resources' and
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp' and
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp.resources') or
$([MSBuild]::ValueOrDefault('%(FullPath)', '').Contains('BuildHost'))" />
</ItemGroup>

<Copy SourceFiles="@(_DotnetWatchInputFile)"
DestinationFiles="@(_DotnetWatchInputFile->'$(OutputPath)\DotnetTools\dotnet-watch\$(Version)\tools\$(SdkTargetFramework)\any\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
</Target>

<Target Name="CopyKnownWorkloadManifestFile">
<ItemGroup>
<WorkloadManifestFilesContent Include="$([MSBuild]::ValueOrDefault('%(BundledManifests.Identity)', '').ToLowerInvariant())" />
Expand Down
34 changes: 34 additions & 0 deletions src/Layout/redist/targets/PublishDotnetWatch.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project>
<Target Name="PublishDotnetWatchToRedist">
<PropertyGroup>
<DotnetWatchRedistOutputDirectory>$(ArtifactsDir)bin\redist\$(Configuration)\dotnet\sdk\$(Version)\DotnetTools\dotnet-watch\</DotnetWatchRedistOutputDirectory>
<DotnetWatchRedistOutputSubdirectory>$(Version)\tools\$(SdkTargetFramework)\any\</DotnetWatchRedistOutputSubdirectory>
</PropertyGroup>

<ItemGroup>
<_DotnetWatchBuildOutput Include="$(ArtifactsDir)bin\dotnet-watch\$(Configuration)\$(SdkTargetFramework)\**"/>

<!--
To reduce the size of the SDK, we use the compiler dependencies that are located in the `Roslyn/bincore` location
instead of shipping our own copies in the dotnet-watch tool. These assemblies will be resolved by path in the
dotnet-watch executable.

We make an exception for the Microsoft.CodeAnalysis binaries deployed with the MSBuildWorkspace BuildHosts, since those don't
have any logic to pick up Roslyn from another location. Those can be addressed a different way which tracked in
https://github.com/dotnet/roslyn/issues/70945.
-->
<_DotnetWatchInputFile Include="@(_DotnetWatchBuildOutput)"
Condition="('%(Filename)' != 'Microsoft.CodeAnalysis' and
'%(Filename)' != 'Microsoft.CodeAnalysis.resources' and
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp' and
'%(Filename)' != 'Microsoft.CodeAnalysis.CSharp.resources') or
$([MSBuild]::ValueOrDefault('%(FullPath)', '').Contains('BuildHost'))" />
</ItemGroup>

<Copy SourceFiles="@(_DotnetWatchInputFile)"
DestinationFiles="@(_DotnetWatchInputFile->'$(DotnetWatchRedistOutputDirectory)$(DotnetWatchRedistOutputSubdirectory)%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true">
<Output TaskParameter="CopiedFiles" ItemName="FileWrites" />
</Copy>
</Target>
</Project>
Loading