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: #1767
  • Loading branch information
omajid committed Nov 18, 2020
1 parent 25deb0c commit f9faf63
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 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

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

0 comments on commit f9faf63

Please sign in to comment.