-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2733 from github/cake
.cake
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// ARGUMENTS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
var target = Argument<string>("target", "Default"); | ||
var configuration = Argument<string>("configuration", "Release"); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// GLOBAL VARIABLES | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
var solutions = GetFiles("./**/*.sln"); | ||
var solutionPaths = solutions.Select(solution => solution.GetDirectory()); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// SETUP / TEARDOWN | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Setup(() => | ||
{ | ||
// Executed BEFORE the first task. | ||
Information("Running tasks..."); | ||
}); | ||
|
||
Teardown(() => | ||
{ | ||
// Executed AFTER the last task. | ||
Information("Finished running tasks."); | ||
}); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// TASK DEFINITIONS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Task("Clean") | ||
.Does(() => | ||
{ | ||
// Clean solution directories. | ||
foreach(var path in solutionPaths) | ||
{ | ||
Information("Cleaning {0}", path); | ||
CleanDirectories(path + "/**/bin/" + configuration); | ||
CleanDirectories(path + "/**/obj/" + configuration); | ||
} | ||
}); | ||
|
||
Task("Restore") | ||
.Does(() => | ||
{ | ||
// Restore all NuGet packages. | ||
foreach(var solution in solutions) | ||
{ | ||
Information("Restoring {0}...", solution); | ||
NuGetRestore(solution); | ||
} | ||
}); | ||
|
||
Task("Build") | ||
.IsDependentOn("Clean") | ||
.IsDependentOn("Restore") | ||
.Does(() => | ||
{ | ||
// Build all solutions. | ||
foreach(var solution in solutions) | ||
{ | ||
Information("Building {0}", solution); | ||
MSBuild(solution, settings => | ||
settings.SetPlatformTarget(PlatformTarget.MSIL) | ||
.WithProperty("TreatWarningsAsErrors","true") | ||
.WithTarget("Build") | ||
.SetConfiguration(configuration)); | ||
} | ||
}); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// TARGETS | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
Task("Default") | ||
.IsDependentOn("Build"); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// EXECUTION | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
RunTarget(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
fs = require 'fs' | ||
|
||
{print} = require 'sys' | ||
{spawn} = require 'child_process' | ||
|
||
build = (callback) -> | ||
coffee = spawn 'coffee', ['-c', '-o', '.', '.'] | ||
coffee.stderr.on 'data', (data) -> | ||
process.stderr.write data.toString() | ||
coffee.stdout.on 'data', (data) -> | ||
print data.toString() | ||
coffee.on 'exit', (code) -> | ||
callback?() if code is 0 | ||
|
||
task 'build', 'Build from source', -> | ||
build() | ||
|