Skip to content

Commit

Permalink
Enable repackaging of NETStandard 2.1 Targeting Pack (#101518)
Browse files Browse the repository at this point in the history
* Initial changes

* Enable building in 8.0.6 release
  • Loading branch information
NikolaMilosavljevic committed Apr 30, 2024
1 parent 1907984 commit c67a2e4
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' != 'Mono'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Crossgen2.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-host.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-hostfxr.proj" />
<SharedFrameworkProjectToBuild Condition="'$(BuildNETStandard21TargetingPack)' == 'true' and '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\netstandard2.1.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\sfx\installers\dotnet-runtime-deps\*.proj" />
<SharedFrameworkProjectToBuild Condition="'$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)'" Include="$(InstallerProjectRoot)pkg\archives\dotnet-nethost.proj" />
<SharedFrameworkProjectToBuild Condition="'$(MonoCrossAOTTargetOS)' != ''" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\monocrossaot.sfxproj" Pack="true" />
Expand Down
8 changes: 8 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,12 @@
<MicrosoftDotnetSdkInternalVersion>8.0.101</MicrosoftDotnetSdkInternalVersion>
<SdkVersionForWorkloadTesting>$(MicrosoftDotnetSdkInternalVersion)</SdkVersionForWorkloadTesting>
</PropertyGroup>
<PropertyGroup>
<!--
Targeting pack package for NETStandard 2.1 gets rebuilt on demand.
Set to rebuild with 8.0.6 release, and automatically disabled after that.
-->
<BuildNETStandard21TargetingPack Condition="'$(PatchVersion)' == '6'">true</BuildNETStandard21TargetingPack>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions src/installer/pkg/sfx/installers.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<InstallerProjectReference Include="installers/dotnet-runtime-deps/dotnet-runtime-deps-sles.12.proj" />
</ItemGroup>

<ItemGroup Condition="'$(BuildNETStandard21TargetingPack)' == 'true' and '$(BuildRpmPackage)' == 'true'">
<InstallerProjectReference Include="installers/netstandard2.1.proj" />
</ItemGroup>

<Target Name="BuildInstallerProjects" BeforeTargets="Build">
<MSBuild Projects="@(InstallerProjectReference)"
Targets="GenerateInstallers"
Expand Down
60 changes: 60 additions & 0 deletions src/installer/pkg/sfx/installers/netstandard2.1.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<SkipBuild Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)' or '$(TargetsMobile)' == 'true'">true</SkipBuild>
<GenerateInstallers>true</GenerateInstallers>
<InstallerName>netstandard-targeting-pack-2.1</InstallerName>
<PackageBrandNameSuffix>NETStandard.Library.Ref</PackageBrandNameSuffix>
<ProductBrandName>NETStandard.Library.Ref 2.1.0</ProductBrandName>
<VersionInstallerName>false</VersionInstallerName>
<PlatformPackageType>ToolPack</PlatformPackageType>
<UseBrandingNameInLinuxPackageDescription>true</UseBrandingNameInLinuxPackageDescription>
<OriginalNETStandard21PkgFilename>netstandard-targeting-pack-2.1.0-x64.rpm</OriginalNETStandard21PkgFilename>
<NETStandard21PkgDownloadUrl>https://dotnetcli.blob.core.windows.net/dotnet/Runtime/3.1.0/$(OriginalNETStandard21PkgFilename)</NETStandard21PkgDownloadUrl>
<NETStandard21TempDir>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', 'download'))</NETStandard21TempDir>
<NETStandard21PkgDestinationPath>$(NETStandard21TempDir)$(OriginalNETStandard21PkgFilename)</NETStandard21PkgDestinationPath>
<NETStandard21PkgDownloadSemaphore>$(NETStandard21TempDir)netstandard21.semaphore</NETStandard21PkgDownloadSemaphore>
</PropertyGroup>

<UsingTask TaskName="DownloadFile" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />

<Target Name="AcquireNETStandard21PackageContents"
Inputs="$(NETStandard21PkgDestinationPath)"
Outputs="$(NETStandard21PkgDownloadSemaphore)">

<RemoveDir Directories="$(NETStandard21TempDir)" />

<DownloadFile
Uri="$(NETStandard21PkgDownloadUrl)"
DestinationPath="$(NETStandard21PkgDestinationPath)"
Overwrite="true"
TimeoutInSeconds="9999" />

<Exec Command="rpm2cpio $(NETStandard21PkgDestinationPath) | cpio -idmv"
WorkingDirectory="$(NETStandard21TempDir)" />

<WriteLinesToFile
File="$(NETStandard21PkgDownloadSemaphore)"
Lines="$(NETStandard21PkgDownloadUrl)"
Overwrite="true"
Encoding="Unicode" />

</Target>

<Target Name="PublishToDisk"
DependsOnTargets="AcquireNETStandard21PackageContents">
<Error Condition="'$(OutputPath)' == ''" Text="Publishing to disk requires the OutputPath to be set to the root of the path to write to." />

<ItemGroup>
<Content Include="$(NETStandard21TempDir)usr/share/dotnet/**/*" />
</ItemGroup>

<Copy SourceFiles="@(Content)"
DestinationFolder="$(OutputPath)/%(RecursiveDir)" />
</Target>

<Target Name="AddLinuxPackageInformation" BeforeTargets="GetRpmInstallerJsonProperties">
<ItemGroup>
<RpmJsonProperty Include="directories" Object="[ &quot;/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0&quot;, &quot;/usr/share/doc/netstandard-targeting-pack-2.1&quot; ]" />
</ItemGroup>
</Target>
</Project>

0 comments on commit c67a2e4

Please sign in to comment.