Skip to content

Commit

Permalink
Update to cake.core 0.19.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aabenoja committed Mar 29, 2017
1 parent 64eabde commit 7f54cf7
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 62 deletions.
35 changes: 24 additions & 11 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@ var isPaketInstalled = FileExists(paketPath);
var target = Argument("target", "default");

Task("bootstrap-paket")
.WithCriteria(!isPaketInstalled)
.Does(() =>
.WithCriteria(!isPaketInstalled)
.Does(() =>
{
if (StartProcess(".paket/paket.bootstrapper.exe") != 0)
{
if (StartProcess(".paket/paket.bootstrapper.exe") != 0)
Error("Unable to fetch paket.exe");
Error("Unable to fetch paket.exe");
}

paketPath = ".paket/paket.exe";
});
paketPath = ".paket/paket.exe";
});

Task("paket-restore")
.IsDependentOn("bootstrap-paket")
.Does(() =>
.IsDependentOn("bootstrap-paket")
.Does(() =>
{
if (StartProcess(paketPath, "restore") != 0)
{
if (StartProcess(paketPath, "restore") != 0)
Error("Paket restore failed");
});
Error("Paket restore failed");
}
});

Task("compile")
.IsDependentOn("paket-restore")
Expand All @@ -30,6 +34,15 @@ Task("compile")
MSBuild("./src/Cake.Parallel.sln");
});

Task("compile-release")
.IsDependentOn("paket-restore")
.Does(() =>
{
MSBuild("./src/Cake.Parallel.sln", new MSBuildSettings {
Configuration = "Release"
});
});

Task("xUnit")
.IsDependentOn("compile")
.Does(() =>
Expand Down
4 changes: 2 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
framework: net461
source http://nuget.org/api/v2

nuget Cake.Core 0.15.0
nuget Cake.Core 0.19.1
nuget Cake.Testing
nuget Shouldly
nuget xunit
nuget xunit
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FRAMEWORK: NET461
NUGET
remote: http://www.nuget.org/api/v2
Cake.Core (0.15)
Cake.Core (0.19.1)
Cake.Testing (0.15)
Cake.Core (>= 0.15)
Shouldly (2.8.2)
Expand Down
1 change: 1 addition & 0 deletions src/Cake.Parallel/Cake.Parallel.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<Compile Include="ParallelCakeModule.cs" />
<Compile Include="ParallelGraphBuilder.cs" />
<Compile Include="ParallelGraphExtensions.cs" />
<Compile Include="ParallelActionTaskExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
12 changes: 12 additions & 0 deletions src/Cake.Parallel/ParallelActionTaskExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Cake.Core;

namespace Cake.Parallel.Module
{
public static class ParallelActionTaskExtensions
{
public static CakeTaskBuilder<ActionTask> IgnoreCancellation(this CakeTaskBuilder<ActionTask> task)
{
return task;
}
}
}
63 changes: 17 additions & 46 deletions src/Cake.Parallel/ParallelCakeEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public CakeReport RunTarget(ICakeContext context, IExecutionStrategy strategy, s

var report = new CakeReport();


var targetTask = graph.Traverse(target, (taskName, cts) =>
{
if (cts.IsCancellationRequested) return;
Expand Down Expand Up @@ -120,6 +121,12 @@ public CakeReport RunTarget(ICakeContext context, IExecutionStrategy strategy, s
exceptionWasThrown = true;
throw;
}
catch(AggregateException ex)
{
exceptionWasThrown = true;
thrownException = ex.InnerException;
throw;
}
catch (Exception ex)
{
exceptionWasThrown = true;
Expand All @@ -142,11 +149,6 @@ public void RegisterTaskTeardownAction(Action<ITaskTeardownContext> action)
_taskTeardownAction = action;
}

public event EventHandler<SetupEventArgs> Setup;
public event EventHandler<TeardownEventArgs> Teardown;
public event EventHandler<TaskSetupEventArgs> TaskSetup;
public event EventHandler<TaskTeardownEventArgs> TaskTeardown;

private void performSetup(IExecutionStrategy strategy, ICakeContext context)
{
publishEvent(Setup, new SetupEventArgs(context));
Expand Down Expand Up @@ -225,6 +227,11 @@ private void executeTask(ICakeContext context, IExecutionStrategy strategy, Canc
{
strategy.Execute(task, context);
}
catch (TaskCanceledException)
{
execptionWasThrown = true;
throw;
}
catch (Exception exception)
{
execptionWasThrown = true;
Expand Down Expand Up @@ -346,46 +353,10 @@ public void performTaskTeardown(ICakeContext context, IExecutionStrategy strateg
}
}

public IReadOnlyList<CakeTask> Tasks { get; }
}

public class SetupEventArgs : EventArgs
{
public ICakeContext Context { get; }

public SetupEventArgs(ICakeContext context)
{
Context = context;
}
}

public class TeardownEventArgs : EventArgs
{
public ITeardownContext TeardownContext { get; }

public TeardownEventArgs(ITeardownContext teardownContext)
{
TeardownContext = teardownContext;
}
}

public class TaskSetupEventArgs : EventArgs
{
public ITaskSetupContext TaskSetupContext { get; }

public TaskSetupEventArgs(ITaskSetupContext taskSetupContext)
{
TaskSetupContext = taskSetupContext;
}
}

public class TaskTeardownEventArgs : EventArgs
{
public ITaskTeardownContext TaskTeardownContext { get; }

public TaskTeardownEventArgs(ITaskTeardownContext taskTeardownContext)
{
TaskTeardownContext = taskTeardownContext;
}
public IReadOnlyList<CakeTask> Tasks => _tasks;
public event EventHandler<SetupEventArgs> Setup;
public event EventHandler<TeardownEventArgs> Teardown;
public event EventHandler<TaskSetupEventArgs> TaskSetup;
public event EventHandler<TaskTeardownEventArgs> TaskTeardown;
}
}
4 changes: 2 additions & 2 deletions src/Cake.Parallel/ParallelCakeModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Cake.Parallel.Module
{
public class ParallelCakeModule : ICakeModule
{
public void Register(ICakeContainerRegistry registry)
public void Register(ICakeContainerRegistrar registrar)
{
registry.RegisterType<ParallelCakeEngine>().As<ICakeEngine>().Singleton();
registrar.RegisterType<ParallelCakeEngine>().As<ICakeEngine>().Singleton();
}
}
}

0 comments on commit 7f54cf7

Please sign in to comment.