Removed LayoutTool.csproj. Reused DownloadPackage.csproj and merged the target from LayoutTool.csproj directly into where it was used in BundledDotnetTools.targets. Added comments to DownloadPackage.csproj.

This commit is contained in:
Michael Yanni 2023-12-12 16:33:10 -08:00
parent 7e94deaa25
commit 049f9653cd
4 changed files with 27 additions and 42 deletions

View file

@ -16,22 +16,35 @@
</ItemGroup>
<Target Name="LayoutBundledTools" DependsOnTargets="SetupBundledComponents">
<PropertyGroup>
<PackageToRestore>%(BundledDotnetTool.Identity)</PackageToRestore>
<PackageVersionToRestore>%(BundledDotnetTool.Version)</PackageVersionToRestore>
<RestoredToolRoot>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)/$(PackageToRestore)/$(PackageVersionToRestore)'))</RestoredToolRoot>
</PropertyGroup>
<ItemGroup>
<BundledToolLayoutProject Include="$(MSBuildThisFileDirectory)LayoutTool.csproj">
<BundledToolLayoutProject Include="$(MSBuildThisFileDirectory)DownloadPackage.csproj">
<!-- For this unique RestoreProjectStyle, see: https://aka.ms/global-tools-nuget -->
<Properties>
PackageToRestore=%(BundledDotnetTool.Identity);
PackageVersionToRestore=%(BundledDotnetTool.Version);
RestoreProjectStyle=DotnetToolReference;
PackageToRestore=$(PackageToRestore);
PackageVersionToRestore=$(PackageVersionToRestore);
TargetFramework=$(TargetFramework);
LayoutFolder=$(SdkOutputDirectory)DotnetTools/
RestoreProjectStyle=DotnetToolReference
</Properties>
</BundledToolLayoutProject>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(BundledToolLayoutProject)">
</MSBuild>
<MSBuild BuildInParallel="False" Projects="@(BundledToolLayoutProject)" />
<ItemGroup>
<BundledToolFiles Include="$(RestoredToolRoot)\**\*.*" />
<BundledToolFiles Remove="$(RestoredToolRoot)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BundledToolFiles)"
DestinationFiles="@(BundledToolFiles->'$(SdkOutputDirectory)DotnetTools/$(PackageToRestore)\$(PackageVersionToRestore)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Condition="'$(PackageToRestore)' != ''" />
</Target>
</Project>

View file

@ -8,6 +8,8 @@
<ItemGroup>
<!-- Use PackageDownload since we don't need to reference the package. -->
<!-- The square brackets for the version constrain restoration to only use that exact version. -->
<!-- See: https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#floating-version-resolutions -->
<PackageDownload Include="$(PackageToRestore)" Version="[$(PackageVersionToRestore)]" />
<!-- Eliminate any package references injected by arcade, since we only want to download a single package. -->
<PackageReference Remove="@(PackageReference)" />

View file

@ -394,7 +394,7 @@
</UrisToDownload>
</ItemGroup>
<DownloadFile Condition=" '@(UrisToDownload)' != '' and %(ShouldDownload)"
<DownloadFile Condition="'@(UrisToDownload)' != '' and %(ShouldDownload)"
Uris="@(UrisToDownload)"
DestinationPath="%(DownloadDestination)" />
@ -403,16 +403,12 @@
<Properties>
PackageToRestore=%(BundledLayoutPackage.PackageName);
PackageVersionToRestore=%(BundledLayoutPackage.PackageVersion);
TargetFramework=%(BundledLayoutPackage.TargetFramework);
LayoutPackageDescription=%(BundledLayoutPackage.Identity)
TargetFramework=%(BundledLayoutPackage.TargetFramework)
</Properties>
</BundledLayoutPackageDownloadProject>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(BundledLayoutPackageDownloadProject)">
</MSBuild>
<MSBuild BuildInParallel="False" Projects="@(BundledLayoutPackageDownloadProject)" />
<ItemGroup>
<!-- Use lowercase package name in package path -->

View file

@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="LayoutTool">
<PropertyGroup>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="$(PackageToRestore)" Version="$(PackageVersionToRestore)" />
</ItemGroup>
<Target Name="LayoutTool" DependsOnTargets="Restore" Condition="'$(PackageToRestore)' != ''">
<PropertyGroup>
<RestoredToolRoot>$([System.IO.Path]::GetFullPath('$(NuGetPackageRoot)/$(PackageToRestore)/$(PackageVersionToRestore)'))</RestoredToolRoot>
</PropertyGroup>
<ItemGroup>
<BundledToolFiles Include="$(RestoredToolRoot)\**\*.*" />
<BundledToolFiles Remove="$(RestoredToolRoot)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BundledToolFiles)"
DestinationFiles="@(BundledToolFiles->'$(LayoutFolder)$(PackageToRestore)\$(PackageVersionToRestore)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>
</Project>