Skip to content

Commit 653e4ac

Browse files
committed
Clean-up in src/Layout/redist
1 parent 140ff5e commit 653e4ac

21 files changed

+96
-204
lines changed

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292

9393
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
9494
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
95+
96+
<SdkLayoutOutputDirectory>$(ArtifactsBinDir)redist\$(Configuration)\layouts\dotnet-toolset-internal\</SdkLayoutOutputDirectory>
9597
</PropertyGroup>
9698

9799
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">

src/Installer/redist-installer/Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
<ProductMonikerRid Condition="'$(ProductMonikerRid)' == ''">$(Rid)</ProductMonikerRid>
2626

2727
<PortableProductMonikerRid Condition="'$(PortableProductMonikerRid)' == ''">$(PortableRid)</PortableProductMonikerRid>
28-
29-
<PgoTerm Condition="'$(PgoInstrument)' == 'true'">-pgo</PgoTerm>
30-
<ArtifactNameSdk>dotnet-sdk-internal$(PgoTerm)</ArtifactNameSdk>
3128
</PropertyGroup>
3229

3330
<PropertyGroup>

src/Installer/redist-installer/Directory.Build.targets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
<PropertyGroup>
1313
<!-- Any properties that depend on Version and are not in a Target must not be defined in Directory.Build.props as Version won't be available yet. -->
14-
<ArtifactNameWithVersionSdk>$(ArtifactNameSdk)-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionSdk>
14+
<PgoTerm Condition="'$(PgoInstrument)' == 'true'">-pgo</PgoTerm>
15+
<ArtifactNameWithVersionSdk>dotnet-sdk-internal$(PgoTerm)-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionSdk>
1516
<ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>dotnet-sdk$(PgoTerm)-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>
1617
<!-- Warning: changing the value "ProductBandCombinedHostHostFxrFrameworkSdkName" can only occur on a product-band boundary [CliProductBandVersion],
1718
Changing "ProductBandCombinedHostHostFxrFrameworkSdkName" mid-product-band will break the upgradability of the SDK bundle installer. -->

src/Installer/redist-installer/targets/GenerateLayout.targets

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,6 @@
375375
DestinationFolder="$(RedistLayoutPath)/library-packs"
376376
SkipUnchangedFiles="true" />
377377

378-
<!-- From Version.targets in SDK redist -->
379-
<PropertyGroup>
380-
<ArtifactNameSdk>dotnet-toolset-internal</ArtifactNameSdk>
381-
</PropertyGroup>
382-
383-
<!-- From GenerateLayout.targets in SDK redist -->
384-
<PropertyGroup>
385-
<SdkLayoutOutputDirectory>$(ArtifactsBinDir)redist\$(Configuration)\layouts\$(ArtifactNameSdk)\</SdkLayoutOutputDirectory>
386-
</PropertyGroup>
387-
388378
<!-- https://github.com/dotnet/msbuild/issues/5881#issuecomment-802492423 -->
389379
<ItemGroup>
390380
<DotnetToolsetInternalSource Include="$(SdkLayoutOutputDirectory)**\*" />

src/Layout/Directory.Build.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project>
2+
3+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
4+
5+
<PropertyGroup>
6+
<OSName Condition="'$(OSName)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win</OSName>
7+
<OSName Condition="'$(OSName)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx</OSName>
8+
<OSName Condition="'$(OSName)' == '' ">linux</OSName>
9+
<Rid Condition="'$(Rid)' == ''">$(OSName)-$(Architecture)</Rid>
10+
</PropertyGroup>
11+
12+
</Project>

src/Layout/redist/redist.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818
</PropertyGroup>
1919

2020
<Import Project="$(RepoRoot)src\Tasks\sdk-tasks\sdk-tasks.InTree.targets" />
21-
<Import Project="targets\GetRuntimeInformation.targets" />
22-
<Import Project="targets\Version.targets" />
2321
<Import Project="targets\BundledSdks.targets" />
2422
<Import Project="targets\BundledTools.targets" />
2523
<Import Project="targets\PublishDotnetWatch.targets" />
2624
<Import Project="targets\GenerateLayout.targets" />
2725
<Import Project="targets\OverlaySdkOnLKG.targets" Condition="'$(DotNetBuild)' != 'true'" />
28-
<Import Project="targets\MSBuildExtensions.targets" />
2926

3027
<ItemGroup>
3128
<PackageReference Include="NuGet.Build.Tasks" />

src/Layout/redist/targets/BundledSdks.targets

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project>
2+
23
<ItemGroup>
34
<BundledSdk Include="NuGet.Build.Tasks.Pack" Version="$(NuGetBuildTasksPackPackageVersion)" />
45
<BundledSdk Include="Microsoft.NET.Sdk.WindowsDesktop" Version="$(MicrosoftNETSdkWindowsDesktopPackageVersion)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
@@ -12,4 +13,38 @@
1213
<BundledSdk Include="Microsoft.SourceLink.GitLab" Version="$(MicrosoftSourceLinkGitLabVersion)" />
1314
<BundledSdk Include="Microsoft.SourceLink.Bitbucket.Git" Version="$(MicrosoftSourceLinkBitBucketGitVersion)" />
1415
</ItemGroup>
16+
17+
<!-- Restore bundled sdks -->
18+
<ItemGroup>
19+
<PackageDownload Include="@(BundledSdk)" Version="[%(Version)]" />
20+
</ItemGroup>
21+
22+
<Target Name="PublishSdks">
23+
<ItemGroup>
24+
<BundledSdk SdkLayoutDirectory="$(OutputPath)Sdks\%(Identity)\"
25+
PackageNameLowercase="$([System.String]::new('%(Identity)').ToLowerInvariant())" />
26+
<BundledSdk NuPkgPath="$(NuGetPackageRoot)%(PackageNameLowercase)\%(Version)\" />
27+
</ItemGroup>
28+
29+
<Error Text="Bundled SDK has not been restored yet: '%(BundledSdk.NuPkgPath)%(BundledSdk.PackageNameLowercase).nuspec'"
30+
Condition="!Exists('%(BundledSdk.NuPkgPath)%(BundledSdk.PackageNameLowercase).nuspec')" />
31+
32+
<ItemGroup>
33+
<SdkContent Include="%(BundledSdk.NuPkgPath)**\*"
34+
Exclude="%(BundledSdk.NuPkgPath)Icon.png;
35+
%(BundledSdk.NuPkgPath)%(BundledSdk.PackageNameLowercase).nuspec;
36+
%(BundledSdk.NuPkgPath)%(BundledSdk.PackageNameLowercase).%(BundledSdk.Version).nupkg;
37+
%(BundledSdk.NuPkgPath)%(BundledSdk.PackageNameLowercase).%(BundledSdk.Version).nupkg.sha512;
38+
%(BundledSdk.NuPkgPath)**\*.nupkg.metadata;
39+
%(BundledSdk.NuPkgPath)**\*.signature.p7s"
40+
SdkLayoutDirectory="%(BundledSdk.SdkLayoutDirectory)" />
41+
</ItemGroup>
42+
43+
<Copy SourceFiles="@(SdkContent)"
44+
DestinationFiles="@(SdkContent->'%(SdkLayoutDirectory)%(RecursiveDir)%(FileName)%(Extension)')"
45+
SkipUnchangedFiles="true" />
46+
47+
<Message Text="Copied Sdk '%(BundledSdk.Identity)' from '%(BundledSdk.NuPkgPath)' to '%(BundledSdk.SdkLayoutDirectory)'." Importance="High" />
48+
</Target>
49+
1550
</Project>

src/Layout/redist/targets/BundledTools.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project>
2+
23
<ItemGroup>
34
<BundledTools Include="MSBuild;
45
dotnet;
@@ -9,4 +10,5 @@
910
tool_cli;
1011
redist;" />
1112
</ItemGroup>
13+
1214
</Project>

src/Layout/redist/targets/GenerateLayout.targets

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@
66

77
<Target Name="PublishPortableRuntimeIdentifierGraph"
88
BeforeTargets="Build">
9-
109
<Copy SourceFiles="$(NuGetPackageRoot)/microsoft.netcore.platforms/$(MicrosoftNETCorePlatformsPackageVersion)/runtime.json"
1110
DestinationFiles="$(OutputPath)RuntimeIdentifierGraph.json"
1211
SkipUnchangedFiles="true" />
1312

1413
<Copy SourceFiles="$(NuGetPackageRoot)/microsoft.netcore.platforms/$(MicrosoftNETCorePlatformsPackageVersion)/PortableRuntimeIdentifierGraph.json"
1514
DestinationFolder="$(OutputPath)"
1615
SkipUnchangedFiles="true" />
17-
1816
</Target>
1917

2018
<Target Name="PublishVersionFile"
2119
BeforeTargets="Build">
22-
2320
<WriteLinesToFile File="$(OutputPath)/.toolsetversion"
2421
Lines="$(SourceRevisionId);$(Version);$(Rid)"
2522
Overwrite="true" />
@@ -35,8 +32,6 @@
3532
The resolution of the product version (https://github.com/dotnet/sdk/blob/main/src/Cli/Microsoft.DotNet.Cli.Utils/DotnetFiles.cs#L21)
3633
then need the version file there as well. -->
3734
<Copy SourceFiles="$(OutputPath)/.version" DestinationFiles="$(BaseOutputPath)$(Configuration)/.version" SkipUnchangedFiles="true" />
38-
39-
4035
</Target>
4136

4237
<Target Name="PublishRoslyn"
@@ -57,7 +52,7 @@
5752

5853
<Target Name="PublishNETAnalyzers"
5954
BeforeTargets="Build;PublishNetSdk">
60-
<PropertyGroup>
55+
<PropertyGroup>
6156
<AnalyzerAssembliesDirectory>$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk\analyzers</AnalyzerAssembliesDirectory>
6257
<AnalyzerTargetsDirectory>$(AnalyzerAssembliesDirectory)\build</AnalyzerTargetsDirectory>
6358
<AnalyzerConfigDirectory>$(AnalyzerTargetsDirectory)\config</AnalyzerConfigDirectory>
@@ -123,12 +118,27 @@
123118
<Copy SourceFiles="@(DotnetFormatConfigFiles)" DestinationFiles="@(DotnetFormatConfigFiles->'$(DotnetFormatDestinationDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
124119
</Target>
125120

126-
<Target Name="PublishMSBuildExtensions"
127-
DependsOnTargets="GenerateMSBuildExtensions"
128-
BeforeTargets="Build">
121+
<Target Name="PublishMSBuildExtensions">
122+
<PropertyGroup>
123+
<MSBuildExtensionsPackageName>Microsoft.NET.Build.Extensions</MSBuildExtensionsPackageName>
124+
<MSBuildExtensionsVersionSubfolder>Current</MSBuildExtensionsVersionSubfolder>
125+
<MSBuildExtensionsSourceRoot>$(ArtifactsBinDir)$(Configuration)\Sdks\$(MSBuildExtensionsPackageName)</MSBuildExtensionsSourceRoot>
126+
</PropertyGroup>
127+
128+
<ItemGroup>
129+
<!-- Include MSBuild imports that are checked into repo -->
130+
<MSBuildExtensionsContent Include="$(MSBuildProjectDirectory)/MSBuildImports/**/*" />
131+
<MSBuildExtensionsContent Include="$(MSBuildExtensionsSourceRoot)\msbuildExtensions\**\*.*" />
132+
133+
<!-- Don't include .NET Framework MS.NET.Build.Extensions tasks in CLI layout -->
134+
<MSBuildExtensionsContent Remove="$(MSBuildExtensionsSourceRoot)\msbuildExtensions\Microsoft\Microsoft.NET.Build.Extensions\tools\net472\**" />
135+
136+
<MSBuildExtensionsContent Include="$(MSBuildExtensionsSourceRoot)\msbuildExtensions-ver\**\*.*"
137+
DeploymentSubpath="$(MSBuildExtensionsVersionSubfolder)/" />
138+
</ItemGroup>
139+
129140
<Copy SourceFiles="@(MSBuildExtensionsContent)"
130141
DestinationFiles="@(MSBuildExtensionsContent->'$(OutputPath)\%(DeploymentSubpath)\%(RecursiveDir)%(Filename)%(Extension)')" />
131-
132142
</Target>
133143

134144
<Target Name="PublishNetSdks"
@@ -396,34 +406,6 @@
396406
AssetPath="%(NuPkgContentForMSBuildExtensionsRelativePaths.Identity)" />
397407
</Target>
398408

399-
<Target Name="PublishSdks"
400-
AfterTargets="Build">
401-
<ItemGroup>
402-
<SdksToBundle Include="targets\RestoreDependency.proj">
403-
<Properties>
404-
NuGetPackageRoot=$(NuGetPackageRoot);
405-
SdkLayoutDirectory=$(OutputPath)/Sdks/%(BundledSdk.Identity);
406-
DependencyPackageName=%(BundledSdk.Identity);
407-
DependencyPackageVersion=%(BundledSdk.Version);
408-
PreviousStageDirectory=$(PreviousStageDirectory)
409-
</Properties>
410-
</SdksToBundle>
411-
</ItemGroup>
412-
413-
<MSBuild
414-
BuildInParallel="False"
415-
Projects="@(SdksToBundle)">
416-
</MSBuild>
417-
418-
<!-- The WPF SDK .nupkg includes some files in the root that we don't want to bundle, so delete them -->
419-
<ItemGroup>
420-
<SDKFilesToDelete Include="$(OutputPath)/Sdks/Microsoft.NET.Sdk.Wpf/*" />
421-
<SDKFilesToDelete Include="$(OutputPath)/Sdks/**/*.nupkg.metadata" />
422-
<SDKFilesToDelete Include="$(OutputPath)/Sdks/**/*.signature.p7s" />
423-
</ItemGroup>
424-
<Delete Files="@(SDKFilesToDelete)" />
425-
</Target>
426-
427409
<Target Name="ChmodPublishDir"
428410
AfterTargets="GenerateCliRuntimeConfigurationFiles"
429411
Condition=" '$(OSName)' != 'win' ">
@@ -487,10 +469,6 @@
487469
RetargetTools;
488470
GetDotnetWatchRedistOutputDirectory"
489471
AfterTargets="Build">
490-
<PropertyGroup>
491-
<SdkLayoutOutputDirectory>$(BaseOutputPath)$(Configuration)\layouts\$(ArtifactNameSdk)</SdkLayoutOutputDirectory>
492-
</PropertyGroup>
493-
494472
<ItemGroup>
495473
<ToolsetLayoutInput Include="$(OutputPath)/**/*" />
496474
<!-- Include redist outputs published by dotnet-watch.csproj build. -->

src/Layout/redist/targets/GetRuntimeInformation.targets

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)