|
25 | 25 | <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> |
26 | 26 | <PackagePrimaryLicenseFile>$(RepoRoot)\LICENSE.TXT</PackagePrimaryLicenseFile> |
27 | 27 | <PackageThirdPartyNoticesFile>$(RepoRoot)\THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile> |
| 28 | + <PackageReadmeFile>README.md</PackageReadmeFile> |
| 29 | + <PackageChangelogFile>CHANGELOG.md</PackageChangelogFile> |
| 30 | + <PackageReleaseNotesFile>$(RepoRoot)\RELEASENOTES.md</PackageReleaseNotesFile> |
28 | 31 | </PropertyGroup> |
29 | 32 |
|
30 | 33 | <PropertyGroup Label="SourceLinkProperties"> |
|
57 | 60 | <None Include=".publicApi\**\PublicAPI.*.txt" /> |
58 | 61 | </ItemGroup> |
59 | 62 |
|
60 | | - <Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)'!='' AND '$(BuildNumber)' != ''"> |
| 63 | + <Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)' != '' AND '$(BuildNumber)' != ''"> |
61 | 64 | <!-- Note: $(BuildNumber) is typically only set for builds initiated by the |
62 | 65 | publish workflow. The goal here is to set the assembly FileVersion and |
63 | 66 | resolve ExposeExperimentalFeatures based on the version MinVer resolved from |
|
87 | 90 | <Error Text="Cannot perform package validation without a baseline package version." /> |
88 | 91 | </Target> |
89 | 92 |
|
| 93 | + <Target Name="IncludeReadmeAndReleaseNotesInPackages" BeforeTargets="_GetTargetFrameworksOutput"> |
| 94 | + <!-- Note: This target runs during pack to convert relative links in |
| 95 | + markdowns into github permalinks which will work when rendered on Nuget. --> |
| 96 | + |
| 97 | + <Exec |
| 98 | + Command="git rev-parse HEAD" |
| 99 | + ConsoleToMsBuild="True" |
| 100 | + IgnoreExitCode="True" |
| 101 | + StandardOutputImportance="low"> |
| 102 | + <Output PropertyName="GitCommitConsoleOutput" TaskParameter="ConsoleOutput"/> |
| 103 | + <Output PropertyName="GitCommitExitCode" TaskParameter="ExitCode"/> |
| 104 | + </Exec> |
| 105 | + |
| 106 | + <Exec |
| 107 | + Command="git remote get-url origin" |
| 108 | + ConsoleToMsBuild="True" |
| 109 | + IgnoreExitCode="True" |
| 110 | + StandardOutputImportance="low"> |
| 111 | + <Output PropertyName="GitOriginConsoleOutput" TaskParameter="ConsoleOutput"/> |
| 112 | + <Output PropertyName="GitOriginExitCode" TaskParameter="ExitCode"/> |
| 113 | + </Exec> |
| 114 | + |
| 115 | + <PropertyGroup> |
| 116 | + <MarkdownCommentRegex>\[([^]]+?)\]\(\.(.+?)\)</MarkdownCommentRegex> |
| 117 | + <GitHubRepoUrl>$(GitOriginConsoleOutput.Replace('.git',''))</GitHubRepoUrl> |
| 118 | + <GitHubPermalinkUrl Condition="'$(PackTag)' != ''">$(GitHubRepoUrl)/blob/$(PackTag)</GitHubPermalinkUrl> |
| 119 | + <GitHubPermalinkUrl Condition="'$(PackTag)' == ''">$(GitHubRepoUrl)/blob/$(GitCommitConsoleOutput)</GitHubPermalinkUrl> |
| 120 | + </PropertyGroup> |
| 121 | + |
| 122 | + <Message Importance="high" Text="**GitInformationDebug** GitCommitConsoleOutput: $(GitCommitConsoleOutput), GitCommitExitCode: $(GitCommitExitCode), GitOriginConsoleOutput: $(GitOriginConsoleOutput), GitOriginExitCode: $(GitOriginExitCode), GitHubPermalinkUrl: $(GitHubPermalinkUrl)" /> |
| 123 | + |
| 124 | + <ItemGroup> |
| 125 | + <PackageMarkdownFiles Include="README.md" /> |
| 126 | + </ItemGroup> |
| 127 | + |
| 128 | + <ItemGroup> |
| 129 | + <PackageMarkdownFiles Update="@(PackageMarkdownFiles)" Path="$([MSBuild]::ValueOrDefault('%(FullPath)','').Replace('$(RepoRoot)', '').Replace('%(FileName)%(Extension)', ''))" /> |
| 130 | + </ItemGroup> |
| 131 | + |
| 132 | + <WriteLinesToFile |
| 133 | + File="$(IntermediateOutputPath)%(PackageMarkdownFiles.Filename)%(PackageMarkdownFiles.Extension)" |
| 134 | + Lines="$([System.Text.RegularExpressions.Regex]::Replace($([System.IO.File]::ReadAllText(%(PackageMarkdownFiles.FullPath))), '$(MarkdownCommentRegex)', '[$1]($(GitHubPermalinkUrl)%(PackageMarkdownFiles.Path).$2)').Replace('\', '/'))" |
| 135 | + Overwrite="true" |
| 136 | + Encoding="UTF-8"/> |
| 137 | + |
| 138 | + <PropertyGroup> |
| 139 | + <_PackageReleaseNotesFilePath>$([System.IO.Path]::GetFullPath('$(PackageReleaseNotesFile)').Replace('$(RepoRoot)', '').Replace('\', '/'))</_PackageReleaseNotesFilePath> |
| 140 | + <_PackageChangelogFilePath>$([System.IO.Path]::GetFullPath('$(PackageChangelogFile)').Replace('$(RepoRoot)', '').Replace('\', '/'))</_PackageChangelogFilePath> |
| 141 | + <PackageReleaseNotes> |
| 142 | + For highlights and announcements see: $(GitHubPermalinkUrl)$(_PackageReleaseNotesFilePath). |
| 143 | + |
| 144 | + For detailed changes see: $(GitHubPermalinkUrl)$(_PackageChangelogFilePath). |
| 145 | + </PackageReleaseNotes> |
| 146 | + </PropertyGroup> |
| 147 | + |
| 148 | + <ItemGroup> |
| 149 | + <Content Include="$(IntermediateOutputPath)*.md" PackagePath="/" /> |
| 150 | + </ItemGroup> |
| 151 | + </Target> |
| 152 | + |
90 | 153 | <Target Name="ResolveExposeExperimentalFeatures" BeforeTargets="CoreCompile" DependsOnTargets="AssemblyVersionTarget"> |
91 | 154 | <!-- Note: This runs for all builds. The goal here is to set the |
92 | 155 | EXPOSE_EXPERIMENTAL_FEATURES compiler constant if |
|
0 commit comments