From 9c250c9e0c45798b947c53b6a91c3ccaec3c066d Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 21 May 2018 11:18:54 -0500 Subject: [PATCH 1/4] address warnings that came up during initial build --- src/app/Fake.BuildServer.Travis/Travis.fs | 4 +++- src/app/Fake.Core.SemVer/SemVer.fs | 4 ++-- src/app/Fake.Runtime/FakeRuntime.fs | 8 +++++--- src/app/Fake.Tracing.NAntXml/NAntXmlTraceListener.fs | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/app/Fake.BuildServer.Travis/Travis.fs b/src/app/Fake.BuildServer.Travis/Travis.fs index 7d658133b4e..2623256b2b5 100644 --- a/src/app/Fake.BuildServer.Travis/Travis.fs +++ b/src/app/Fake.BuildServer.Travis/Travis.fs @@ -37,9 +37,11 @@ module Travis = write false color true (sprintf "Build Number: %s" number) | TraceData.TestStatus (test, status) -> write false color true (sprintf "Test '%s' status: %A" test status) + | TraceData.BuildState state -> + write false color true (sprintf "Build State: %A" state) let defaultTraceListener = - TravisTraceListener() :> ITraceListener + TravisTraceListener() :> ITraceListener let detect () = BuildServer.buildServer = BuildServer.Travis let install(force:bool) = diff --git a/src/app/Fake.Core.SemVer/SemVer.fs b/src/app/Fake.Core.SemVer/SemVer.fs index 28a919d890b..0b0e35902e9 100644 --- a/src/app/Fake.Core.SemVer/SemVer.fs +++ b/src/app/Fake.Core.SemVer/SemVer.fs @@ -86,7 +86,7 @@ type PreRelease = | _::AlphaNumeric(a)::_ -> a // fallback to 2nd | _ -> "" - let parse segment = + let parse (segment: string) = match bigint.TryParse segment with | true, number when number >= 0I -> Numeric number | _ -> AlphaNumeric segment @@ -245,7 +245,7 @@ module SemVer = | _ -> None /// Matches if str is convertible to big int and not less than zero, and returns the bigint value. - let inline private (|Big|_|) str = + let inline private (|Big|_|) (str: string) = match BigInteger.TryParse (str, NumberStyles.Integer, null) with | true, big when big > -1I -> Some big | _ -> None diff --git a/src/app/Fake.Runtime/FakeRuntime.fs b/src/app/Fake.Runtime/FakeRuntime.fs index 8d504ca2231..5d5aeea4349 100644 --- a/src/app/Fake.Runtime/FakeRuntime.fs +++ b/src/app/Fake.Runtime/FakeRuntime.fs @@ -611,7 +611,8 @@ let prepareAndRunScript (config:FakeConfig) : RunResult = let retrieveHints (config:FakeConfig) (runResult:Runners.RunResult) = match runResult with | Runners.RunResult.SuccessRun _ -> [] - | Runners.RunResult.CompilationError err -> [ + | Runners.RunResult.CompilationError err -> + [ // Add some hints about the error, for example // detect https://github.com/fsharp/FAKE/issues/1783 let containsNotDefined = err.Errors |> Seq.exists (fun er -> er.ErrorNumber = 39) @@ -621,9 +622,10 @@ let retrieveHints (config:FakeConfig) (runResult:Runners.RunResult) = if containsNotSupportOperator then yield "Operators now need to be opened manually, try to add 'open Fake.IO.FileSystemOperators' and 'open Fake.IO.Globbing.Operators' to your script to import the most common operators" ] - | Runners.RunResult.RuntimeError _ -> [ + | Runners.RunResult.RuntimeError _ -> + [ if config.VerboseLevel.PrintVerbose && Environment.GetEnvironmentVariable "FAKE_DETAILED_ERRORS" <> "true" then yield "To further diagnose the problem you can set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'" if not config.VerboseLevel.PrintVerbose && Environment.GetEnvironmentVariable "FAKE_DETAILED_ERRORS" <> "true" then yield "To further diagnose the problem you can run fake in verbose mode `fake -v run ...` or set the 'FAKE_DETAILED_ERRORS' environment variable to 'true'" - ] \ No newline at end of file + ] diff --git a/src/app/Fake.Tracing.NAntXml/NAntXmlTraceListener.fs b/src/app/Fake.Tracing.NAntXml/NAntXmlTraceListener.fs index 5d8aa2b292b..1fd7c473837 100644 --- a/src/app/Fake.Tracing.NAntXml/NAntXmlTraceListener.fs +++ b/src/app/Fake.Tracing.NAntXml/NAntXmlTraceListener.fs @@ -54,7 +54,8 @@ type NAntXmlTraceListener(encoding : Encoding, xmlOutputFile) = | TraceData.TestOutput _ | TraceData.TestStatus _ | TraceData.ImportData _ - | TraceData.BuildNumber _ -> "" + | TraceData.BuildNumber _ + | TraceData.BuildState _ -> "" interface System.IDisposable with member __.Dispose () = From 7b396c931e21f28a10648501f6234e2e4c371efe Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 21 May 2018 11:35:31 -0500 Subject: [PATCH 2/4] only print warnings if non-silent --- src/app/Fake.netcore/Program.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/Fake.netcore/Program.fs b/src/app/Fake.netcore/Program.fs index a0fdb85956d..be211ce8c34 100644 --- a/src/app/Fake.netcore/Program.fs +++ b/src/app/Fake.netcore/Program.fs @@ -156,7 +156,7 @@ let runOrBuild (args : RunArguments) = let result = match runResult with | Runners.RunResult.SuccessRun warnings -> - if warnings <> "" then + if warnings <> "" && args.VerboseLevel.PrintNormal then traceFAKE "%O" warnings if args.VerboseLevel.PrintVerbose then log "Ready." true @@ -167,9 +167,9 @@ let runOrBuild (args : RunArguments) = indentString + String.Join(sprintf "%s%s" Environment.NewLine indentString, splitMsg) if args.VerboseLevel.PrintVerbose then // in case stderr is not redirected - TraceMessage("Script is not a valid, see standard error for details.", true) |> forceWrite + TraceMessage("Script is not valid, see standard error for details.", true) |> forceWrite - ErrorMessage "Script is not a valid:" |> forceWrite + ErrorMessage "Script is not valid:" |> forceWrite ErrorMessage (indentString 1 err.FormattedErrors) |> forceWrite false | Runners.RunResult.RuntimeError err -> From 4cf58f640cc82bfbeb49591c3157fb606d84acb1 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 21 May 2018 11:50:59 -0500 Subject: [PATCH 3/4] sort target names --- src/app/Fake.Core.Target/Target.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Fake.Core.Target/Target.fs b/src/app/Fake.Core.Target/Target.fs index 8ec2d5d0eb4..150216dfe29 100644 --- a/src/app/Fake.Core.Target/Target.fs +++ b/src/app/Fake.Core.Target/Target.fs @@ -317,7 +317,7 @@ module Target = /// List all targets available. let listAvailable() = Trace.log "The following targets are available:" - for t in getTargetDict().Values do + for t in getTargetDict().Values |> Seq.sortBy (fun t -> t.Name) do Trace.logfn " %s%s" t.Name (match t.Description with Some s -> sprintf " - %s" s | _ -> "") From 0562a938d8397cf64d7e7ed77ff28008548992ff Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 21 May 2018 13:32:36 -0500 Subject: [PATCH 4/4] revert warnings change and add note to Environment about mono semantics --- src/app/Fake.Core.Environment/Environment.fs | 4 ++-- src/app/Fake.netcore/Program.fs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/Fake.Core.Environment/Environment.fs b/src/app/Fake.Core.Environment/Environment.fs index 8e95f8b53e8..604b7c50bc2 100644 --- a/src/app/Fake.Core.Environment/Environment.fs +++ b/src/app/Fake.Core.Environment/Environment.fs @@ -191,7 +191,7 @@ module Environment = | _ -> false #endif - /// Determines if the current system is a mono system + /// Determines if the current FAKE runner is being run via mono. With the FAKE 5 runner, this will always be false /// Todo: Detect mono on windows let isMono = #if NETSTANDARD1_6 @@ -360,4 +360,4 @@ module Environment = AgentVersion = sprintf "%A" ((System.Reflection.Assembly.GetAssembly(typedefof)).GetName().Version) DriveInfo = getDrivesInfo() } -#endif \ No newline at end of file +#endif diff --git a/src/app/Fake.netcore/Program.fs b/src/app/Fake.netcore/Program.fs index be211ce8c34..d4b5e6fe220 100644 --- a/src/app/Fake.netcore/Program.fs +++ b/src/app/Fake.netcore/Program.fs @@ -156,7 +156,7 @@ let runOrBuild (args : RunArguments) = let result = match runResult with | Runners.RunResult.SuccessRun warnings -> - if warnings <> "" && args.VerboseLevel.PrintNormal then + if warnings <> "" then traceFAKE "%O" warnings if args.VerboseLevel.PrintVerbose then log "Ready." true