Skip to content

Commit

Permalink
Merge pull request #2 from RocketSurgeonsGuild/feature/refactor
Browse files Browse the repository at this point in the history
refactored to create DotNetCore package
  • Loading branch information
RLittlesII authored Jul 18, 2019
2 parents 8006928 + 17297f1 commit 60b7561
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 35 deletions.
1 change: 1 addition & 0 deletions .build/.build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="GitVersion.CommandLine.DotNetCore" />
<PackageReference Include="ReportGenerator" />
<ProjectReference Include="../src/Nuke/Rocket.Surgery.Nuke.csproj" />
<ProjectReference Include="../src/Nuke.DotNetCore/Rocket.Surgery.Nuke.DotNetCore.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion .build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Nuke.Common;
using Nuke.Common.Execution;
using Rocket.Surgery.Nuke;
using Rocket.Surgery.Nuke.DotNetCore;

[CheckBuildProjectConfigurations]
[UnsetVisualStudioEnvironmentVariables]
Expand All @@ -16,5 +17,5 @@ class Program : DotNetCoreBuild

public static int Main() => Execute<Program>(x => x.Default);

Target Default => _ => _.DependsOn(Core);
Target Default => _ => _.DependsOn(DotNetCore);
}
15 changes: 15 additions & 0 deletions Nuke.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rocket.Surgery.Nuke", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rocket.Surgery.Nuke.Tests", "test\Nuke.Tests\Rocket.Surgery.Nuke.Tests.csproj", "{29950FB4-8A41-4C83-9FE0-FEA9C8D0BF67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Rocket.Surgery.Nuke.DotNetCore", "src\Nuke.DotNetCore\Rocket.Surgery.Nuke.DotNetCore.csproj", "{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -67,6 +69,18 @@ Global
{29950FB4-8A41-4C83-9FE0-FEA9C8D0BF67}.Release|x64.Build.0 = Release|Any CPU
{29950FB4-8A41-4C83-9FE0-FEA9C8D0BF67}.Release|x86.ActiveCfg = Release|Any CPU
{29950FB4-8A41-4C83-9FE0-FEA9C8D0BF67}.Release|x86.Build.0 = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|x64.ActiveCfg = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|x64.Build.0 = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|x86.ActiveCfg = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Debug|x86.Build.0 = Debug|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|Any CPU.Build.0 = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|x64.ActiveCfg = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|x64.Build.0 = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|x86.ActiveCfg = Release|Any CPU
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -75,6 +89,7 @@ Global
{55EFAE2F-A7CA-4917-A381-4A6EF5E79610} = {E3DCB78E-EE06-4EA3-88AC-762D8910387C}
{C33C63CF-8760-4305-B9AC-14456930C867} = {8FFDF555-DB50-45F9-9A2D-6410F39151C3}
{29950FB4-8A41-4C83-9FE0-FEA9C8D0BF67} = {DF33E0FB-9790-4654-B60F-8AB22E0CC3D1}
{2D88A441-0EF9-40EF-8A1A-CE5E12F62660} = {8FFDF555-DB50-45F9-9A2D-6410F39151C3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {439897C2-CCBD-44FE-B2DC-A3E4670ADA59}
Expand Down
7 changes: 7 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Every good Rocket Surgeon needs multiple choices of build systems to pick from t
| Package | NuGet | MyGet |
| ------- | ----- | ----- |
| Rocket.Surgery.Nuke | [![nuget-version-6plqb7nwtdoa-badge]![nuget-downloads-6plqb7nwtdoa-badge]][nuget-6plqb7nwtdoa] | [![myget-version-6plqb7nwtdoa-badge]![myget-downloads-6plqb7nwtdoa-badge]][myget-6plqb7nwtdoa] |
| Rocket.Surgery.Nuke.DotNetCore | [![nuget-version-75gp65y/nhyw-badge]![nuget-downloads-75gp65y/nhyw-badge]][nuget-75gp65y/nhyw] | [![myget-version-75gp65y/nhyw-badge]![myget-downloads-75gp65y/nhyw-badge]][myget-75gp65y/nhyw] |
<!-- nuget packages -->

<!-- generated references -->
Expand All @@ -46,6 +47,12 @@ Every good Rocket Surgeon needs multiple choices of build systems to pick from t
[myget-6plqb7nwtdoa]: https://www.myget.org/feed/rocket-surgeons-guild/package/nuget/Rocket.Surgery.Nuke
[myget-version-6plqb7nwtdoa-badge]: https://img.shields.io/myget/rocket-surgeons-guild/vpre/Rocket.Surgery.Nuke.svg?label=myget&color=004880&logo=nuget&style=flat-square "MyGet Pre-Release Version"
[myget-downloads-6plqb7nwtdoa-badge]: https://img.shields.io/myget/rocket-surgeons-guild/dt/Rocket.Surgery.Nuke.svg?color=004880&logo=nuget&style=flat-square "MyGet Downloads"
[nuget-75gp65y/nhyw]: https://www.nuget.org/packages/Rocket.Surgery.Nuke.DotNetCore/
[nuget-version-75gp65y/nhyw-badge]: https://img.shields.io/nuget/v/Rocket.Surgery.Nuke.DotNetCore.svg?color=004880&logo=nuget&style=flat-square "NuGet Version"
[nuget-downloads-75gp65y/nhyw-badge]: https://img.shields.io/nuget/dt/Rocket.Surgery.Nuke.DotNetCore.svg?color=004880&logo=nuget&style=flat-square "NuGet Downloads"
[myget-75gp65y/nhyw]: https://www.myget.org/feed/rocket-surgeons-guild/package/nuget/Rocket.Surgery.Nuke.DotNetCore
[myget-version-75gp65y/nhyw-badge]: https://img.shields.io/myget/rocket-surgeons-guild/vpre/Rocket.Surgery.Nuke.DotNetCore.svg?label=myget&color=004880&logo=nuget&style=flat-square "MyGet Pre-Release Version"
[myget-downloads-75gp65y/nhyw-badge]: https://img.shields.io/myget/rocket-surgeons-guild/dt/Rocket.Surgery.Nuke.DotNetCore.svg?color=004880&logo=nuget&style=flat-square "MyGet Downloads"
<!-- generated references -->

<!-- nuke-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Nuke.Common.Tools.VSTest;
using Nuke.Common.Tools.VSWhere;

namespace Rocket.Surgery.Nuke
namespace Rocket.Surgery.Nuke.DotNetCore
{
/// <summary>
/// Base build plan for .NET Core based applications
Expand All @@ -17,23 +17,24 @@ 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 DotNetCore => _ => _;

/// <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>
// /// This will ensure that all local dotnet tools are installed
// /// </summary>
// public Target DotnetToolRestore => _ => _
// .DependsOn(Clean)
// .DependentFor(DotNetCore)
// .Unlisted()
// .Executes(() => DotNet("tool restore"));

/// <summary>
/// dotnet restore
/// </summary>
public Target Restore => _ => _
.DependentFor(Core)
.DependsOn(DotnetToolRestore)
.DependentFor(DotNetCore)
// .DependsOn(DotnetToolRestore)
.DependsOn(Clean)
.Executes(() =>
{
DotNetRestore(s => s
Expand All @@ -50,7 +51,7 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
/// </summary>
public Target Build => _ => _
.DependsOn(Restore)
.DependentFor(Core)
.DependentFor(DotNetCore)
.Executes(() =>
{
DotNetBuild(s => s
Expand All @@ -67,10 +68,10 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
/// </summary>
public Target Test => _ => _
.DependsOn(Build)
.DependentFor(Core)
.DependentFor(DotNetCore)
.DependentFor(Pack)
.Triggers(Generate_Code_Coverage_Reports)
.OnlyWhenDynamic(() => TestDirectory.GlobFiles("test/**/*.csproj").Count > 0)
.DependentFor(Generate_Code_Coverage_Reports)
.OnlyWhenDynamic(() => TestDirectory.GlobFiles("**/*.csproj").Count > 0)
.WhenSkipped(DependencyBehavior.Execute)
.Executes(() =>
{
Expand All @@ -92,25 +93,25 @@ public abstract class DotNetCoreBuild : RocketBoosterBuild
// .SetProperty("VSTestResultsDirectory", TestResultsDirectory));
// });
DotNetTest(s => s
.SetProjectFile(Solution)
.SetBinaryLogger(LogsDirectory / "test.binlog", IsLocalBuild ? MSBuildBinaryLogImports.None : MSBuildBinaryLogImports.Embed)
.SetFileLogger(LogsDirectory / "test.log", Verbosity)
.SetGitVersionEnvironment(GitVersion)
.SetConfiguration(Configuration)
.EnableNoRestore()
.SetLogger($"trx")
.SetProperty("CollectCoverage", true)
.SetProperty("CoverageDirectory", CoverageDirectory)
.SetProperty("VSTestResultsDirectory", TestResultsDirectory));
DotNetTest(s => s
.SetProjectFile(Solution)
.SetBinaryLogger(LogsDirectory / "test.binlog", IsLocalBuild ? MSBuildBinaryLogImports.None : MSBuildBinaryLogImports.Embed)
.SetFileLogger(LogsDirectory / "test.log", Verbosity)
.SetGitVersionEnvironment(GitVersion)
.SetConfiguration(Configuration)
.EnableNoRestore()
.SetLogger($"trx")
.SetProperty("CollectCoverage", true)
.SetProperty("CoverageDirectory", CoverageDirectory)
.SetProperty("VSTestResultsDirectory", TestResultsDirectory));
});

/// <summary>
/// dotnet pack
/// </summary>
public Target Pack => _ => _
.DependsOn(Build)
.DependentFor(Core)
.DependentFor(DotNetCore)
.Executes(() =>
{
DotNetPack(s => s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Rocket.Surgery.Nuke
namespace Rocket.Surgery.Nuke.DotNetCore
{
/// <summary>
/// What files to include in the binary log
Expand Down
16 changes: 16 additions & 0 deletions src/Nuke.DotNetCore/Rocket.Surgery.Nuke.DotNetCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Nuke\Rocket.Surgery.Nuke.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using Nuke.Common.Tooling;
using Newtonsoft.Json.Linq;

namespace Rocket.Surgery.Nuke
namespace Rocket.Surgery.Nuke.DotNetCore
{
/// <summary>
/// Custom msbuild helper extensions
/// </summary>
public static class CustomDotNetBuildExtensions
public static class ToolSettingsExtensions
{
/// <summary>
/// Configures binary logging for MSBuild
Expand Down
2 changes: 1 addition & 1 deletion src/Nuke/RocketBoosterBuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public abstract class RocketBoosterBuild : NukeBuild
public Target GenerateReadme => _ => _
.Unlisted()
.TriggeredBy(Clean)
.OnlyWhenDynamic(() => IsLocalBuild)
.OnlyWhenDynamic(() => IsLocalBuild && Force)
.Executes(() =>
{
var readmeContent = File.ReadAllText(RootDirectory / "Readme.md");
Expand Down
4 changes: 2 additions & 2 deletions test/Nuke.Tests/Rocket.Surgery.Nuke.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Nuke\Rocket.Surgery.Nuke.csproj" />
Expand Down

0 comments on commit 60b7561

Please sign in to comment.