Skip to content

Instantly share code, notes, and snippets.

@jrgcubano
Last active January 3, 2018 19:45
Show Gist options
  • Save jrgcubano/21d211c26d88aad83a483b5dec5be658 to your computer and use it in GitHub Desktop.
Save jrgcubano/21d211c26d88aad83a483b5dec5be658 to your computer and use it in GitHub Desktop.
Playing with multiple cake scripts

Run with:

.\build.ps1 -Script "pack.cake" -script="pack.cake" -verbosity="diagnostic"

Arguments for this case:

  • -Script is to specify running script
  • -script is to pass the argument

We need both so Cake start analizyng scripts from the specified root and not all

Preparing to run build script...
Running build script...
Module directory does not exist.
Analyzing build script...
Analyzing C:/dev/Projects/cake-examples/multiple-launchers/pack.cake...
Analyzing C:/dev/Projects/cake-examples/multiple-launchers/common.cake...
Processing build script...
#load "local:?path=./common.cake"
#load "local:?path=./restore.cake"
target = "Build";
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
Information("Building...");
});
RunTargetIfScript("build.cake");
var target = Argument<string>("target", "Default");
public void RunTargetIfScript(string current)
{
if (current == Argument<string>("Script"))
{
RunTarget(target);
}
}
#load "local:?path=./common.cake"
target = "Package";
Task("Package")
.Does(() =>
{
Information("Packaging...");
});
RunTargetIfScript("pack.cake");
#load "local:?path=./common.cake"
target = "Restore";
Task("Restore")
.Does(() =>
{
Information("Restoring...");
});
RunTargetIfScript("restore.cake");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment