Skip to content

Commit

Permalink
Merge pull request #33 from niklaslundberg/develop
Browse files Browse the repository at this point in the history
Release 3.7.0
  • Loading branch information
niklaslundberg authored Nov 15, 2023
2 parents 38d0325 + 505ce26 commit 57ddd01
Show file tree
Hide file tree
Showing 18 changed files with 1,435 additions and 149 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-version: |
6.0.x
7.0.x
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
dotnet-version: 8.0.x
cache: true
cache-dependency-path: tests/Arbor.Aesculus.Tests.Integration
- name: install-tools
run: |
dotnet tool install --global Arbor.Tooler.GlobalTool --version "*-*"
Expand All @@ -25,7 +29,7 @@ jobs:
shell: cmd
env:
Arbor.Build.NuGet.PackageUpload.Server.ApiKey: ${{ secrets.myget }}
Arbor.Build.NuGet.PackageUpload.Server.Uri: "https://www.myget.org/F/arbor/api/v2/package"
Arbor.Build.NuGet.PackageUpload.Server.Uri: "https://www.myget.org/F/arbor/api/v3/index.json"
Arbor.Build.NuGet.PackageUpload.Enabled: "true"
Arbor.Build.NuGet.PackageUpload.ForceUploadEnabled: "true"
run: |
Expand Down
5 changes: 3 additions & 2 deletions Arbor.Aesculus.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
# Visual Studio Version 17
VisualStudioVersion = 17.8.34112.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{367E3926-4D20-4FEB-A035-4C165D2E708E}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
global.json = global.json
License.txt = License.txt
nuget.config = nuget.config
README.md = README.md
version.json = version.json
EndProjectSection
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.0",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion src/Arbor.Aesculus.Core/Arbor.Aesculus.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Arbor.Aesculus.Core/Arbor.Aesculus.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
<file src="bin\$configuration$\netstandard2.0\Arbor.Aesculus.Core.dll" target="lib\netstandard2.0" />
<file src="bin\$configuration$\net6.0\Arbor.Aesculus.Core.dll" target="lib\net6.0" />
<file src="bin\$configuration$\net7.0\Arbor.Aesculus.Core.dll" target="lib\net7.0" />
<file src="bin\$configuration$\net8.0\Arbor.Aesculus.Core.dll" target="lib\net8.0" />
</files>
</package>
149 changes: 74 additions & 75 deletions src/Arbor.Aesculus.Core/VcsPathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,110 @@
using System.IO;
using System.Linq;

namespace Arbor.Aesculus.Core
namespace Arbor.Aesculus.Core;

public static class VcsPathHelper
{
public static class VcsPathHelper
{
private static readonly List<string> SourceRootDirectoryNames = new() { ".git" };
private static readonly List<string> SourceRootDirectoryNames = new() { ".git" };

private static readonly List<string> SourceRootFileNames = new() { ".deployment", ".gitattributes" };
private static readonly List<string> SourceRootFileNames = new() { ".deployment", ".gitattributes" };

private static readonly string RootNotFoundMessage =
$"Could not find the source root. Searched for folder containing any subfolder with name [{string.Join("|", SourceRootDirectoryNames)}] and searched for folder containing any file with name [{string.Join("|", SourceRootFileNames)}]. None of these were found";
private static readonly string RootNotFoundMessage =
$"Could not find the source root. Searched for folder containing any subfolder with name [{string.Join("|", SourceRootDirectoryNames)}] and searched for folder containing any file with name [{string.Join("|", SourceRootFileNames)}]. None of these were found";

public static string? TryFindVcsRootPath(string? startDirectory = null, Action<string>? logger = null)
{
string directoryPath = !string.IsNullOrWhiteSpace(startDirectory)
? startDirectory!
: AppContext.BaseDirectory;

public static string? TryFindVcsRootPath(string? startDirectory = null, Action<string>? logger = null)
if (!Directory.Exists(directoryPath))
{
string directoryPath = !string.IsNullOrWhiteSpace(startDirectory)
? startDirectory!
: AppContext.BaseDirectory;
throw new DirectoryNotFoundException($"The start directory '{directoryPath}' does not exist");
}

if (!Directory.Exists(directoryPath))
{
throw new DirectoryNotFoundException($"The start directory '{directoryPath}' does not exist");
}
if (logger != null)
{
logger.Invoke($"Using start directory '{startDirectory}'");

if (logger != null)
{
logger.Invoke($"Using start directory '{startDirectory}'");
logger.Invoke(
$"Searching for folder containing any subfolder with name [{string.Join("|", SourceRootDirectoryNames)}]");

logger.Invoke(
$"Searching for folder containing any subfolder with name [{string.Join("|", SourceRootDirectoryNames)}]");
logger.Invoke(
$"Searching for folder containing any file with name [{string.Join("|", SourceRootFileNames)}]");
}

logger.Invoke(
$"Searching for folder containing any file with name [{string.Join("|", SourceRootFileNames)}]");
}
var startDir = new DirectoryInfo(directoryPath);

var startDir = new DirectoryInfo(directoryPath);
DirectoryInfo? rootDirectory = NavigateToSourceRoot(startDir);

DirectoryInfo? rootDirectory = NavigateToSourceRoot(startDir);
if (rootDirectory is null)
{
logger?.Invoke(RootNotFoundMessage);
}

if (rootDirectory is null)
{
logger?.Invoke(RootNotFoundMessage);
}
return rootDirectory?.FullName;
}

return rootDirectory?.FullName;
}
public static string? FindVcsRootPath(string? startDirectory = null)
{
string? rootDirectory = TryFindVcsRootPath(startDirectory);

public static string? FindVcsRootPath(string? startDirectory = null)
if (!string.IsNullOrWhiteSpace(rootDirectory))
{
string? rootDirectory = TryFindVcsRootPath(startDirectory);
return rootDirectory;
}

if (!string.IsNullOrWhiteSpace(rootDirectory))
{
return rootDirectory;
}
throw new DirectoryNotFoundException(RootNotFoundMessage);
}

throw new DirectoryNotFoundException(RootNotFoundMessage);
private static DirectoryInfo? NavigateToSourceRoot(DirectoryInfo? currentDirectory)
{
if (currentDirectory?.Parent is null)
{
return null;
}

private static DirectoryInfo? NavigateToSourceRoot(DirectoryInfo? currentDirectory)
bool IsNamedRoot(DirectoryInfo dir)
{
if (currentDirectory?.Parent is null)
{
return null;
}

bool IsNamedRoot(DirectoryInfo dir)
{
return SourceRootDirectoryNames.Any(rootName =>
dir.Name.Equals(rootName, StringComparison.OrdinalIgnoreCase));
}

var directoryCriterion = new List<Func<DirectoryInfo, bool>> { IsNamedRoot };
return SourceRootDirectoryNames.Exists(rootName =>
dir.Name.Equals(rootName, StringComparison.OrdinalIgnoreCase));
}

bool IsRootFile(FileInfo file)
{
return SourceRootFileNames.Any(rootFile =>
file.Name.Equals(rootFile, StringComparison.OrdinalIgnoreCase));
}
var directoryCriterion = new List<Func<DirectoryInfo, bool>> { IsNamedRoot };

var fileCriterion = new List<Func<FileInfo, bool>> { IsRootFile };
bool IsRootFile(FileInfo file)
{
return SourceRootFileNames.Exists(rootFile =>
file.Name.Equals(rootFile, StringComparison.OrdinalIgnoreCase));
}

IEnumerable<DirectoryInfo> subDirectories = currentDirectory.EnumerateDirectories();
var fileCriterion = new List<Func<FileInfo, bool>> { IsRootFile };

bool directoryHasSourceRoot = subDirectories.Any(dir =>
SourceRootDirectoryNames.Any(pattern => dir.Name.Equals(pattern, StringComparison.OrdinalIgnoreCase)));
IEnumerable<DirectoryInfo> subDirectories = currentDirectory.EnumerateDirectories();

if (directoryHasSourceRoot)
{
return currentDirectory;
}
bool directoryHasSourceRoot = subDirectories.Any(dir =>
SourceRootDirectoryNames.Exists(pattern => dir.Name.Equals(pattern, StringComparison.OrdinalIgnoreCase)));

bool isRootDir = directoryCriterion.Any(filter => filter(currentDirectory));
if (directoryHasSourceRoot)
{
return currentDirectory;
}

if (isRootDir)
{
return currentDirectory;
}
bool isRootDir = directoryCriterion.Exists(filter => filter(currentDirectory));

bool hasRootFile = currentDirectory.EnumerateFiles().Any(file => fileCriterion.Any(filter => filter(file)));
if (isRootDir)
{
return currentDirectory;
}

if (hasRootFile)
{
return currentDirectory;
}
bool hasRootFile = currentDirectory.EnumerateFiles().Any(file => fileCriterion.Exists(filter => filter(file)));

return NavigateToSourceRoot(currentDirectory.Parent);
if (hasRootFile)
{
return currentDirectory;
}

return NavigateToSourceRoot(currentDirectory.Parent);
}
}
3 changes: 2 additions & 1 deletion src/Arbor.Aesculus.Core/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
},
"net6.0": {},
"net7.0": {}
"net7.0": {},
"net8.0": {}
}
}
2 changes: 1 addition & 1 deletion src/Arbor.Aesculus.NCrunch/Arbor.Aesculus.NCrunch.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 7 additions & 2 deletions src/Arbor.Aesculus.NCrunch/Arbor.Aesculus.NCrunch.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@
<dependency id="Arbor.Aesculus" version="$version$" />
<dependency id="NCrunch.Framework" version="[4.17.0,)" />
</group>
<group targetFramework="net5.0">
<group targetFramework="net6.0">
<dependency id="Arbor.Aesculus" version="$version$" />
<dependency id="NCrunch.Framework" version="[4.17.0,)" />
</group>
<group targetFramework="net6.0">
<group targetFramework="net7.0">
<dependency id="Arbor.Aesculus" version="$version$" />
<dependency id="NCrunch.Framework" version="[4.17.0,)" />
</group>
<group targetFramework="net8.0">
<dependency id="Arbor.Aesculus" version="$version$" />
<dependency id="NCrunch.Framework" version="[4.17.0,)" />
</group>
Expand All @@ -41,5 +45,6 @@
<file src="bin\$configuration$\netstandard2.0\Arbor.Aesculus.NCrunch.dll" target="lib\netstandard2.0" />
<file src="bin\$configuration$\net6.0\Arbor.Aesculus.NCrunch.dll" target="lib\net6.0" />
<file src="bin\$configuration$\net7.0\Arbor.Aesculus.NCrunch.dll" target="lib\net7.0" />
<file src="bin\$configuration$\net8.0\Arbor.Aesculus.NCrunch.dll" target="lib\net8.0" />
</files>
</package>
19 changes: 9 additions & 10 deletions src/Arbor.Aesculus.NCrunch/VcsTestPathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
using Arbor.Aesculus.Core;
using NCrunch.Framework;

namespace Arbor.Aesculus.NCrunch
namespace Arbor.Aesculus.NCrunch;

public static class VcsTestPathHelper
{
public static class VcsTestPathHelper
public static string? TryFindVcsRootPath(Action<string>? logger = null)
{
public static string? TryFindVcsRootPath(Action<string>? logger = null)
if (NCrunchEnvironment.NCrunchIsResident())
{
if (NCrunchEnvironment.NCrunchIsResident())
{
var originalSolutionFileInfo = new FileInfo(NCrunchEnvironment.GetOriginalSolutionPath());
return VcsPathHelper.TryFindVcsRootPath(originalSolutionFileInfo.Directory?.FullName, logger);
}

return VcsPathHelper.TryFindVcsRootPath(logger: logger);
var originalSolutionFileInfo = new FileInfo(NCrunchEnvironment.GetOriginalSolutionPath());
return VcsPathHelper.TryFindVcsRootPath(originalSolutionFileInfo.Directory?.FullName, logger);
}

return VcsPathHelper.TryFindVcsRootPath(logger: logger);
}
}
Loading

0 comments on commit 57ddd01

Please sign in to comment.