Skip to content

Commit

Permalink
Add Humanizer.Core
Browse files Browse the repository at this point in the history
This is https://github.com/Humanizr/Humanizer (different from
https://github.com/Humanizer/Humanizer !)

Humanizer shows up as a dependency of ASP.NET Core and roslyn-analyzers.
This tries to fix that. Supposedly it also ships with the SDK.

Fixes: dotnet#1767
  • Loading branch information
omajid committed Nov 19, 2020
1 parent 25deb0c commit 0de1500
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 2 deletions.
5 changes: 5 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,10 @@
<Uri>https://github.com/dotnet/cssparser</Uri>
<Sha>d6d86bcd8c162b1ae22ef00955ff748d028dd0ee</Sha>
</Dependency>
<Dependency Name="Humanizer.Core" Version="2.2.0">
<Uri>https://github.com/Humanizr/Humanizer</Uri>
<Sha>b30550eed103a6970d8465fe7c5c16300b70be81</Sha>
<RepoName>humanizer</RepoName>
</Dependency>
</ProductDependencies>
</Dependencies>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
From a7a9cea5471babcf1055f1552f0946dda8927c40 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Tue, 17 Nov 2020 13:14:19 -0500
Subject: [PATCH] Fix building in a source-build context

The GitVersionTask is not compatible with .NET Core. So disable it and
use an explicit PackageVersion.

The NuGet feed points to something that returns an error for me. So just
disable it for now.

Disable SourceLink.Create.CommandLine since upstream is dead and we dont
really need it for now.
---
src/Humanizer/Humanizer.csproj | 5 ++---
src/NuGet.config | 5 ++++-
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/Humanizer/Humanizer.csproj b/src/Humanizer/Humanizer.csproj
index 842a373..e018285 100644
--- a/src/Humanizer/Humanizer.csproj
+++ b/src/Humanizer/Humanizer.csproj
@@ -3,6 +3,7 @@
<TargetFramework>netstandard1.0</TargetFramework>
<Authors>Mehdi Khalili, Oren Novotny</Authors>
<PackageLicenseUrl>https://raw.githubusercontent.com/Humanizr/Humanizer/master/LICENSE</PackageLicenseUrl>
+ <PackageVersion>2.2.0</PackageVersion>
<PackageProjectUrl>https://github.com/Humanizr/Humanizer</PackageProjectUrl>
<MinClientVersion>2.12</MinClientVersion>
<Description>A micro-framework that turns your normal strings, type names, enum fields, date fields ETC into a human friendly format</Description>
@@ -16,7 +17,5 @@
</PropertyGroup>

<ItemGroup>
- <PackageReference Include="GitVersionTask" Version="4.0.0-beta0011" PrivateAssets="All" />
- <PackageReference Include="SourceLink.Create.CommandLine" Version="2.1.1" PrivateAssets="All" />
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/NuGet.config b/src/NuGet.config
index be02089..2fb8ff3 100644
--- a/src/NuGet.config
+++ b/src/NuGet.config
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
+ <!--
+ This feed gives an error: Feed does not exist.
<add key="CI Builds (Humanizer)" value="https://www.myget.org/F/humanizer/api/v3/index.json" />
+ -->
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
-</configuration>
\ No newline at end of file
+</configuration>
--
2.26.2

1 change: 1 addition & 0 deletions repos/aspnetcore.proj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<RepositoryReference Include="runtime" />
<RepositoryReference Include="msbuild" />
<RepositoryReference Include="roslyn" />
<RepositoryReference Include="roslyn-analyzers" />
</ItemGroup>

<ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions repos/humanizer.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<Project>

<PropertyGroup>
<SourceDirectory>Humanizer</SourceDirectory>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<PackagesOutput>$(ProjectDirectory)/src/Humanizer/bin/$(Configuration)</PackagesOutput>
<RepoApiImplemented>false</RepoApiImplemented>
<DeterministicBuildOptOut>true</DeterministicBuildOptOut>
<NuGetConfigFile>$(ProjectDirectory)/src/NuGet.config</NuGetConfigFile>
</PropertyGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<ItemGroup>
<!-- Humanizer needs SourceLink.Create.CommandLine which is not produced from sourcelink repo
<RepositoryReference Include="sourcelink" />
-->
</ItemGroup>

<Target Name="RepoBuild">
<PropertyGroup>
<BuildCommandArgs>$(ProjectDirectory)src/Humanizer/Humanizer.csproj</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:Configuration=$(Configuration)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
</PropertyGroup>

<Exec Command="$(DotnetToolCommand) restore /bl:restore.binlog $(BuildCommandArgs) "
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />

<Exec Command="$(DotnetToolCommand) build /bl:build.binlog $(BuildCommandArgs)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />

<Exec Command="$(DotnetToolCommand) pack $(ProjectDirectory)src/Humanizer/Humanizer.csproj /p:NuspecFile=$(ProjectDirectory)NuSpecs/Humanizer.Core.nuspec /p:NuspecBasePath=$(ProjectDirectory)src/ /p:NuspecProperties=Version=2.2.0 /p:Configuration=$(Configuration)"
EnvironmentVariables="@(EnvironmentVariables)"
WorkingDirectory="$(ProjectDirectory)"
IgnoreStandardErrorWarningFormat="true" />
</Target>

</Project>
1 change: 1 addition & 0 deletions repos/roslyn.proj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<ItemGroup>
<RepositoryReference Include="arcade" />
<RepositoryReference Include="command-line-api" />
<RepositoryReference Include="humanizer" />
<RepositoryReference Include="xliff-tasks" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion tools-local/prebuilt-baseline-offline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
<Usage Id="runtime.unix.System.Runtime.Extensions" Version="4.3.0" Rid="unix" />
<Usage Id="System.Private.Uri" Version="4.3.0" />
<!--End portable-build only prebuilts-->
<Usage Id="Humanizer.Core" Version="2.2.0" />
<Usage Id="Microsoft.AspNetCore.App.Ref" Version="5.0.0-rc.1.20451.17" />
<Usage Id="Microsoft.AspNetCore.App.Ref" Version="5.0.0" />
<Usage Id="Microsoft.AspNetCore.Components.WebAssembly.Templates" Version="3.2.1" />
Expand Down
1 change: 0 additions & 1 deletion tools-local/prebuilt-baseline-online.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<Usage Id="Microsoft.Dotnet.WinForms.ProjectTemplates" Version="5.0.0-rc.1.20451.14" />
<Usage Id="Microsoft.NETCore.App.Host.linux-x64" Version="5.0.0-rc.1.20451.14" />
<!-- End OSX-only prebuilts -->
<Usage Id="Humanizer.Core" Version="2.2.0" />
<Usage Id="MicroBuild.Core" Version="0.2.0" IsDirectDependency="true" IsAutoReferenced="true" />
<Usage Id="MicroBuild.Core" Version="0.3.0" IsDirectDependency="true" />
<Usage Id="MicroBuild.Core.Sentinel" Version="1.0.0" IsDirectDependency="true" IsAutoReferenced="true" />
Expand Down

0 comments on commit 0de1500

Please sign in to comment.