Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Apr 15, 2018
1 parent b260bea commit f582480
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 139 deletions.
1 change: 1 addition & 0 deletions src/app/Fake.Core.String/StringBuilder.fs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[<RequireQualifiedAccess>]
module Fake.Core.StringBuilder
type String = System.String
type StringBuilder = System.Text.StringBuilder
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.NuGet/Install.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fake.DotNet.NuGet.Install

open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.Core
open Fake.DotNet.NuGet.Restore
open System
Expand Down
3 changes: 1 addition & 2 deletions src/app/Fake.DotNet.NuGet/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Fake.DotNet.NuGet.NuGet

open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down Expand Up @@ -81,7 +80,7 @@ let NuGetDefaults() =
{ ToolPath = findNuget (Shell.pwd() @@ "tools" @@ "NuGet")
TimeOut = TimeSpan.FromMinutes 5.
Version =
if not isLocalBuild then buildVersion
if not BuildServer.isLocalBuild then BuildServer.buildVersion
else "0.1.0.0"
Authors = []
Project = ""
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.NuGet/Restore.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Fake.DotNet.NuGet.Restore
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.NuGet/Update.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fake.DotNet.NuGet.Update

open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.DotNet.NuGet.NuGet
open Fake.Core
open System
Expand Down
5 changes: 2 additions & 3 deletions src/app/Fake.DotNet.Testing.MSTest/MSTest.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fake.DotNet.Testing.MSTest

open System
open System.Text
open Fake.Core.StringBuilder
open Fake.Core
open Fake.Testing.Common

Expand Down Expand Up @@ -84,8 +83,8 @@ let internal buildMSTestArgs parameters assembly =
|> StringBuilder.appendIfNotNull parameters.TestSettingsPath "/testsettings:"
|> StringBuilder.appendIfNotNull testResultsFile "/resultsfile:"
|> StringBuilder.appendIfTrue parameters.NoIsolation "/noisolation"
|> StringBuilder.forEach parameters.Tests appendIfNotNullOrEmpty "/test:"
|> StringBuilder.forEach parameters.Details appendIfNotNullOrEmpty "/detail:"
|> StringBuilder.forEach parameters.Tests StringBuilder.appendIfNotNullOrEmpty "/test:"
|> StringBuilder.forEach parameters.Details StringBuilder.appendIfNotNullOrEmpty "/detail:"
|> StringBuilder.toText

/// Runs MSTest command line tool on a group of assemblies.
Expand Down
4 changes: 1 addition & 3 deletions src/app/Fake.DotNet.Testing.MSpec/MSpec.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module Fake.DotNet.Testing.MSpec

open Fake.Testing.Common
open Fake.IO.FileSystemOperators
open Fake.Core.StringBuilder
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down Expand Up @@ -60,7 +58,7 @@ let internal buildMSpecArgs parameters assemblies =
let includes = parameters.IncludeTags |> String.separated ","
let excludes = parameters.ExcludeTags |> String.separated ","
new StringBuilder()
|> StringBuilder.appendIfTrue (buildServer = TeamCity) "--teamcity"
|> StringBuilder.appendIfTrue (BuildServer.buildServer = BuildServer.TeamCity) "--teamcity"
|> StringBuilder.appendIfTrue parameters.Silent "-s"
|> StringBuilder.appendIfTrue html "-t"
|> StringBuilder.appendIfTrue html htmlText
Expand Down
36 changes: 17 additions & 19 deletions src/app/Fake.DotNet.Testing.NUnit/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module Fake.DotNet.Testing.NUnit.Common

open Fake.Testing.Common
open Fake.IO.FileSystemOperators
open Fake.Core.StringBuilder
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down Expand Up @@ -156,23 +154,23 @@ let NUnitDefaults =
/// [omit]
let internal buildNUnitdArgs parameters assemblies =
new StringBuilder()
|> append "-nologo"
|> appendIfTrue parameters.DisableShadowCopy "-noshadow"
|> appendIfTrue parameters.ShowLabels "-labels"
|> appendIfTrue parameters.DontTestInNewThread "-nothread"
|> appendIfTrue parameters.StopOnError "-stoponerror"
|> appendFileNamesIfNotNull assemblies
|> appendIfNotNullOrEmpty parameters.IncludeCategory "-include:"
|> appendIfNotNullOrEmpty parameters.ExcludeCategory "-exclude:"
|> appendIfNotNullOrEmpty parameters.XsltTransformFile "-transform:"
|> appendIfNotNullOrEmpty parameters.OutputFile "-xml:"
|> appendIfNotNullOrEmpty parameters.Out "-out:"
|> appendIfNotNullOrEmpty parameters.Framework "-framework:"
|> appendIfNotNullOrEmpty parameters.ProcessModel.ParamString "-process:"
|> appendIfNotNullOrEmpty parameters.ErrorOutputFile "-err:"
|> appendIfNotNullOrEmpty parameters.Domain.ParamString "-domain:"
|> appendIfNotNullOrEmpty parameters.Fixture "-fixture:"
|> toText
|> StringBuilder.append "-nologo"
|> StringBuilder.appendIfTrue parameters.DisableShadowCopy "-noshadow"
|> StringBuilder.appendIfTrue parameters.ShowLabels "-labels"
|> StringBuilder.appendIfTrue parameters.DontTestInNewThread "-nothread"
|> StringBuilder.appendIfTrue parameters.StopOnError "-stoponerror"
|> StringBuilder.appendFileNamesIfNotNull assemblies
|> StringBuilder.appendIfNotNullOrEmpty parameters.IncludeCategory "-include:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.ExcludeCategory "-exclude:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.XsltTransformFile "-transform:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.OutputFile "-xml:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.Out "-out:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.Framework "-framework:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.ProcessModel.ParamString "-process:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.ErrorOutputFile "-err:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.Domain.ParamString "-domain:"
|> StringBuilder.appendIfNotNullOrEmpty parameters.Fixture "-fixture:"
|> StringBuilder.toText

/// Tries to detect the working directory as specified in the parameters or via TeamCity settings
/// [omit]
Expand Down
5 changes: 2 additions & 3 deletions src/app/Fake.DotNet.Testing.NUnit/NUnit3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Fake.DotNet.Testing.NUnit3
open Fake.Testing.Common
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.StringBuilder
open Fake.Core
open System
open System.IO
Expand Down Expand Up @@ -277,9 +276,9 @@ let getWorkingDir parameters =
let internal buildNUnit3Args parameters assemblies =
let appendResultString results sb =
match results, sb with
| [], sb -> append "--noresult" sb
| [], sb -> StringBuilder.append "--noresult" sb
| x, sb when x = NUnit3Defaults.ResultSpecs -> sb
| results, sb -> (sb, results) ||> Seq.fold (fun builder str -> append (sprintf "--result=%s" str) builder)
| results, sb -> (sb, results) ||> Seq.fold (fun builder str -> StringBuilder.append (sprintf "--result=%s" str) builder)

new StringBuilder()
|> StringBuilder.append "--noheader"
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.Testing.NUnit/Parallel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fake.DotNet.Testing.NUnit.Parallel

open Fake.Testing.Common
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.Testing.NUnit/Sequential.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fake.DotNet.Testing.NUnit.Sequential

open Fake.Testing.Common
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down
1 change: 0 additions & 1 deletion src/app/Fake.DotNet.Testing.NUnit/Xml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module Fake.DotNet.Testing.NUnit.Xml
open Fake.Testing.Common
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down
47 changes: 24 additions & 23 deletions src/app/Fake.DotNet.Testing.OpenCover/OpenCover.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Fake.DotNet.Testing.OpenCover
open System.IO
open System.Text
open Fake.Core
open Fake.Core.StringBuilder
open Fake.IO
open Fake.IO.FileSystemOperators

Expand Down Expand Up @@ -96,28 +95,30 @@ module Fake.DotNet.Testing.OpenCover
let printParamListAsValues paramName paramList = printParamListAsValuesWithModification paramName paramList (fun v -> string v)

new StringBuilder()
|> appendWithoutQuotes (printParamWithValue "target" (quote (param.TestRunnerExePath |> Path.getFullName)))
|> appendWithoutQuotes (printParamWithValue "targetargs" (quote targetArgs))
|> appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.Output) (printParamWithValue "output" (quote param.Output))
|> appendWithoutQuotes (match param.Register with
| Manual -> String.Empty
| Register -> printParam "register"
| RegisterUser -> printParamWithValue "register" "user")
|> appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.Filter) (printParamWithValue "filter" (quote param.Filter))
|> appendIfTrueWithoutQuotes param.MergeByHash (printParam "mergebyhash")
|> appendIfTrueWithoutQuotes (not param.ExcludeByAttribute.IsEmpty) (printParamListAsValuesWithQuote "excludebyattribute" param.ExcludeByAttribute)
|> appendIfTrueWithoutQuotes (not param.ExcludeByFile.IsEmpty) (printParamListAsValuesWithQuote "excludebyfile" param.ExcludeByFile)
|> appendIfTrueWithoutQuotes (not param.ExcludeDirs.IsEmpty) (printParamListAsValuesWithQuote "excludedirs" param.ExcludeDirs)
|> appendIfTrueWithoutQuotes (not param.HideSkipped.IsEmpty) (printParamListAsValues "hideskipped" param.HideSkipped)
|> appendIfTrueWithoutQuotes param.MergeOutput (printParam "mergeoutput")
|> appendWithoutQuotes (match param.ReturnTargetCode with
| No -> String.Empty
| Yes -> printParam "returntargetcode"
| Offset o -> printParamWithValue "returntargetcode" (string o))
|> appendIfTrueWithoutQuotes (not param.SearchDirs.IsEmpty) (printParamListAsValuesWithQuote "searchdirs" param.SearchDirs)
|> appendIfTrueWithoutQuotes param.SkipAutoProps (printParam "skipautoprops")
|> appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.OptionalArguments) param.OptionalArguments
|> toText
|> StringBuilder.appendWithoutQuotes (printParamWithValue "target" (quote (param.TestRunnerExePath |> Path.getFullName)))
|> StringBuilder.appendWithoutQuotes (printParamWithValue "targetargs" (quote targetArgs))
|> StringBuilder.appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.Output) (printParamWithValue "output" (quote param.Output))
|> StringBuilder.appendWithoutQuotes
(match param.Register with
| Manual -> String.Empty
| Register -> printParam "register"
| RegisterUser -> printParamWithValue "register" "user")
|> StringBuilder.appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.Filter) (printParamWithValue "filter" (quote param.Filter))
|> StringBuilder.appendIfTrueWithoutQuotes param.MergeByHash (printParam "mergebyhash")
|> StringBuilder.appendIfTrueWithoutQuotes (not param.ExcludeByAttribute.IsEmpty) (printParamListAsValuesWithQuote "excludebyattribute" param.ExcludeByAttribute)
|> StringBuilder.appendIfTrueWithoutQuotes (not param.ExcludeByFile.IsEmpty) (printParamListAsValuesWithQuote "excludebyfile" param.ExcludeByFile)
|> StringBuilder.appendIfTrueWithoutQuotes (not param.ExcludeDirs.IsEmpty) (printParamListAsValuesWithQuote "excludedirs" param.ExcludeDirs)
|> StringBuilder.appendIfTrueWithoutQuotes (not param.HideSkipped.IsEmpty) (printParamListAsValues "hideskipped" param.HideSkipped)
|> StringBuilder.appendIfTrueWithoutQuotes param.MergeOutput (printParam "mergeoutput")
|> StringBuilder.appendWithoutQuotes
(match param.ReturnTargetCode with
| No -> String.Empty
| Yes -> printParam "returntargetcode"
| Offset o -> printParamWithValue "returntargetcode" (string o))
|> StringBuilder.appendIfTrueWithoutQuotes (not param.SearchDirs.IsEmpty) (printParamListAsValuesWithQuote "searchdirs" param.SearchDirs)
|> StringBuilder.appendIfTrueWithoutQuotes param.SkipAutoProps (printParam "skipautoprops")
|> StringBuilder.appendIfTrueWithoutQuotes (String.isNotNullOrEmpty param.OptionalArguments) param.OptionalArguments
|> StringBuilder.toText

/// Runs OpenCover on a group of assemblies.
/// ## Parameters
Expand Down
40 changes: 19 additions & 21 deletions src/app/Fake.DotNet.Testing.XUnit2/XUnit2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module Fake.DotNet.Testing.XUnit2

open Fake.Testing.Common
open Fake.IO.FileSystemOperators
open Fake.Core.StringBuilder
open Fake.Core.BuildServer
open Fake.Core
open System
open System.IO
Expand Down Expand Up @@ -197,29 +195,29 @@ let internal buildXUnit2Args assemblies parameters =
sprintf @"%s ""%s=%s""" traitFlag name value
let appendTraits traitsList traitFlag sb =
traitsList |>
Seq.fold (fun sb traitPair -> sb |> appendWithoutQuotes (formatTrait traitFlag traitPair)) sb
Seq.fold (fun sb traitPair -> sb |> StringBuilder.appendWithoutQuotes (formatTrait traitFlag traitPair)) sb

new StringBuilder()
|> appendFileNamesIfNotNull assemblies
|> appendIfTrueWithoutQuotes parameters.NoAppDomain "-noappdomain"
|> appendWithoutQuotes "-parallel"
|> appendWithoutQuotes (ParallelMode.ToArgument parameters.Parallel)
|> appendIfSome (CollectionConcurrencyMode.ToArgument parameters.MaxThreads) (sprintf "-maxthreads %d")
|> appendIfTrueWithoutQuotes (not parameters.ShadowCopy) "-noshadow"
|> appendIfTrueWithoutQuotes parameters.ForceTeamCity "-teamcity"
|> appendIfTrueWithoutQuotes parameters.ForceAppVeyor "-appveyor"
|> appendIfTrueWithoutQuotes parameters.Wait "-wait"
|> appendIfTrueWithoutQuotes parameters.Silent "-quiet"
|> appendIfSome parameters.XmlOutputPath (sprintf @"-xml ""%s""")
|> appendIfSome parameters.XmlV1OutputPath (sprintf @"-xmlv1 ""%s""")
|> appendIfSome parameters.NUnitXmlOutputPath (sprintf @"-nunit ""%s""")
|> appendIfSome parameters.HtmlOutputPath (sprintf @"-html ""%s""")
|> StringBuilder.appendFileNamesIfNotNull assemblies
|> StringBuilder.appendIfTrueWithoutQuotes parameters.NoAppDomain "-noappdomain"
|> StringBuilder.appendWithoutQuotes "-parallel"
|> StringBuilder.appendWithoutQuotes (ParallelMode.ToArgument parameters.Parallel)
|> StringBuilder.appendIfSome (CollectionConcurrencyMode.ToArgument parameters.MaxThreads) (sprintf "-maxthreads %d")
|> StringBuilder.appendIfTrueWithoutQuotes (not parameters.ShadowCopy) "-noshadow"
|> StringBuilder.appendIfTrueWithoutQuotes parameters.ForceTeamCity "-teamcity"
|> StringBuilder.appendIfTrueWithoutQuotes parameters.ForceAppVeyor "-appveyor"
|> StringBuilder.appendIfTrueWithoutQuotes parameters.Wait "-wait"
|> StringBuilder.appendIfTrueWithoutQuotes parameters.Silent "-quiet"
|> StringBuilder.appendIfSome parameters.XmlOutputPath (sprintf @"-xml ""%s""")
|> StringBuilder.appendIfSome parameters.XmlV1OutputPath (sprintf @"-xmlv1 ""%s""")
|> StringBuilder.appendIfSome parameters.NUnitXmlOutputPath (sprintf @"-nunit ""%s""")
|> StringBuilder.appendIfSome parameters.HtmlOutputPath (sprintf @"-html ""%s""")
|> appendTraits parameters.IncludeTraits "-trait"
|> appendTraits parameters.ExcludeTraits "-notrait"
|> appendIfSome parameters.Namespace (sprintf @"-namespace ""%s""")
|> appendIfSome parameters.Class (sprintf @"-class ""%s""")
|> appendIfSome parameters.Method (sprintf @"-method ""%s""")
|> toText
|> StringBuilder.appendIfSome parameters.Namespace (sprintf @"-namespace ""%s""")
|> StringBuilder.appendIfSome parameters.Class (sprintf @"-class ""%s""")
|> StringBuilder.appendIfSome parameters.Method (sprintf @"-method ""%s""")
|> StringBuilder.toText

/// Helper method to detect if the xunit console runner supports the -noappdomain flag.
/// If the xunit console runner does not support this flag, it will change the value to false
Expand Down
5 changes: 2 additions & 3 deletions src/app/Fake.Tools.Git/CommandHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ open System.Threading
open System.Text
open System.Collections.Generic
open Fake.Core
open Fake.Core.Environment
open Fake.Core.String.Operators
open Fake.IO

Expand All @@ -20,10 +19,10 @@ let private GitPath = @"[ProgramFiles]\Git\cmd\;[ProgramFilesX86]\Git\cmd\;[Prog

/// Tries to locate the git.exe via the eviroment variable "GIT".
let gitPath =
if isUnix then
if Environment.isUnix then
"git"
else
let ev = environVar "GIT"
let ev = Environment.environVar "GIT"
if not (String.isNullOrEmpty ev) then ev else Process.findPath "GitPath" GitPath "git.exe"

let inline private setInfo gitPath repositoryDir command (info:ProcStartInfo) =
Expand Down
14 changes: 6 additions & 8 deletions src/app/Fake.Tools.Git/Information.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ open Fake.Tools.Git.CommandHelper
open Fake.Tools.Git.Branches
open Fake.Core
open Fake.Core.String.Operators
open Fake.Core.Environment
open Fake.Core.BuildServer
open System
open System.Text.RegularExpressions
open System.IO
Expand Down Expand Up @@ -45,17 +43,17 @@ let getBranchName repositoryDir =
else match s.Contains("...") with
| true -> s.Substring(3,s.IndexOf("...")-3)
| false -> s.Substring(3)
with _ when (repositoryDir = "" || repositoryDir = ".") && buildServer = TeamFoundation ->
match environVarOrNone "BUILD_SOURCEBRANCHNAME" with
with _ when (repositoryDir = "" || repositoryDir = ".") && BuildServer.buildServer = TeamFoundation ->
match Environment.environVarOrNone "BUILD_SOURCEBRANCHNAME" with
| None -> reraise()
| Some s -> s

/// Returns the SHA1 of the current HEAD
let getCurrentSHA1 repositoryDir =
try
getSHA1 repositoryDir "HEAD"
with _ when (repositoryDir = "" || repositoryDir = ".") && buildServer = TeamFoundation ->
match environVarOrNone "BUILD_SOURCEVERSION" with
with _ when (repositoryDir = "" || repositoryDir = ".") && BuildServer.buildServer = TeamFoundation ->
match Environment.environVarOrNone "BUILD_SOURCEVERSION" with
| None -> reraise()
| Some s -> s

Expand Down Expand Up @@ -100,7 +98,7 @@ let getCurrentHash() =
|> Seq.head
|> fun s -> s.Split('m')
if tmp |> Array.length > 2 then tmp.[1].Substring(0,6) else tmp.[0].Substring(0,6)
with _ when buildServer = TeamFoundation ->
match environVarOrNone "BUILD_SOURCEVERSION" with
with _ when BuildServer.buildServer = TeamFoundation ->
match Environment.environVarOrNone "BUILD_SOURCEVERSION" with
| None -> reraise()
| Some s -> s
Loading

0 comments on commit f582480

Please sign in to comment.