-
Notifications
You must be signed in to change notification settings - Fork 393
Create a new Microsoft.DotNet.SharedFramework.Sdk for creating shared frameworks #5714
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
Changes from 38 commits
72181d3
444612d
6399975
452628d
564617d
97dd8ab
4f6c956
a20bef3
346b896
18ab7fd
30bd1c8
8ace30a
81bd869
4be0523
45610c5
93361f5
c5565a9
3bfd295
81becff
1dd49a1
fe5e51d
f39a4fc
3f1708b
1bd7315
5017235
c1042d3
61cd716
cecd7d7
5145540
51caf02
1c1f463
afcb0de
f4ac87f
fe7640c
82acfe3
8b63d86
2da6aec
bf6c57b
bd6a7e3
304f667
840626f
80aee3c
a5c17c4
4165ccc
93e0577
b31c01f
47b10a6
a46fcaf
4543285
6ece972
9701071
70819f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. --> | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFrameworks>netcoreapp2.1</TargetFrameworks> | ||
| <ExcludeFromSourceBuild>false</ExcludeFromSourceBuild> | ||
|
|
||
| <IsPackable>true</IsPackable> | ||
| <PackTasks>false</PackTasks> | ||
|
|
||
| <Description>Targets for producing an archive of file outputs.</Description> | ||
| <PackageType>MSBuildSdk</PackageType> | ||
|
|
||
| <EnableGeneratedPackageContent>false</EnableGeneratedPackageContent> | ||
| <NoWarn>$(NoWarn);NU5105</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| <Import Project="$(RepoRoot)eng\BuildTask.targets" /> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Microsoft.DotNet.Build.Tasks.Archives | ||
|
|
||
| Targets package for producing zip and tar archives. | ||
|
|
||
| This package generates an archive that can be extracted on top of an existing .NET SDK or Runtime layout. The name of this file is derived from the `ArchiveName` property and the RID. The `ArchiveName` property defaults to the project file name without the extension. This package calls the `PublishToDisk` target on the project to generate the project layout. | ||
|
|
||
| ## Build Skip Support for Unsupported Platforms and Servicing | ||
|
|
||
| This SDK also supports automatically skipping builds on unsupported platforms or in servicing releases. If a project with a list of provided RIDs in `RuntimeIdentifiers` is built with the `RuntimeIdentifier` property set to a RID that is not in the `RuntimeIdentifiers` list, the build will be skipped. This enables cleanly skipping optional packs, installers, or bundles that only exist on specific platforms. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If aspnetcore was going to use this, the "or in servicing releases" bit must be something we could override. We Zip both our shared Fx contributions and our targeting packs. The shared Fx Zips are produced unconditionally. And, we've had multiple 3.1.x releases that had to include updated targeting pack content.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is implemented this way--that targeting pack vs. sharedfx behavior is universal. I think what I landed with in dotnet/runtime etc. is pretty nice if I may say so myself 😄: <!--
Servicing build settings for Setup/Installer packages. Instructions:
* To enable a package build for the current patch release, set PatchVersion to match the current
patch version of that package. ("major.minor.patch".) This is normally the same as
PatchVersion above, but not always. Notably, NETStandard has its own patch version.
* When the PatchVersion property above is incremented at the beginning of the next servicing
release, all packages listed below automatically stop building because the property no longer
matches the metadata. (Do not delete the items!)
If the PatchVersion below is never changed from '0', the package will build in the 'master'
branch, and during a forked RTM release ("X.Y.0"). It will stop building for "X.Y.1" unless
manually enabled by updating the metadata.
-->
<ItemGroup>
<!-- Targeting packs are only patched in extreme cases. -->
<ProjectServicingConfiguration Include="Microsoft.NETCore.App.Ref" PatchVersion="0" />
</ItemGroup> |
||
|
|
||
| Additionally, if a `ProjectServicingConfiguration` item is provided with the identity of the project name and the `PatchVersion` metadata on the item is not equal to the current `PatchVersion`, the build will be skipped. This support enables a repository to disable building targeting packs in servicing releases if that is desired. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| <Project> | ||
| <Target Name="_GetCurrentProjectServicingConfiguration"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this target and
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the Archives, Installer, and SharedFramework packages can all be used independently (and in dotnet/runtime they will be for the host installers and archives), they all need an implementation of the project servicing configuration check. I'd also be ok adding these targets to the Arcade SDK so they're shared there and defined only once. |
||
| <ItemGroup> | ||
| <CurrentProjectServicingConfiguration | ||
| Include="@(ProjectServicingConfiguration)" | ||
| Condition="'%(Identity)' == '$(MSBuildProjectName)'" /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| <!-- | ||
| The Microsoft build's per-package servicing policy conflicts with the source-build restrictions. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, what's "the Microsoft build"❔ If it matters, different repos have different incremental servicing policies e.g. dotnet/runtime services many packages individually while dotnet/aspnetcore only disables the targeting packs in most (wish it were all
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Microsoft build is the one that Microsoft builds--the one that ends up on dot.net, NuGet.org, blob storage (dailies), etc. Non-Microsoft builds would be the ones that Red Hat and Fedora do for their distros, based on source-build. And any other builds from source that we might not even know about. Servicing differences are a known, significant issue. I wrote up a summary doc on the problem at https://github.com/dotnet/source-build/tree/release/3.1/Documentation/planning/nongranular-servicing-readiness with a proposal to add tests to validate that the Microsoft servicing behavior won't wreck the source-built product. (Not implemented.) |
||
| Targeting packs, for example, are only built/published when there's a known change to release. | ||
| This is in contrast to runtime packs and the shared framework, which are always built and | ||
| published. This means it's common in the Microsoft build for downstream repos to depend on two | ||
| builds' outputs: the current build's runtime assets, and some old build's targeting pack. | ||
|
|
||
| The Microsoft build can simply download the old targeting pack from NuGet.org. Source-build | ||
| can't do this because the bits on NuGet.org are not built locally. Instead, source-build assumes | ||
| it's possible to use current sources to build a package with the old version. This target | ||
| applies the old build's patch version to make that happen. | ||
|
|
||
| This solution has pitfalls. More info at https://github.com/dotnet/core-setup/issues/8735. The | ||
| target supports SkipSetLastReleasedVersionForSourceBuild (unused as of writing) to allow | ||
| disabling this workaround if a better way forward is implemented. | ||
| --> | ||
| <Target Name="SetLastReleasedVersionForSourceBuild" | ||
| Condition=" | ||
| '$(DotNetBuildFromSource)' == 'true' and | ||
| '$(SkipSetLastReleasedVersionForSourceBuild)' != 'true'" | ||
| BeforeTargets="GetProductVersions" | ||
| DependsOnTargets="_GetCurrentProjectServicingConfiguration"> | ||
| <PropertyGroup> | ||
| <MostRecentProducedServicingPatchVersion>%(CurrentProjectServicingConfiguration.PatchVersion)</MostRecentProducedServicingPatchVersion> | ||
| <PatchVersion Condition="'$(MostRecentProducedServicingPatchVersion)' != ''">$(MostRecentProducedServicingPatchVersion)</PatchVersion> | ||
| </PropertyGroup> | ||
| </Target> | ||
|
|
||
| <Target Name="_GetSkipArchivesBuildProps" | ||
| DependsOnTargets=" | ||
| _GetCurrentProjectServicingConfiguration; | ||
| SetLastReleasedVersionForSourceBuild"> | ||
| <!-- | ||
| Skip the build if there is an applicable servicing configuration, and the servicing | ||
| configuration indicates this project shouldn't build for this patch version. | ||
| --> | ||
| <PropertyGroup Condition="'@(CurrentProjectServicingConfiguration)' != ''"> | ||
| <SkipArchivesBuild Condition="'%(CurrentProjectServicingConfiguration.PatchVersion)' != '$(PatchVersion)'">true</SkipArchivesBuild> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <_TargetRuntimeIdentifiers Include="$(RuntimeIdentifiers)" /> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(RuntimeIdentifiers)' != '' and '$(RuntimeIdentifier)' != ''"> | ||
| <!-- Avoid building a project when none of the possible RuntimeIdentifiers is the current RuntimeIdentifier. --> | ||
| <_RidInRidList Condition="'%(_TargetRuntimeIdentifiers.Identity)' == '$(RuntimeIdentifier)'">true</_RidInRidList> | ||
| <SkipArchivesBuild Condition="'$(_RidInRidList)' != 'true'">true</SkipArchivesBuild> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition="'$(SkipBuild)' == 'true'"> | ||
| <SkipArchivesBuild>true</SkipArchivesBuild> | ||
| </PropertyGroup> | ||
| </Target> | ||
|
|
||
| <PropertyGroup> | ||
| <ArchiveName Condition="'$(ArchiveName)' == ''">$([System.IO.Path]::GetFileNameWithoutExtension($(MSBuildProjectFile)))</ArchiveName> | ||
| <SymbolsArchiveName Condition="'$(SymbolsArchiveName)' == ''">$(ArchiveName)-symbols</SymbolsArchiveName> | ||
| </PropertyGroup> | ||
|
|
||
| <Target Name="_CreateArchive" | ||
| Condition="'$(SkipArchivesBuild)' != 'true'"> | ||
| <PropertyGroup> | ||
| <_OutputPathRoot>$(IntermediateOutputPath)output/</_OutputPathRoot> | ||
| <_ArchiveFileName>$(ArchiveName)-$(Version)</_ArchiveFileName> | ||
| <_ArchiveFileName Condition="'$(RuntimeIdentifier)' != ''">$(ArchiveName)-$(RuntimeIdentifier)-$(Version)</_ArchiveFileName> | ||
| </PropertyGroup> | ||
| <MSBuild Projects="$(MSBuildProjectFullPath)" | ||
| Targets="PublishToDisk" | ||
| Properties="OutputPath=$(_OutputPathRoot)" /> | ||
|
|
||
| <MakeDir Directories="$(PackageOutputPath)" /> | ||
| <ZipDirectory SourceDirectory="$(_OutputPathRoot)" | ||
| Overwrite="true" | ||
| DestinationFile="$(PackageOutputPath)/$(_ArchiveFileName).zip" | ||
| Condition="$([MSBuild]::IsOSPlatform(Windows))"/> | ||
| <Exec Command="tar -C '$(_OutputPathRoot)' -czf $(PackageOutputPath)/$(_ArchiveFileName).tar.gz ." | ||
| IgnoreExitCode="true" | ||
| IgnoreStandardErrorWarningFormat="true" | ||
| Condition="!$([MSBuild]::IsOSPlatform(Windows))"/> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dotnet/aspnetcore creates aspnetcore-targeting-pack-6.0.0-dev.tar.gz on Windows. We execute ./eng/scripts/InstallTar.ps1 on the CI to cover older versions of Windows (some don't include |
||
| </Target> | ||
|
|
||
| <Target Name="_CreateSymbolsArchive" | ||
| Condition="'$(CreateSymbolsArchive)' == 'true' and '$(SkipArchivesBuild)' != 'true'"> | ||
| <PropertyGroup> | ||
| <_SymbolsOutputPathRoot>$(IntermediateOutputPath)symbols/</_SymbolsOutputPathRoot> | ||
| <_ArchiveFileName>$(SymbolsArchiveName)-$(Version)</_ArchiveFileName> | ||
| <_ArchiveFileName Condition="'$(RuntimeIdentifier)' != ''">$(SymbolsArchiveName)-$(RuntimeIdentifier)-$(Version)</_ArchiveFileName> | ||
| </PropertyGroup> | ||
| <MSBuild Projects="$(MSBuildProjectFullPath)" | ||
| Targets="PublishSymbolsToDisk" | ||
| Properties="SymbolsOutputPath=$(_SymbolsOutputPathRoot)" /> | ||
|
|
||
| <MakeDir Directories="$(PackageOutputPath)" /> | ||
| <ZipDirectory SourceDirectory="$(_SymbolsOutputPathRoot)" | ||
| Overwrite="true" | ||
| DestinationFile="$(PackageOutputPath)/$(_ArchiveFileName).zip" | ||
| Condition="$([MSBuild]::IsOSPlatform(Windows))"/> | ||
| <Exec Command="tar -C '$(_SymbolsOutputPathRoot)' -czf $(PackageOutputPath)/$(_ArchiveFileName).tar.gz ." | ||
| IgnoreExitCode="true" | ||
| IgnoreStandardErrorWarningFormat="true" | ||
| Condition="!$([MSBuild]::IsOSPlatform(Windows))"/> | ||
| </Target> | ||
|
|
||
| <PropertyGroup> | ||
| <BuildDependsOn> | ||
| $(BuildDependsOn); | ||
| _GetSkipArchivesBuildProps; | ||
| _CreateArchive; | ||
| _CreateSymbolsArchive | ||
| </BuildDependsOn> | ||
| </PropertyGroup> | ||
| </Project> | ||
Uh oh!
There was an error while loading. Please reload this page.