Skip to content

Instantly share code, notes, and snippets.

@devlead
Created November 2, 2016 22:59
Show Gist options
  • Save devlead/9d4b66910cfa6787d034c86b58188db9 to your computer and use it in GitHub Desktop.
Save devlead/9d4b66910cfa6787d034c86b58188db9 to your computer and use it in GitHub Desktop.
Sample Cake Inject Task dependency

Inject Task dependency

a.cake

Task "A" knows nothing about Task "B"

b.cake

Task "B" knows about Task A and injects it self as an depencency to Task "A"

build.cake

Loads a.cake & b.cake then runs target "A"

Output

========================================
B
========================================
Hello from B

========================================
A
========================================
Hello from A

Task                          Duration
--------------------------------------------------
B                             00:00:00.0091011
A                             00:00:00.0027056
--------------------------------------------------
Total:                        00:00:00.0118067
var taskA = Task("A")
.Does(()=>Information("Hello from A"));
var taskB = Task("B")
.Does(()=>Information("Hello from B"));
taskA.IsDependentOn(taskB.Task.Name);
#load "a.cake"
#load "b.cake"
RunTarget("A");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment