Skip to content

Commit

Permalink
Added comments and other nice things
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll committed Jul 4, 2019
1 parent d9953a5 commit 8eec2d3
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/Nuke/CustomDotNetBuildExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace Rocket.Surgery.Nuke
{
/// <summary>
/// Custom msbuild helper extensions
/// </summary>
public static class CustomDotNetBuildExtensions
{
/// <summary>
Expand Down
25 changes: 23 additions & 2 deletions src/Nuke/DotNetCoreBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,31 @@

namespace Rocket.Surgery.Nuke
{
/// <summary>
/// Base build plan for .NET Core based applications
/// </summary>
public abstract class DotNetCoreBuild : RocketBoosterBuild
{
/// <summary>
/// Core target that can be used to trigger all targets for this build
/// </summary>
public Target Core => _ => _;

public Target InstallTools => _ => _
/// <summary>
/// This will ensure that all local dotnet tools are installed
/// </summary>
public Target DotnetToolRestore => _ => _
.DependsOn(Clean)
.DependentFor(Core)
.Unlisted()
.Executes(() => DotNet("tool restore"));

/// <summary>
/// dotnet restore
/// </summary>
public Target Restore => _ => _
.DependentFor(Core)
.DependsOn(InstallTools)
.DependsOn(DotnetToolRestore)
.Executes(() =>
{
DotNetRestore(s => s
Expand All @@ -33,6 +45,9 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
);
});

/// <summary>
/// dotnet build
/// </summary>
public Target Build => _ => _
.DependsOn(Restore)
.DependentFor(Core)
Expand All @@ -47,6 +62,9 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
.EnableNoRestore());
});

/// <summary>
/// dotnet test
/// </summary>
public Target Test => _ => _
.DependsOn(Build)
.DependentFor(Core)
Expand Down Expand Up @@ -87,6 +105,9 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
.SetProperty("VSTestResultsDirectory", TestResultsDirectory));
});

/// <summary>
/// dotnet pack
/// </summary>
public Target Pack => _ => _
.DependsOn(Build)
.DependentFor(Core)
Expand Down
1 change: 1 addition & 0 deletions src/Nuke/Rocket.Surgery.Nuke.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" />
Expand Down
67 changes: 65 additions & 2 deletions src/Nuke/RocketBoosterBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,87 @@
using static Nuke.Common.Tools.VSWhere.VSWhereTasks;
using System.IO;
using System.Linq;
using System.ComponentModel;

namespace Rocket.Surgery.Nuke
{
/// <summary>
/// Base build plan and tasks
/// </summary>
public abstract class RocketBoosterBuild : NukeBuild
{
/// <summary>
/// Configuration to build - Default is 'Debug' (local) or 'Release' (server)
/// </summary>
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
public readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

/// <summary>
/// The solution currently being build
/// </summary>
[Solution] public readonly Solution Solution;

/// <summary>
/// The Git Repository currently being built
/// </summary>
[GitRepository] public readonly GitRepository GitRepository;

/// <summary>
/// The Git Version information either computed by GitVersion itself, or as defined by environment variables of the format `GITVERSION_*`
/// </summary>
[ComputedGitVersion] public readonly GitVersion GitVersion;

/// <summary>
/// The directory where samples will be placed
/// </summary>
public AbsolutePath SampleDirectory => RootDirectory / "sample";

/// <summary>
/// The directory where sources will be placed
/// </summary>
public AbsolutePath SourceDirectory => RootDirectory / "src";

/// <summary>
/// The directory where templates will be placed
/// </summary>
public AbsolutePath TemplatesDirectory => RootDirectory / "templates";

/// <summary>
/// The directory where tests will be placed
/// </summary>
public AbsolutePath TestDirectory => RootDirectory / "test";
public AbsolutePath ArtifactsDirectory => Variable("Artifacts") != null ? (AbsolutePath)Variable("Artifacts") : RootDirectory / "artifacts";


/// <summary>
/// The directory where artifacts are to be dropped
/// </summary>
[Parameter("The directory where artifacts are to be dropped", Name = "Artifacts")]
public readonly AbsolutePath ArtifactsDirectory = Variable("Artifacts") != null ? (AbsolutePath)Variable("Artifacts") : RootDirectory / "artifacts";

/// <summary>
/// The directory where logs will be placed
/// </summary>
public AbsolutePath LogsDirectory => ArtifactsDirectory / "logs";

/// <summary>
/// The directory where test results will be placed
/// </summary>
public AbsolutePath TestResultsDirectory => ArtifactsDirectory / "test";

/// <summary>
/// The directory where nuget packages will be placed
/// </summary>
public AbsolutePath NuGetPackageDirectory => ArtifactsDirectory / "nuget";
public AbsolutePath CoverageDirectory => Variable("Coverage") != null ? (AbsolutePath)Variable("Coverage") : RootDirectory / "coverage";

/// <summary>
/// The directory where coverage artifacts are to be dropped
/// </summary>
[Parameter("The directory where coverage artifacts are to be dropped", Name = "Coverage")]
public readonly AbsolutePath CoverageDirectory = Variable("Coverage") != null ? (AbsolutePath)Variable("Coverage") : RootDirectory / "coverage";

/// <summary>
/// clean all artifact directories
/// </summary>
public Target Clean => _ => _
.Executes(() =>
{
Expand All @@ -54,6 +113,10 @@ public abstract class RocketBoosterBuild : NukeBuild
TestDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
});


/// <summary>
/// This will generate code coverage reports from emitted coverage data
/// </summary>
public Target Generate_Code_Coverage_Reports => _ => _
.Description("Generates code coverage reports")
.Unlisted()
Expand Down

0 comments on commit 8eec2d3

Please sign in to comment.