Skip to content
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

Initial proof of concept for an F#/FParser-based parser of the Semantic-Release-Notes format. #13

Open
wants to merge 5 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
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# These files are text and should be normalized (convert crlf => lf)
*.cs text diff=csharp
*.xaml text
*.csproj text
*.sln text
*.tt text
*.ps1 text
*.cmd text
*.msbuild text
*.md text

# Images should be treated as binary
# (binary is a macro for -text -diff)
*.png binary
*.jepg binary

*.sdf binary
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# ApprovalTests (received files)
*.received.txt

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
[Dd]ebug/
[Rr]elease/
x64/

# ReSharper is a .NET coding add-in
_ReSharper*

# NuGet Packages Directory
packages

# Others
*.Cache
[Ss]tyle[Cc]op.*

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
6 changes: 6 additions & 0 deletions src/.nuget/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
Binary file added src/.nuget/NuGet.exe
Binary file not shown.
151 changes: 151 additions & 0 deletions src/.nuget/NuGet.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>

<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>

<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>

<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>

<PropertyGroup>
<PackagesProjectConfig>packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
</PropertyGroup>

<Choose>
<When Condition="Exists('$(PackagesProjectConfig)')">
<PropertyGroup>
<PackagesConfig>$(PackagesProjectConfig)</PackagesConfig>
</PropertyGroup>
</When>
<When Condition="Exists('packages.config')">
<PropertyGroup>
<PackagesConfig>packages.config</PackagesConfig>
</PropertyGroup>
</When>
</Choose>

<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>

<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>

<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>

<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>

<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>

<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>

<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>

<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>

<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>

<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>

<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />

<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>

<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />

<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>

<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);

Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);

return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>
29 changes: 29 additions & 0 deletions src/SemanticReleaseNotes.Tests/Examples.Example_A.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ReleaseNotes
[Section
(null,null,
Some
(Summary
"Incremental release designed to provide an update to some of the core plugins.
"),
Some
(Items
[Item
(null,
Summary
"Release Checker: Now gives you a breakdown of exactly what you are missing. +New",
null);
Item
(null,
Summary
"Structured Layout: An alternative layout engine that allows developers to control layout. +New",
null);
Item
(null,
Summary
"Timeline: Comes with an additional grid view to show the same data. +Changed",
null);
Item
(null,
Summary
"Ajax: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix",
null)]))]
36 changes: 36 additions & 0 deletions src/SemanticReleaseNotes.Tests/Examples.Example_B.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ReleaseNotes
[Section
(null,null,
Some
(Summary
"Incremental release designed to provide an update to some of the core plugins.
"),
null);
Section
(Some (Name " System"),Some (Priority 1),null,
Some
(Items
[Item
(null,
Summary
"*Release Checker*: Now gives you a breakdown of exactly what you are missing. +New",
null);
Item
(null,
Summary
"*Structured Layout*: An alternative layout engine that allows developers to control layout. +New",
null)]));
Section
(Some (Name " Plugin"),Some (Priority 1),null,
Some
(Items
[Item
(null,
Summary
"*Timeline*: Comes with an additional grid view to show the same data. +Changed",
null);
Item
(null,
Summary
"*Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix",
null)]))]
43 changes: 43 additions & 0 deletions src/SemanticReleaseNotes.Tests/Examples.Example_C.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ReleaseNotes
[Section
(null,null,
Some
(Summary
"Incremental release designed to provide an update to some of the core plugins."),
Some
(Items
[Item
(null,
Summary
"*Example*: You can have global issues that aren't grouped to a section",
null)]));
Section
(Some (Name " System"),Some (Priority 1),
Some (Summary "This description is specific to system section."),
Some
(Items
[Item
(null,
Summary
"*Release Checker*: Now gives you a +new breakdown of exactly what you are missing.",
null);
Item
(null,
Summary
"*Structured Layout*: A +new alternative layout engine that allows developers to control layout.",
null)]));
Section
(Some (Name " Plugin"),Some (Priority 1),
Some (Summary "This description is specific to plugin section."),
Some
(Items
[Item
(null,
Summary
"*Timeline*: Comes with an additional grid view to show the same data. +Changed",
null);
Item
(null,
Summary
"*Ajax*: +Fix that crashed poll in Chrome and IE due to log/trace statement. [[i1234][http://getglimpse.com]]",
null)]))]
46 changes: 46 additions & 0 deletions src/SemanticReleaseNotes.Tests/Examples.Example_D.approved.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
ReleaseNotes
[Section
(null,null,
Some
(Summary
"Incremental release designed to provide an update to some of the core plugins."),
Some
(Items
[Item
(Some (Priority 1),
Summary
"*Example*: You can have global issues that aren't grouped to a section",
null)]));
Section
(Some
(Name " System [[icon][http://getglimpse.com/release/icon/core.png]]"),
Some (Priority 1),
Some (Summary "This description is specific to system section."),
Some
(Items
[Item
(Some (Priority 3),
Summary
"*Release Checker*: Now gives you a breakdown of exactly what you are missing. +New",
null);
Item
(Some (Priority 2),
Summary
"*Structured Layout*: An alternative layout engine that allows developers to control layout. +New",
null)]));
Section
(Some (Name " Plugin [[icon][http://getglimpse.com/release/icon/mvc.png]]"),
Some (Priority 1),
Some (Summary "This description is specific to plugin section."),
Some
(Items
[Item
(Some (Priority 1),
Summary
"*Timeline*: Comes with an additional grid view to show the same data. +Changed",
null);
Item
(Some (Priority 1),
Summary
"*Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix [[i1234][http://getglimpse.com]]",
null)]))]
Loading