Skip to content

Commit

Permalink
Add a flag to enable NuGet.org README.md display (Azure#21157)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Jun 21, 2021
1 parent 69e5271 commit 09cc00a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- Install VS 2019 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
- Need at least .NET Framework 4.6.1 and 4.7 development tools
- Install the **.NET Core cross-platform development** workloads in VisualStudio
- Install **.NET Core 5.0.200 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/5.0)
- Install **.NET Core 5.0.301 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/5.0)
- Install the latest version of git (https://git-scm.com/downloads)
- Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 6 or higher, if you plan to make public API changes or are working with generated code snippets.
- Install [NodeJS](https://nodejs.org/) (14.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).
Expand Down
32 changes: 29 additions & 3 deletions eng/Directory.Build.Common.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="Versioning.targets" />

<Target Name="ValidateTargetFrameworks" BeforeTargets="Build">
<ItemGroup>
<RequiredTargetFrameworks Include="$(RequiredTargetFrameworks)" />
Expand Down Expand Up @@ -43,6 +46,32 @@
<Exec ConsoleToMSBuild="true" Command="$(PowerShellExe) -NoProfile -NonInteractive -executionpolicy Unrestricted -File $(CodeChecksScriptPath) -ProjectDirectory $(MSBuildProjectDirectory)"/>
</Target>

<PropertyGroup>
<OriginalReadmeMdPath>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)/../))README.md</OriginalReadmeMdPath>
<ProcessedReadmeMdPath>$(IntermediateOutputPath)README.md</ProcessedReadmeMdPath>
<EnableNuGetReadmeMd Condition="'$(HasReleaseVersion)' == 'false' and Exists('$(OriginalReadmeMdPath)')">true</EnableNuGetReadmeMd>
<PackageReadmeFile Condition="'$(EnableNuGetReadmeMd)' == 'true'">README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<None Condition="'$(EnableNuGetReadmeMd)' != 'true' and Exists('$(OriginalReadmeMdPath)')" Include="$(OriginalReadmeMdPath)" Pack="true" PackagePath="/"/>
<None Condition="'$(EnableNuGetReadmeMd)' == 'true'" Include="$(ProcessedReadmeMdPath)" Pack="true" PackagePath="/"/>
</ItemGroup>

<!-- Process and pack README.md -->
<Target Name="ProcessReadmeMd" BeforeTargets="GenerateNuspec" Condition="'$(EnableNuGetReadmeMd)' == 'true'" >
<PropertyGroup>
<_ReadmeMdLines>$([System.IO.File]::ReadAllText($(OriginalReadmeMdPath)))</_ReadmeMdLines>

<!-- remove comments https://github.com/NuGet/NuGetGallery/issues/8627 -->
<_ReadmeMdLines><![CDATA[$([System.Text.RegularExpressions.Regex]::Replace('$(_ReadmeMdLines)', '\<\!--.*?-->', ''))]]></_ReadmeMdLines>
<!-- remove impressions image -->
<_ReadmeMdLines><![CDATA[$([System.Text.RegularExpressions.Regex]::Replace('$(_ReadmeMdLines)', '\!\[Impressions\]\(.*?\)', ''))]]></_ReadmeMdLines>
</PropertyGroup>

<WriteLinesToFile File="$(ProcessedReadmeMdPath)" Lines="$(_ReadmeMdLines)" Overwrite="true" WriteOnlyWhenDifferent="true" />
</Target>

<!-- This allows us to build .NET Framework targets on non-windows
TODO: Move the NETFramework reference assemblies to a feed other then the roslyn feed.
-->
Expand All @@ -68,7 +97,6 @@
<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<None Include="$(PackageIconPath)" Pack="true" PackagePath=""/>
<None Condition="Exists('$(MSBuildProjectDirectory)/../CHANGELOG.md')" Include="$(MSBuildProjectDirectory)/../CHANGELOG.md" Pack="true" PackagePath=""/>
<None Condition="Exists('$(MSBuildProjectDirectory)/../README.md')" Include="$(MSBuildProjectDirectory)/../README.md" Pack="true" PackagePath=""/>
</ItemGroup>

<!-- Add App.config to enable server GC in net461 perf and stress projects -->
Expand Down Expand Up @@ -103,8 +131,6 @@

<Import Project="$(DefaultReferenceTargets)" Condition="Exists('$(DefaultReferenceTargets)') And '$(ImportDefaultReferences)'=='true'" />

<Import Project="Versioning.targets" />

<Import Project="ApiListing.targets" />

<Import Project="CodeCoverage.targets" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Microsoft.Build.Traversal": "1.0.45"
},
"sdk": {
"version": "5.0.200",
"version": "5.0.301",
"rollForward": "feature"
}
}
3 changes: 3 additions & 0 deletions sdk/template/Azure.Template/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release History

## 1.0.3-beta.19 (2020-09-24)
- Test Submit-PR

## 1.0.3-beta.18 (2020-09-24)
- Test Submit-PR

Expand Down

0 comments on commit 09cc00a

Please sign in to comment.