Skip to content

Commit

Permalink
Clean up Build.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-VBFK committed Jan 7, 2023
1 parent 37fbe54 commit b7b4de5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Build/Build.cs
Expand Up @@ -53,6 +53,8 @@ class Build : NukeBuild
[GitRepository]
readonly GitRepository GitRepository;

Repository Repository => new Repository(GitRepository.LocalDirectory);

[PackageExecutable("nspec", "NSpecRunner.exe", Version = "3.1.0")]
Tool NSpec3;

Expand Down Expand Up @@ -87,14 +89,14 @@ class Build : NukeBuild
SemVer = GitVersion.SemVer;
if (IsPullRequest)
{
Serilog.Log.Information(
Information(
"Branch spec {branchspec} is a pull request. Adding build number {buildnumber}",
BranchSpec, BuildNumber);
SemVer = string.Join('.', GitVersion.SemVer.Split('.').Take(3).Union(new[] { BuildNumber }));
}
Serilog.Log.Information("SemVer = {semver}", SemVer);
Information("SemVer = {semver}", SemVer);
});

bool IsPullRequest => BranchSpec != null && BranchSpec.Contains("pull", StringComparison.InvariantCultureIgnoreCase);
Expand Down Expand Up @@ -198,7 +200,7 @@ class Build : NukeBuild
.SetAssemblyFilters("+FluentAssertions"));
string link = TestResultsDirectory / "reports" / "index.html";
Serilog.Log.Information($"Code coverage report: \x1b]8;;file://{link.Replace('\\', '/')}\x1b\\{link}\x1b]8;;\x1b\\");
Information($"Code coverage report: \x1b]8;;file://{link.Replace('\\', '/')}\x1b\\{link}\x1b]8;;\x1b\\");
});

Target TestFrameworks => _ => _
Expand Down Expand Up @@ -293,12 +295,10 @@ string[] Changes
{
get
{
using var repo = new Repository(GitRepository.LocalDirectory);

Tree targetBranch = repo.Branches[PullRequestBase].Tip.Tree;
Tree sourceBranch = repo.Branches[repo.Head.FriendlyName].Tip.Tree;
Tree targetBranch = Repository.Branches[PullRequestBase].Tip.Tree;
Tree sourceBranch = Repository.Branches[Repository.Head.FriendlyName].Tip.Tree;

return repo.Diff
return Repository.Diff
.Compare<TreeChanges>(targetBranch, sourceBranch)
.Where(x => x.Exists)
.Select(x => x.Path)
Expand Down

0 comments on commit b7b4de5

Please sign in to comment.