Skip to content

Commit

Permalink
Merge pull request #44 from godrose/fb-use-single-assemblies-source
Browse files Browse the repository at this point in the history
Fb use single assemblies source
  • Loading branch information
godrose authored Mar 9, 2019
2 parents 656f6ea + 55158eb commit 7edc7a1
Show file tree
Hide file tree
Showing 40 changed files with 533 additions and 393 deletions.
11 changes: 2 additions & 9 deletions Solid.Bootstrapping/Solid.Bootstrapping.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Solid.Bootstrapping</AssemblyName>
<RootNamespace>Solid.Bootstrapping</RootNamespace>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
4 changes: 2 additions & 2 deletions Solid.Common.Platform/net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
4 changes: 2 additions & 2 deletions Solid.Common.Platform/uwp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: ComVisible(false)]
6 changes: 1 addition & 5 deletions Solid.Common/Solid.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<RootNamespace>Solid.Common</RootNamespace>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
116 changes: 116 additions & 0 deletions Solid.Core.Tests/PatternsCalculatorTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Xunit;

namespace Solid.Core.Tests
{
public class PatternsCalculatorTests
{
public class InputData
{
public InputData(string[] prefixes, string[] namespaces, string[] extensions)
{
Prefixes = prefixes;
Namespaces = namespaces;
Extensions = extensions;
}

public string[] Prefixes { get; }
public string[] Namespaces { get; }
public string[] Extensions { get; }
}

public static IEnumerable<object[]> NonEmptyCollectionsData =>
new List<object[]>
{
new object[]
{
new InputData(new[] {"Prefix"}, new[] {"Namespace"}, new[] {"ext"}),
new[] {new PatternDescription("Prefix", "Namespace", "ext")}
},
new object[]
{
new InputData(new[] {"Prefix"}, new[] {"Namespace1", "Namespace2"}, new[] {"ext"}),
new[]
{
new PatternDescription("Prefix", "Namespace1", "ext"),
new PatternDescription("Prefix", "Namespace2", "ext")
}
},
new object[]
{
new InputData(new[] {"Prefix"}, new[] {"Namespace1", "Namespace2"}, new[] {"ext1", "ext2"}),
new[]
{
new PatternDescription("Prefix", "Namespace1", "ext1"),
new PatternDescription("Prefix", "Namespace1", "ext2"),
new PatternDescription("Prefix", "Namespace2", "ext1"),
new PatternDescription("Prefix", "Namespace2", "ext2")
}
},
new object[]
{
new InputData(new[] {"Prefix1", "Prefix2"}, new[] {"Namespace1", "Namespace2"}, new[] {"ext1", "ext2"}),
new[]
{
new PatternDescription("Prefix1", "Namespace1", "ext1"),
new PatternDescription("Prefix1", "Namespace1", "ext2"),
new PatternDescription("Prefix1", "Namespace2", "ext1"),
new PatternDescription("Prefix1", "Namespace2", "ext2"),
new PatternDescription("Prefix2", "Namespace1", "ext1"),
new PatternDescription("Prefix2", "Namespace1", "ext2"),
new PatternDescription("Prefix2", "Namespace2", "ext1"),
new PatternDescription("Prefix2", "Namespace2", "ext2")
}
}
};

public static IEnumerable<object[]> EmptyCollectionsData =>
new List<object[]>
{
new object[]
{
new InputData(new string[] {}, new[] {"Namespace"}, new[] {"ext"}),
new[] {new PatternDescription("*", "Namespace", "ext")}
},
new object[]
{
new InputData(null, new[] {"Namespace"}, new[] {"ext"}),
new[] {new PatternDescription("*", "Namespace", "ext")}
},
new object[]
{
new InputData(new string[] {}, new string[] {}, new[] {"ext"}),
new[] {new PatternDescription("*", "*", "ext")}
},
new object[]
{
new InputData(null, null, new[] {"ext"}),
new[] {new PatternDescription("*", "*", "ext")}
},
new object[]
{
new InputData(new string[] {}, new string[] {}, new string[] {}),
new[] {new PatternDescription("*", "*", "*")}
},
new object[]
{
new InputData(null, null, null),
new[] {new PatternDescription("*", "*", "*")}
}
};

[Theory]
[MemberData(nameof(NonEmptyCollectionsData))]
[MemberData(nameof(EmptyCollectionsData))]
public void Calculate_VariousInputsAreSupplied_ExpectedOutputsAreReturned(InputData input,
PatternDescription[] expectedOutput)
{
var searcher = new PatternsCalculator();
var paths = searcher.Calculate(input.Prefixes, input.Namespaces, input.Extensions).ToArray();

paths.Should().BeEquivalentTo(expectedOutput);
}
}
}
23 changes: 23 additions & 0 deletions Solid.Core.Tests/Solid.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Solid.Core\Solid.Core.csproj" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions Solid.Core/CollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Solid.Core
{
internal static class CollectionExtensions
{
internal static string[] Patch(this string[] input)
{
return input == null || input.Length == 0 ? new[] { Consts.WildCard } : input;
}
}
}
13 changes: 13 additions & 0 deletions Solid.Core/Consts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Solid.Core
{
/// <summary>
/// Constant values.
/// </summary>
public static class Consts
{
/// <summary>
/// Wildcard value.
/// </summary>
public const string WildCard = "*";
}
}
36 changes: 36 additions & 0 deletions Solid.Core/PatternDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace Solid.Core
{
/// <summary>
/// The file path pattern description.
/// </summary>
public struct PatternDescription
{
/// <summary>
/// Initializes an instance of <see cref="PatternDescription"/>
/// </summary>
/// <param name="prefix">The prefix.</param>
/// <param name="contents">The contents.</param>
/// <param name="postfix">The postfix.</param>
public PatternDescription(string prefix, string contents, string postfix)
{
Prefix = prefix;
Contents = contents;
Postfix = postfix;
}

/// <summary>
/// The prefix.
/// </summary>
public string Prefix { get; }

/// <summary>
/// The contents.
/// </summary>
public string Contents { get; }

/// <summary>
/// The postfix.
/// </summary>
public string Postfix { get; }
}
}
35 changes: 35 additions & 0 deletions Solid.Core/PatternsCalculator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Collections.Generic;

namespace Solid.Core
{
/// <summary>
/// Calculates patterns for file paths.
/// </summary>
public class PatternsCalculator
{
/// <summary>
/// Calculates patterns for file paths based on the required conditions.
/// </summary>
/// <param name="prefixes">The list of allowed prefixes. Leave empty if all are allowed.</param>
/// <param name="namespaces">The list of allowed namespaces. Leave empty if all are allowed.</param>
/// <param name="extensions">The list of allowed extensions. Leave empty if all are allowed.</param>
/// <returns>The list of allowed patterns.</returns>
public IEnumerable<PatternDescription> Calculate(string[] prefixes, string[] namespaces, string[] extensions)
{
prefixes = prefixes.Patch();
namespaces = namespaces.Patch();
extensions = extensions.Patch();

foreach (var prefix in prefixes)
{
foreach (var ns in namespaces)
{
foreach (var extension in extensions)
{
yield return new PatternDescription(prefix, ns, extension);
}
}
}
}
}
}
7 changes: 2 additions & 5 deletions Solid.Core/Solid.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
11 changes: 2 additions & 9 deletions Solid.Extensibility/Solid.Extensibility.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Solid.Extensibility</AssemblyName>
<RootNamespace>Solid.Extensibility</RootNamespace>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
16 changes: 3 additions & 13 deletions Solid.IoC.Adapters.BoDi/Solid.IoC.Adapters.BoDi.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Solid.IoC.Adapters.BoDi</AssemblyName>
<RootNamespace>Solid.IoC.Adapters.BoDi</RootNamespace>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -26,9 +19,6 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Solid.Practices.IoC\Solid.Practices.IoC.csproj">
<Project>{156f34d5-5b15-40cd-9873-c822d5335b0d}</Project>
<Name>Solid.Practices.IoC</Name>
</ProjectReference>
<ProjectReference Include="..\Solid.Practices.IoC\Solid.Practices.IoC.csproj" />
</ItemGroup>
</Project>
11 changes: 2 additions & 9 deletions Solid.Patterns.Builder/Solid.Patterns.Builder.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Solid.Patterns.Builder</AssemblyName>
<RootNamespace>Solid.Patterns.Builder</RootNamespace>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Solid.Patterns.ChainOfResponsibility</AssemblyName>
<RootNamespace>Solid.Patterns.ChainOfResponsibility</RootNamespace>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>2.0.0</Version>
<Version>2.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
Loading

0 comments on commit 7edc7a1

Please sign in to comment.