Skip to content

Create a separate package for CommonMark.NET.Console #123

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions CommonMark.Console/App.nuget.config

This file was deleted.

42 changes: 40 additions & 2 deletions CommonMark.Console/CommonMark.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<PropertyGroup>
<TargetFrameworks>net45</TargetFrameworks>
<OutputType>Exe</OutputType>

<AssemblyName>cmark</AssemblyName>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -13,8 +15,22 @@
<Description>https://github.com/Knagis/CommonMark.NET</Description>
<Copyright>Copyright © Kārlis Gaņģis 2014</Copyright>

<Version>1.0.0.0</Version>
<FileVersion>1.0.0.0</FileVersion>
<PackageId>CommonMark.NET.Console</PackageId>
<Title>CommonMark.NET.Console</Title>
<Authors>Kārlis Gaņģis</Authors>
<PackageLicenseUrl>https://raw.githubusercontent.com/Knagis/CommonMark.NET/master/LICENSE.md</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/Knagis/CommonMark.NET/</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/32x20.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageDescription>.NET library for converting Markdown documents to HTML according to the CommonMark specification. Optimized for maximum performance and targets every .NET version since 2.0, including PCL, Mono and .NET Core.</PackageDescription>
<PackageReleaseNotes>Fixed lists with tab characters and double trailing newlines.</PackageReleaseNotes>
<PackageTags>CommonMark Markdown</PackageTags>

<IsTool>true</IsTool>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
</PropertyGroup>

<ItemGroup>
Expand All @@ -35,8 +51,30 @@
<DebugType>pdbonly</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CommonMark\CommonMark.Base.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="..\LICENSE.md" PackagePath="/" />
<Content Include="App.config" PackagePath="$(BuildOutputTargetFolder)/cmark.exe.config" />
</ItemGroup>

<Target Name="_GetAdditionalPackAssemblyFiles" BeforeTargets="_GetBuildOutputFilesWithTfm">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)CommonMark.dll" />
<BuildOutputInPackage Include="$(OutputPath)CommonMark.xml" />
</ItemGroup>
</Target>

<Target Name="_GetAdditionalPackSymbolFiles" BeforeTargets="_GetDebugSymbolsWithTfm">
<ItemGroup>
<_TargetPathsToSymbolsWithTfm Include="$(OutputPath)CommonMark.pdb" TargetFramework="$(TargetFramework)" />
</ItemGroup>
</Target>

</Project>
30 changes: 0 additions & 30 deletions CommonMark.NET.nuspec

This file was deleted.

1 change: 0 additions & 1 deletion CommonMark.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Other", "Other", "{EC5FFA77-658F-4D2F-A5CE-5F1BD44F3FC0}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
CommonMark.NET.nuspec = CommonMark.NET.nuspec
LICENSE.md = LICENSE.md
README.md = README.md
runtests.pl = runtests.pl
Expand Down
27 changes: 18 additions & 9 deletions CommonMark/CommonMark.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@
<Description>https://github.com/Knagis/CommonMark.NET</Description>
<Copyright>Copyright © Kārlis Gaņģis 2014-2016</Copyright>

<Version>0.1.0.0</Version>
<FileVersion>0.1.0.0</FileVersion>
<PackageId>CommonMark.NET</PackageId>
<Title>CommonMark.NET</Title>
<Authors>Kārlis Gaņģis</Authors>
<PackageLicenseUrl>https://raw.githubusercontent.com/Knagis/CommonMark.NET/master/LICENSE.md</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/Knagis/CommonMark.NET/</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/dcurtis/markdown-mark/master/png/32x20.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageDescription>.NET library for converting Markdown documents to HTML according to the CommonMark specification. Optimized for maximum performance and targets every .NET version since 2.0, including PCL, Mono and .NET Core.</PackageDescription>
<PackageReleaseNotes>Fixed lists with tab characters and double trailing newlines.</PackageReleaseNotes>
<PackageTags>CommonMark Markdown</PackageTags>

<!-- Cannot generate package on all builds because it currently packages an executable built by a downstream project -->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<NuspecFile>..\CommonMark.NET.nuspec</NuspecFile>
<NuspecProperties>configuration=$(Configuration)</NuspecProperties>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -70,9 +77,11 @@
</Choose>

<ItemGroup>
<EmbeddedResource Include="..\CommonMark.NET.nuspec">
<Link>Properties\CommonMark.NET.nuspec</Link>
</EmbeddedResource>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Content Include="..\LICENSE.md" PackagePath="/" />
</ItemGroup>

</Project>
18 changes: 1 addition & 17 deletions CommonMark/CommonMarkConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;

namespace CommonMark
Expand Down Expand Up @@ -46,22 +45,7 @@ public static Version Version

private static Version InitializeVersion()
{
// System.Xml is not available so resort to string parsing.
using (var stream = Assembly.GetManifestResourceStream("CommonMark.Properties.CommonMark.NET.nuspec"))
using (var reader = new System.IO.StreamReader(stream, Encoding.UTF8))
{
string line;
while ((line = reader.ReadLine()) != null)
{
var i = line.IndexOf("<version>", StringComparison.Ordinal);
if (i == -1)
continue;

i += 9;
return new Version(line.Substring(i, line.IndexOf("</version>", StringComparison.Ordinal) - i));
}
}
return null;
return new Version(ThisAssembly.AssemblyFileVersion);
}

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ before_build:
- nuget restore
build:
parallel: true
verbosity: minimal
verbosity: minimal
artifacts:
- path: 'CommonMark\bin\*\*.nupkg'
- path: 'CommonMark.Console\bin\*\*.nupkg'
18 changes: 18 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.15.1.0",
Copy link
Contributor Author

@sharwell sharwell Dec 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 This is capable of calculating unique version numbers for each commit on build, but for now I've hard-coded all four digits of the version number to match the behavior prior to this pull request. The partial adoption of Nerdbank.GitVersioning causes the ThisAssembly class to be generated during the build, which is used by InitializeVersion to provide version information now that the nuspec file is generated after the assembly has already been built.

The behavior change introduced by this involves the [AssemblyVersion] and [AssemblyFileVersion] attributes, which now read 0.15.0.0 and 0.15.1.0, respectively. Prior to this change, the NuGet package version was 0.15.1.0, but both of the attributes were 0.1.0.0.

"assemblyVersion": {
"precision": "minor"
},
"publicReleaseRefSpec": [
"^refs/heads/master$"
],
"nugetPackageVersion": {
"semVer": 1
},
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}