Skip to content

Instantly share code, notes, and snippets.

@wallymathieu
Created October 8, 2016 15:18
Show Gist options
  • Select an option

  • Save wallymathieu/9881e41c6db19f72aedc9b8d4b6c8522 to your computer and use it in GitHub Desktop.

Select an option

Save wallymathieu/9881e41c6db19f72aedc9b8d4b6c8522 to your computer and use it in GitHub Desktop.
Side by side comparison of cake and fake
let verboseBuild verbosity (defaults:MSBuildParams)=
{ defaults with Verbosity = Some(verbosity) }
let quietBuild = verboseBuild Quiet
let withTargets targets (defaults:MSBuildParams)=
{ defaults with Targets = targets }
let rebuildBuild = withTargets ["ReBuild"]
let buildModeConfiguration buildMode (defaults:MSBuildParams)=
{ defaults with
Properties =
[
"Configuration", getBuildParamOrDefault "buildMode" buildMode
]
}
let deployOnBuild output (defaults:MSBuildParams)=
{ defaults with
Properties = ("DeployOnBuild", output) :: defaults.Properties
}
let deployTarget output (defaults:MSBuildParams)=
{ defaults with
Properties = ("DeployTarget", output) :: defaults.Properties
}
let packageLocation output (defaults:MSBuildParams)=
{ defaults with
Properties = ("PackageLocation", output) :: defaults.Properties
}
let publishProfile output (defaults:MSBuildParams)=
{ defaults with
Properties = ("PublishProfile", output) :: defaults.Properties
}
let withPlatform platform (defaults:MSBuildParams)=
{ defaults with
Properties = ("Platform", platform) :: defaults.Properties
}
Target "clean" (fun _ ->
CleanDirs ["TestResults"]
build ((buildModeConfiguration "Release") >> quietBuild >> withTargets ["Clean"]) "solution.sln"
)
Target "package" (fun _ ->
build ((buildModeConfiguration "Release")
>> deployTarget "Package"
>> quietBuild
>> withPlatform "AnyCPU"
>> publishProfile "Release"
>> packageLocation "./Web.zip"
>> deployOnBuild "true" ) "./Web/Web.csproj"
|> ignore
)
"clean"
==> "package"
Task("Clean")
.Does(() =>
{
CleanDirectories(new[] { "./TestResults" });
var settings=new MSBuildSettings()
.SetConfiguration("Release")
.UseToolVersion(MSBuildToolVersion.VS2015)
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false);
settings.Targets.Add("Clean");
MSBuild("solution.sln", settings);
});
Task("Package")
.IsDependentOn("NuGet-Package-Restore")
.IsDependentOn("Clean")
.Does(() =>
{
MSBuild("./Web/Web.csproj", new MSBuildSettings()
.SetConfiguration("Release")
.WithProperty("DeployOnBuild", "True")
.WithProperty("DeployTarget", "Package")
.WithProperty("Platform","AnyCPU")
.WithProperty("PackageLocation","./Web.zip")
.UseToolVersion(MSBuildToolVersion.VS2015)
.SetVerbosity(Verbosity.Minimal)
.SetNodeReuse(false));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment