Last active
July 14, 2019 06:38
-
-
Save jlouros/def8b01afa58c623077220bf0f6881ac to your computer and use it in GitHub Desktop.
Cake build sample file
This file contains hidden or 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
// arguments | |
string target = Argument("target", "Default"); | |
string configuration = Argument("configuration", "Release"); | |
// define directories. | |
ConvertableFilePath mainSln = File("./src/Example.sln"); | |
ConvertableDirectoryPath buildDir = Directory("./src/Example/bin") + Directory(configuration); | |
// tasks | |
Task("Clean") | |
.Does(() => | |
{ | |
CleanDirectory(buildDir); | |
}); | |
Task("Restore-NuGet-Packages") | |
.IsDependentOn("Clean") | |
.Does(() => | |
{ | |
NuGetRestore(mainSln); | |
}); | |
Task("Build") | |
.IsDependentOn("Restore-NuGet-Packages") | |
.Does(() => | |
{ | |
if(IsRunningOnWindows()) | |
{ | |
// Use MSBuild | |
MSBuild(mainSln, settings => settings.SetConfiguration(configuration)); | |
} | |
else | |
{ | |
// Use XBuild | |
XBuild(mainSln, settings => settings.SetConfiguration(configuration)); | |
} | |
}); | |
// task targets | |
Task("Default") | |
.IsDependentOn("Build"); | |
// execution | |
RunTarget(target); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment