Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dazinator committed May 5, 2017
2 parents 75d01b8 + 273f24c commit 98dceae
Show file tree
Hide file tree
Showing 34 changed files with 230 additions and 349 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# DotNet.Glob
A fast (probably the fastest) globbing library for .NET.
This library **does not** use Regex - I wanted to make something much faster.
The latest benchmarks show that DotNet.Glob signficantly outperforms Regex.
The benchmarks use [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) and can be located inside this repo. Just `dotnet run` them.


| Branch | Build Status | NuGet |
| ------------- | ------------- | ----- |
| Master |[![Build master](https://ci.appveyor.com/api/projects/status/yab1btvh7bvkkgva/branch/master?svg=true)](https://ci.appveyor.com/project/dazinator/dotnet-glob/branch/master) | [![NuGet](https://img.shields.io/nuget/v/DotNet.Glob.svg)](https://www.nuget.org/packages/DotNet.Glob/) |
| Develop | [![Build develop](https://ci.appveyor.com/api/projects/status/yab1btvh7bvkkgva?svg=true)](https://ci.appveyor.com/project/dazinator/dotnet-glob/branch/develop) | [![NuGet](https://img.shields.io/nuget/vpre/DotNet.Glob.svg)](https://www.nuget.org/packages/DotNet.Glob/) |
| Develop | [![Build status](https://ci.appveyor.com/api/projects/status/yab1btvh7bvkkgva/branch/develop?svg=true)](https://ci.appveyor.com/project/dazinator/dotnet-glob/branch/develop) | [![NuGet](https://img.shields.io/nuget/vpre/DotNet.Glob.svg)](https://www.nuget.org/packages/DotNet.Glob/) |

This library **does not** use Regex - I wanted to make something much faster.
The latest benchmarks show that DotNet.Glob signficantly outperforms Regex.
The benchmarks use [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) and can be located inside this repo. Just `dotnet run` them. Some Benchmark results have also been published on the wiki: https://github.com/dazinator/DotNet.Glob/wiki/Benchmarks-(vs-Compiled-Regex)

# Usage
1. Install the NuGet package. `Install-Package DotNet.Glob`
Expand Down Expand Up @@ -63,7 +63,7 @@ In addition, DotNet Glob also supports:

| Wildcard | Description | Example | Matches | Does not match |
| -------- | ----------- | ------- | ------- | -------------- |
| `**` | matches any number of path / directory segments. When used must be the only contents of a segment. | /**/some.* | /foo/bar/bah/some.txt, /some.txt, or /foo/some.txt |
| `**` | matches any number of path / directory segments. When used must be the only contents of a segment. | /\*\*/some.\* | /foo/bar/bah/some.txt, /some.txt, or /foo/some.txt |


# Advanced Usages
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version: 1.0.{build}
skip_tags: true
build:
verbosity: minimal
environment:
NuGetOrgApiKey:
secure: u8JpW5kkti8pMi+ra2QcXTJPhkHCA8pkKSiiZOJbcS/vFVHNvF3W8qw1Fy2If6a7
Expand Down
29 changes: 10 additions & 19 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var globalAssemblyFile = "./src/GlobalAssemblyInfo.cs";
var projectToPackage = $"./src/{projectName}";
var repoBranchName = "master";
var benchMarksEnabled = EnvironmentVariable("BENCHMARKS") == "on";
var solutionPath = "./src/DotNetGlob.sln";

var isContinuousIntegrationBuild = !BuildSystem.IsLocalBuild;

Expand Down Expand Up @@ -57,8 +58,7 @@ Task("__Default")
.IsDependentOn("__UpdateAssemblyVersionInformation")
.IsDependentOn("__Build")
.IsDependentOn("__Test")
.IsDependentOn("__Benchmarks")
.IsDependentOn("__UpdateProjectJsonVersion")
.IsDependentOn("__Benchmarks")
.IsDependentOn("__Pack")
.IsDependentOn("__PublishNuGetPackages");

Expand Down Expand Up @@ -90,7 +90,7 @@ Task("__SetAppVeyorBuildNumber")
});

Task("__Restore")
.Does(() => DotNetCoreRestore());
.Does(() => DotNetCoreRestore(solutionPath));

Task("__UpdateAssemblyVersionInformation")
.WithCriteria(isContinuousIntegrationBuild)
Expand All @@ -109,7 +109,7 @@ Task("__UpdateAssemblyVersionInformation")
Task("__Build")
.Does(() =>
{
DotNetCoreBuild("**/project.json", new DotNetCoreBuildSettings
DotNetCoreBuild(solutionPath, new DotNetCoreBuildSettings
{
Configuration = configuration
});
Expand All @@ -118,7 +118,7 @@ Task("__Build")
Task("__Test")
.Does(() =>
{
GetFiles("**/*Tests/project.json")
GetFiles("**/*Tests/*.csproj")
.ToList()
.ForEach(testProjectFile =>
{
Expand All @@ -136,7 +136,7 @@ Task("__Benchmarks")
{
if(benchMarksEnabled)
{
GetFiles("**/*Benchmarks/project.json")
GetFiles("**/*Benchmarks/*.csproj")
.ToList()
.ForEach(projFile =>
{
Expand All @@ -158,25 +158,16 @@ Task("__Benchmarks")
}
});

Task("__UpdateProjectJsonVersion")
.WithCriteria(isContinuousIntegrationBuild)
.Does(() =>
{
var projectToPackagePackageJson = $"{projectToPackage}/project.json";
Information("Updating {0} version -> {1}", projectToPackagePackageJson, nugetVersion);

TransformConfig(projectToPackagePackageJson, projectToPackagePackageJson, new TransformationCollection {
{ "version", nugetVersion }
});
});

Task("__Pack")
.Does(() =>
{

var versionarg = "/p:PackageVersion=" + nugetVersion;
var settings = new DotNetCorePackSettings
{
Configuration = "Release",
OutputDirectory = $"{artifactsDir}"
OutputDirectory = $"{artifactsDir}",
ArgumentCustomization = args=>args.Append(versionarg)
};

DotNetCorePack($"{projectToPackage}", settings);
Expand Down
5 changes: 3 additions & 2 deletions src/DotNet.Glob.Benchmarks/BaseGlobBenchMark.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using DotNet.Glob.Benchmarks.Utils;
using DotNet.Globbing;
using DotNet.Globbing.Token;
using DotNet.Globbing.Generation;
using DotNet.Globbing.Token;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{
public abstract class BaseGlobBenchMark
{
Expand Down
17 changes: 5 additions & 12 deletions src/DotNet.Glob.Benchmarks/BaselineRegexGlobCompileBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
using BenchmarkDotNet.Attributes;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Jobs;
using DotNet.Glob.Benchmarks.Utils;
using DotNet.Globbing;
using DotNet.Globbing.Generation;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using Glob;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Attributes.Columns;
using System.Text.RegularExpressions;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{

[ClrJob, CoreJob, MemoryDiagnoser, MinColumn, MaxColumn]
Expand Down
16 changes: 4 additions & 12 deletions src/DotNet.Glob.Benchmarks/BaselineRegexIsMatchFalseBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using DotNet.Globbing;
using System;
using System.Linq;
using System.Reflection.Metadata;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Glob;
using BenchmarkDotNet.Running;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes.Jobs;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{
[ClrJob, CoreJob, MemoryDiagnoser, MinColumn, MaxColumn]
public class BaselineRegexIsMatchFalseBenchmarks : BaseGlobBenchMark
Expand Down
16 changes: 4 additions & 12 deletions src/DotNet.Glob.Benchmarks/BaselineRegexIsMatchTrueBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using DotNet.Globbing;
using DotNet.Globbing.Generation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Glob;
using BenchmarkDotNet.Running;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Jobs;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{

[ClrJob, CoreJob, MemoryDiagnoser, MinColumn, MaxColumn]
Expand Down
28 changes: 28 additions & 0 deletions src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks>
<AssemblyName>DotNet.Glob.Benchmarks</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>DotNet.Glob.Benchmarks</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.5" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DotNet.Glob\DotNet.Glob.csproj" />
</ItemGroup>

</Project>
22 changes: 0 additions & 22 deletions src/DotNet.Glob.Benchmarks/DotNet.Glob.Benchmarks.xproj

This file was deleted.

9 changes: 3 additions & 6 deletions src/DotNet.Glob.Benchmarks/DotNetGlobBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using BenchmarkDotNet.Attributes;
using System.Collections.Generic;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Exporters;
using BenchmarkDotNet.Attributes.Jobs;
using DotNet.Globbing;
using DotNet.Globbing.Generation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{

[ClrJob, CoreJob, MemoryDiagnoser, MarkdownExporter, MinColumn, MaxColumn]
Expand Down
6 changes: 1 addition & 5 deletions src/DotNet.Glob.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using BenchmarkDotNet.Running;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{
public class Program
{
Expand Down
3 changes: 1 addition & 2 deletions src/DotNet.Glob.Benchmarks/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DotNet.Glob.PerfTests")]
[assembly: AssemblyProduct("DotNet.Glob.Benchmarks")]
[assembly: AssemblyTrademark("")]

// Setting ComVisible to false makes the types in this assembly not visible
Expand Down
11 changes: 4 additions & 7 deletions src/DotNet.Glob.Benchmarks/RegexGlobIsMatchBenchmarks.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using DotNet.Globbing;
using DotNet.Globbing.Generation;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Columns;
using BenchmarkDotNet.Attributes.Jobs;

namespace DotNet.Glob.PerfTests
namespace DotNet.Glob.Benchmarks
{

[ClrJob, CoreJob, MemoryDiagnoser, MinColumn, MaxColumn]
Expand Down
10 changes: 4 additions & 6 deletions src/DotNet.Glob.Benchmarks/Utils/GlobToRegexFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using DotNet.Globbing.Token;
using System.Text.RegularExpressions;
using DotNet.Globbing;
using DotNet.Globbing.Token;

namespace DotNet.Globbing
namespace DotNet.Glob.Benchmarks.Utils
{
/// <summary>
/// Formats a glob as a Regular expression string.
Expand Down
26 changes: 0 additions & 26 deletions src/DotNet.Glob.Benchmarks/project.json

This file was deleted.

31 changes: 31 additions & 0 deletions src/DotNet.Glob.Tests/DotNet.Glob.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>DotNet.Glob.Tests</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>DotNet.Glob.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>
<StartupObject />
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DotNet.Glob\DotNet.Glob.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
Loading

0 comments on commit 98dceae

Please sign in to comment.