Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
0x53A committed Oct 26, 2016
1 parent 0b759cf commit a638345
Show file tree
Hide file tree
Showing 59 changed files with 388 additions and 544 deletions.
4 changes: 1 addition & 3 deletions src/app/Fake.IIS/IISExpress.fs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ let createConfigFile (name, siteId : int, templateFileName, path, hostName, port
let HostWebsite setParams configFileName siteId =
let parameters = setParams IISExpressDefaults

traceStartTask "StartWebSite" configFileName
use __ = traceStartTaskUsing "StartWebSite" configFileName
let args = sprintf "/config:\"%s\" /siteid:%d" configFileName siteId
tracefn "Starting WebSite with %s %s" parameters.ToolPath args

let proc =
ProcessStartInfo(FileName = parameters.ToolPath, Arguments = args, UseShellExecute = false)
|> Process.Start

traceEndTask "StartWebSite" configFileName

proc

/// Opens the given url in the browser
Expand Down
12 changes: 4 additions & 8 deletions src/app/FakeLib/AssemblyInfoFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ let private getSortedAndNumberedAttributes (attrs: seq<Attribute>) =
/// Creates a C# AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateCSharpAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
traceStartTask "AssemblyInfo" outputFileName
use __ = traceStartTaskUsing "AssemblyInfo" outputFileName
let generateClass, useNamespace, emitResharperSupressions = config.GenerateClass, config.UseNamespace, config.EmitResharperSuppressions

let dependencies =
Expand Down Expand Up @@ -226,12 +226,11 @@ let CreateCSharpAssemblyInfoWithConfig outputFileName attributes (config : Assem

attributeLines @ sourceLines
|> writeToFile outputFileName
traceEndTask "AssemblyInfo" outputFileName

/// Creates a F# AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateFSharpAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
traceStartTask "AssemblyInfo" outputFileName
use __ = traceStartTaskUsing "AssemblyInfo" outputFileName
let generateClass, useNamespace = config.GenerateClass, config.UseNamespace

let sourceLines =
Expand All @@ -257,12 +256,11 @@ let CreateFSharpAssemblyInfoWithConfig outputFileName attributes (config : Assem
]

sourceLines |> writeToFile outputFileName
traceEndTask "AssemblyInfo" outputFileName

/// Creates a VB AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateVisualBasicAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
traceStartTask "AssemblyInfo" outputFileName
use __ = traceStartTaskUsing "AssemblyInfo" outputFileName
let generateClass, useNamespace = config.GenerateClass, config.UseNamespace

let attributeLines =
Expand All @@ -284,12 +282,11 @@ let CreateVisualBasicAssemblyInfoWithConfig outputFileName attributes (config :

attributeLines @ sourceLines
|> writeToFile outputFileName
traceEndTask "AssemblyInfo" outputFileName

/// Creates a C++/CLI AssemblyInfo file with the given attributes and configuration.
/// Does not generate an AssemblyVersionInformation class.
let CreateCppCliAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
traceStartTask "AssemblyInfo" outputFileName
use __ = traceStartTaskUsing "AssemblyInfo" outputFileName
let generateClass, useNamespace = config.GenerateClass, config.UseNamespace
//C++/CLI namespaces cannot be fully qualified; you must
// namespace Namespace1 { namespace Namespace2 { }} //etc
Expand All @@ -303,7 +300,6 @@ let CreateCppCliAssemblyInfoWithConfig outputFileName attributes (config : Assem

attributeLines
|> writeToFile outputFileName
traceEndTask "AssemblyInfo" outputFileName

/// Creates a C# AssemblyInfo file with the given attributes.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
Expand Down
3 changes: 1 addition & 2 deletions src/app/FakeLib/AssemblyInfoHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ let generateFile param (attributes : Dictionary<string, string>) imports (writer
[<Obsolete("Please use the new AssemblyInfoFile tasks")>]
let AssemblyInfo setParams =
let param' = setParams AssemblyInfoDefaults
traceStartTask "AssemblyInfo" param'.OutputFileName
use __ = traceStartTaskUsing "AssemblyInfo" param'.OutputFileName
let param'' =
if param'.AssemblyFileVersion <> String.Empty then param'
else { param' with AssemblyFileVersion = param'.AssemblyVersion }
Expand Down Expand Up @@ -199,7 +199,6 @@ let AssemblyInfo setParams =
writer.Flush()
writer.Close()
tracefn "Created AssemblyInfo file \"%s\"." param.OutputFileName
traceEndTask "AssemblyInfo" param'.OutputFileName

type AssemblyInfoReplacementParams =
{ OutputFileName : string
Expand Down
3 changes: 1 addition & 2 deletions src/app/FakeLib/CMake.fs
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,13 @@ module CMake =
// CMake expects the binary directory to be passed as an argument.
let arguments = if (String.IsNullOrEmpty args) then "\"" + binaryDir + "\"" else args
let fullCommand = cmakeExe + " " + arguments
traceStartTask "CMake" fullCommand
use __ = traceStartTaskUsing "CMake" fullCommand
let setInfo (info:ProcessStartInfo) =
info.FileName <- cmakeExe
info.WorkingDirectory <- binaryDir
info.Arguments <- arguments
let result = ExecProcess (setInfo) timeout
if result <> 0 then failwithf "CMake failed with exit code %i." result
traceEndTask "CMake" fullCommand

/// Calls `cmake` to generate a project.
/// ## Parameters
Expand Down
3 changes: 1 addition & 2 deletions src/app/FakeLib/ChocoHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,12 @@ module Choco =
let found = FindExe
if found <> None then found.Value else failwith "Cannot find the choco executable."

traceStartTask "choco" args
use __ = traceStartTaskUsing "choco" args
let setInfo (info:ProcessStartInfo) =
info.FileName <- chocoExe
info.Arguments <- args
let result = ExecProcess (setInfo) timeout
if result <> 0 then failwithf "choco failed with exit code %i." result
traceEndTask "choco" args

let private getTempFolder =
let tempFolder = directoryInfo (Path.GetTempPath() @@ "FakeChocolateyPack")
Expand Down
3 changes: 1 addition & 2 deletions src/app/FakeLib/CscHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ let csc (setParams : CscParams -> CscParams) (inputFiles : string list) : int =
let debug = if cscParams.Debug then [ "/debug" ] else []
let argList =
output @ target @ platform @ references @ debug @ cscParams.OtherParams
traceStartTask "Csc " taskDesc
use __ = traceStartTaskUsing "Csc " taskDesc
let res = cscExe cscParams.ToolPath inputFiles argList
traceEndTask "Csc " taskDesc
res

/// Compiles one or more C# source files with the specified parameters.
Expand Down
4 changes: 1 addition & 3 deletions src/app/FakeLib/DocFxHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let DocFxDefaults =
let DocFx setParams =
let parameters = DocFxDefaults |> setParams

traceStartTask "DocFx" parameters.DocFxJson
use __ = traceStartTaskUsing "DocFx" parameters.DocFxJson

let serveArg = if parameters.Serve then "--serve" else ""
let configArg = parameters.DocFxJson |> FullName
Expand All @@ -54,6 +54,4 @@ let DocFx setParams =
info.WorkingDirectory <- parameters.WorkingDirectory
) parameters.Timeout
then failwith "DocFx generation failed."

traceEndTask "DocFx" parameters.DocFxJson

3 changes: 1 addition & 2 deletions src/app/FakeLib/DocuHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ let DocuDefaults =
/// - `assemblies` - Sequence of one or more assemblies containing the XML docs.
let Docu setParams assemblies =
let details = assemblies |> separated ", "
traceStartTask "Docu" details
use __ = traceStartTaskUsing "Docu" details
let parameters = DocuDefaults |> setParams

let files =
Expand All @@ -46,4 +46,3 @@ let Docu setParams assemblies =
info.FileName <- parameters.ToolPath |> FullName
info.Arguments <- args) parameters.TimeOut
then failwith "Documentation generation failed."
traceEndTask "Docu" details
95 changes: 40 additions & 55 deletions src/app/FakeLib/DotCover.fs
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,16 @@ let DotCoverReport (setParams: DotCoverReportParams -> DotCoverReportParams) =
let DotCoverNUnit (setDotCoverParams: DotCoverParams -> DotCoverParams) (setNUnitParams: NUnitParams -> NUnitParams) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverNUnit" details
use __ = traceStartTaskUsing "DotCoverNUnit" details

try
let parameters = NUnitDefaults |> setNUnitParams
let args = buildNUnitdArgs parameters assemblies
let parameters = NUnitDefaults |> setNUnitParams
let args = buildNUnitdArgs parameters assemblies

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath @@ parameters.ToolName
TargetArguments = args
} |> setDotCoverParams)
finally
traceEndTask "DotCoverNUnit" details
DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath @@ parameters.ToolName
TargetArguments = args
} |> setDotCoverParams)

/// Runs the dotCover "cover" command against the NUnit test runner.
/// ## Parameters
Expand All @@ -213,19 +210,16 @@ let DotCoverNUnit (setDotCoverParams: DotCoverParams -> DotCoverParams) (setNUni
let DotCoverNUnit3 (setDotCoverParams: DotCoverParams -> DotCoverParams) (setNUnitParams: NUnit3Params -> NUnit3Params) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverNUnit3" details
use __ = traceStartTaskUsing "DotCoverNUnit3" details

try
let parameters = NUnit3Defaults |> setNUnitParams
let args = buildNUnit3Args parameters assemblies
let parameters = NUnit3Defaults |> setNUnitParams
let args = buildNUnit3Args parameters assemblies

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)
finally
traceEndTask "DotCoverNUnit3" details
DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)

/// Runs the dotCover "cover" command against the XUnit2 test runner.
/// ## Parameters
Expand All @@ -242,19 +236,16 @@ let DotCoverNUnit3 (setDotCoverParams: DotCoverParams -> DotCoverParams) (setNUn
let DotCoverXUnit2 (setDotCoverParams: DotCoverParams -> DotCoverParams) (setXUnit2Params: XUnit2Params -> XUnit2Params) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverXUnit2" details
use __ = traceStartTaskUsing "DotCoverXUnit2" details

try
let parameters = XUnit2Defaults |> setXUnit2Params
let args = buildXUnit2Args assemblies parameters
let parameters = XUnit2Defaults |> setXUnit2Params
let args = buildXUnit2Args assemblies parameters

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)
finally
traceEndTask "DotCoverXUnit2" details
DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)

/// Builds the command line arguments from the given parameter record and the given assemblies.
/// Runs all test assemblies in the same run for easier coverage management.
Expand Down Expand Up @@ -290,19 +281,16 @@ let internal buildMSTestArgsForDotCover parameters assemblies =
let DotCoverMSTest (setDotCoverParams: DotCoverParams -> DotCoverParams) (setMSTestParams: MSTestParams -> MSTestParams) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverMSTest " details
use __ = traceStartTaskUsing "DotCoverMSTest " details

try
let parameters = MSTestDefaults |> setMSTestParams
let args = buildMSTestArgsForDotCover parameters assemblies
let parameters = MSTestDefaults |> setMSTestParams
let args = buildMSTestArgsForDotCover parameters assemblies

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)
finally
traceEndTask "DotCoverMSTest" details
DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)

/// Runs the dotCover "cover" command against the MSpec test runner.
/// ## Parameters
Expand All @@ -321,17 +309,14 @@ let DotCoverMSTest (setDotCoverParams: DotCoverParams -> DotCoverParams) (setMST
let DotCoverMSpec (setDotCoverParams: DotCoverParams -> DotCoverParams) (setMSpecParams: MSpecParams -> MSpecParams) (assemblies: string seq) =
let assemblies = assemblies |> Seq.toArray
let details = assemblies |> separated ", "
traceStartTask "DotCoverMSpec" details
use __ = traceStartTaskUsing "DotCoverMSpec" details

try
let parameters = MSpecDefaults |> setMSpecParams
let parameters = MSpecDefaults |> setMSpecParams

let args = buildMSpecArgs parameters assemblies
let args = buildMSpecArgs parameters assemblies

DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)
finally
traceEndTask "DotCoverMSpec" details
DotCover (fun p ->
{p with
TargetExecutable = parameters.ToolPath
TargetArguments = args
} |> setDotCoverParams)
Loading

0 comments on commit a638345

Please sign in to comment.