From 063df704c0df3f04c6288901d16692da73fbd512 Mon Sep 17 00:00:00 2001 From: Petr Chromec Date: Wed, 11 Aug 2021 19:48:02 +0200 Subject: [PATCH] Update dependencies --- .config/dotnet-tools.json | 6 ++ CHANGELOG.md | 1 + build.fsx | 159 ++++++++++++++------------------------ paket.dependencies | 9 +-- paket.lock | 69 ++++++++--------- tests/paket.references | 5 +- 6 files changed, 100 insertions(+), 149 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 7d3bb2a..9124753 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -13,6 +13,12 @@ "commands": [ "paket" ] + }, + "dotnet-fsharplint": { + "version": "0.19.2", + "commands": [ + "dotnet-fsharplint" + ] } } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8895f..430d2b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Update dependencies ## 4.0.0 - 2021-06-08 - Update to net5.0 and use F# 5.0 diff --git a/build.fsx b/build.fsx index b7d8c91..b2b449e 100644 --- a/build.fsx +++ b/build.fsx @@ -9,14 +9,8 @@ open Fake.IO.Globbing.Operators open Fake.Core.TargetOperators open Fake.Tools.Git -type ToolDir = - /// Global tool dir must be in PATH - ${PATH}:/root/.dotnet/tools - | Global - /// Just a dir name, the location will be used as: ./{LocalDirName} - | Local of string - // ======================================================================================================== -// === F# / Public Library fake build ============================================================= 1.1.0 = +// === F# / Public Library fake build ============================================================= 2.0.0 = // -------------------------------------------------------------------------------------------------------- // Options: // - no-clean - disables clean of dirs in the first step (required on CI) @@ -36,12 +30,10 @@ type ToolDir = let project = "Tuc Parser" let summary = "A parser for TUC files." -let release = ReleaseNotes.parse (System.IO.File.ReadAllLines "CHANGELOG.md" |> Seq.filter ((<>) "## Unreleased")) +let changeLog = "CHANGELOG.md" let gitCommit = Information.getCurrentSHA1(".") let gitBranch = Information.getBranchName(".") -let toolsDir = Local "tools" - // -------------------------------------------------------------------------------------------------------- // 2. Utilities, DotnetCore functions, etc. // -------------------------------------------------------------------------------------------------------- @@ -57,63 +49,45 @@ module private Utils = then Trace.tracefn "Skipped ..." else action p -module private DotnetCore = - let run cmd workingDir = - let options = - DotNet.Options.withWorkingDirectory workingDir - >> DotNet.Options.withRedirectOutput true + let createProcess exe arg dir = + CreateProcess.fromRawCommandLine exe arg + |> CreateProcess.withWorkingDirectory dir + |> CreateProcess.ensureExitCode - DotNet.exec options cmd "" - - let runOrFail cmd workingDir = - run cmd workingDir - |> tee (fun result -> - if result.ExitCode <> 0 then failwithf "'dotnet %s' failed in %s" cmd workingDir - ) + let run proc arg dir = + proc arg dir + |> Proc.run |> ignore - let runInRoot cmd = run cmd "." - let runInRootOrFail cmd = runOrFail cmd "." - - let installOrUpdateTool toolDir tool = - let toolCommand action = - match toolDir with - | Global -> sprintf "tool %s --global %s" action tool - | Local dir -> sprintf "tool %s --tool-path ./%s %s" action dir tool - - match runInRoot (toolCommand "install") with - | { ExitCode = code } when code <> 0 -> - match runInRoot (toolCommand "update") with - | { ExitCode = code } when code <> 0 -> Trace.tracefn "Warning: Install and update of %A has failed." tool - | _ -> () - | _ -> () - - let execute command args (dir: string) = - let cmd = - sprintf "%s/%s" - (dir.TrimEnd('/')) - command - - let processInfo = System.Diagnostics.ProcessStartInfo(cmd) - processInfo.RedirectStandardOutput <- true - processInfo.RedirectStandardError <- true - processInfo.UseShellExecute <- false - processInfo.CreateNoWindow <- true - processInfo.Arguments <- args |> String.concat " " - - use proc = - new System.Diagnostics.Process( - StartInfo = processInfo - ) - if proc.Start() |> not then failwith "Process was not started." - proc.WaitForExit() - - if proc.ExitCode <> 0 then failwithf "Command '%s' failed in %s." command dir - (proc.StandardOutput.ReadToEnd(), proc.StandardError.ReadToEnd()) - -let stringToOption = function - | null | "" -> None - | string -> Some string + let orFail = function + | Error e -> raise e + | Ok ok -> ok + + let stringToOption = function + | null | "" -> None + | string -> Some string + +[] +module Dotnet = + let dotnet = createProcess "dotnet" + + let run command dir = try run dotnet command dir |> Ok with e -> Error e + let runInRoot command = run command "." + let runOrFail command dir = run command dir |> orFail + +[] +module ProjectSources = + let library = + !! "./*.fsproj" + ++ "src/*.fsproj" + ++ "src/**/*.fsproj" + + let tests = + !! "tests/*.fsproj" + + let all = + library + ++ "tests/*.fsproj" // -------------------------------------------------------------------------------------------------------- // 3. Targets for FAKE @@ -130,6 +104,7 @@ Target.create "Clean" <| skipOn "no-clean" (fun _ -> Target.create "AssemblyInfo" (fun _ -> let getAssemblyInfoAttributes projectName = let now = DateTime.Now + let release = ReleaseNotes.parse (System.IO.File.ReadAllLines changeLog |> Seq.filter ((<>) "## Unreleased")) let gitValue initialValue = initialValue @@ -149,16 +124,15 @@ Target.create "AssemblyInfo" (fun _ -> ] let getProjectDetails (projectPath: string) = - let projectName = IO.Path.GetFileNameWithoutExtension(projectPath) + let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) ( projectPath, projectName, - IO.Path.GetDirectoryName(projectPath), + System.IO.Path.GetDirectoryName(projectPath), (getAssemblyInfoAttributes projectName) ) - !! "**/*.fsproj" - -- "example/**/*.*proj" + ProjectSources.all |> Seq.map getProjectDetails |> Seq.iter (fun (_, _, folderName, attributes) -> AssemblyInfoFile.createFSharp (folderName "AssemblyInfo.fs") attributes @@ -166,48 +140,29 @@ Target.create "AssemblyInfo" (fun _ -> ) Target.create "Build" (fun _ -> - !! "**/*.fsproj" - -- "example/**/*.*proj" + ProjectSources.library + |> Seq.iter (DotNet.build id) +) + +Target.create "BuildTests" (fun _ -> + ProjectSources.tests |> Seq.iter (DotNet.build id) ) Target.create "Lint" <| skipOn "no-lint" (fun _ -> - DotnetCore.installOrUpdateTool toolsDir ("dotnet-fsharplint") - - let checkResult (messages: string list) = - let rec check: string list -> unit = function - | [] -> failwithf "Lint does not yield a summary." - | head :: rest -> - if head.Contains "Summary" then - match head.Replace("= ", "").Replace(" =", "").Replace("=", "").Replace("Summary: ", "") with - | "0 warnings" -> Trace.tracefn "Lint: OK" - | warnings -> failwithf "Lint ends up with %s." warnings - else check rest - messages - |> List.rev - |> check - - !! "**/*.*proj" - -- "example/**/*.*proj" - |> Seq.map (fun fsproj -> - match toolsDir with - | Global -> - DotnetCore.runInRoot (sprintf "fsharplint lint %s" fsproj) - |> fun (result: ProcessResult) -> result.Messages - | Local dir -> - DotnetCore.execute "dotnet-fsharplint" ["lint"; fsproj] dir - |> fst - |> tee (Trace.tracefn "%s") - |> String.split '\n' - |> Seq.toList + ProjectSources.all + ++ "./Build.fsproj" + |> Seq.iter (fun fsproj -> + match Dotnet.runInRoot (sprintf "fsharplint lint %s" fsproj) with + | Ok () -> Trace.tracefn "Lint %s is Ok" fsproj + | Error e -> raise e ) - |> Seq.iter checkResult ) Target.create "Tests" (fun _ -> - if !! "tests/*.fsproj" |> Seq.isEmpty + if ProjectSources.tests |> Seq.isEmpty then Trace.tracefn "There are no tests yet." - else DotnetCore.runOrFail "run" "tests" + else Dotnet.runOrFail "run" "tests" ) Target.create "Release" (fun _ -> @@ -242,7 +197,7 @@ Target.create "Release" (fun _ -> "Clean" ==> "AssemblyInfo" - ==> "Build" + ==> "Build" <=> "BuildTests" ==> "Lint" ==> "Tests" ==> "Release" diff --git a/paket.dependencies b/paket.dependencies index 5fb99a6..14ce6e4 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -5,13 +5,10 @@ source https://api.nuget.org/v3/index.json nuget FSharp.Core ~> 5.0 nuget FSharp.Data ~> 4.1 nuget MF.ConsoleApplication ~> 2.0 -nuget Tuc.DomainResolver ~> 2.0 +nuget Tuc.DomainResolver ~> 2.1 -group Tests - storage: none - source https://api.nuget.org/v3/index.json - nuget Expecto - nuget YoloDev.Expecto.TestSdk +nuget Expecto +nuget YoloDev.Expecto.TestSdk // [ FAKE GROUP ] group Build diff --git a/paket.lock b/paket.lock index 5ef29ba..dac68c3 100644 --- a/paket.lock +++ b/paket.lock @@ -20,11 +20,14 @@ NUGET Colorful.Console (>= 1.2.10) FSharp.Core (>= 4.7) ShellProgressBar (>= 4.3) - FSharp.Compiler.Service (39.0) - FSharp.Core (5.0.1) - Microsoft.Build.Framework (>= 16.6) - Microsoft.Build.Tasks.Core (>= 16.6) - Microsoft.Build.Utilities.Core (>= 16.6) + Expecto (9.0.2) + FSharp.Core (>= 4.6) + Mono.Cecil (>= 0.11.2) + FSharp.Compiler.Service (40.0) + FSharp.Core (5.0.2) + Microsoft.Build.Framework (>= 16.9) + Microsoft.Build.Tasks.Core (>= 16.9) + Microsoft.Build.Utilities.Core (>= 16.9) System.Buffers (>= 4.5.1) System.Collections.Immutable (>= 5.0) System.Diagnostics.Process (>= 4.3) @@ -46,8 +49,8 @@ NUGET System.Threading.Tasks.Parallel (>= 4.3) System.Threading.Thread (>= 4.3) System.Threading.ThreadPool (>= 4.3) - FSharp.Core (5.0.1) - FSharp.Data (4.1.1) + FSharp.Core (5.0.2) + FSharp.Data (4.2.2) FSharp.Core (>= 4.7.2) MF.ConsoleApplication (2.0) ConsoleStyle (>= 2.0) @@ -90,6 +93,7 @@ NUGET System.Security.Principal.Windows (>= 5.0) Microsoft.Win32.SystemEvents (5.0) Microsoft.NETCore.Platforms (>= 5.0) + Mono.Cecil (0.11.4) runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) @@ -579,11 +583,15 @@ NUGET System.Runtime.Handles (>= 4.3) System.Windows.Extensions (5.0) System.Drawing.Common (>= 5.0) - Tuc.DomainResolver (2.0) - FSharp.Compiler.Service (>= 39.0) - FSharp.Core (>= 5.0.1) - FSharp.Data (>= 4.1.1) + Tuc.DomainResolver (2.1) + FSharp.Compiler.Service (>= 40.0) + FSharp.Core (>= 5.0.2) + FSharp.Data (>= 4.2.2) MF.ConsoleApplication (>= 2.0) + YoloDev.Expecto.TestSdk (0.12.5) + Expecto (>= 9.0 < 10.0) + FSharp.Core (>= 4.6) + System.Collections.Immutable (>= 1.5 < 5.1) GROUP Build STORAGE: NONE @@ -700,7 +708,7 @@ NUGET FSharp.Control.Reactive (5.0.2) - restriction: >= netstandard2.0 FSharp.Core (>= 4.7.2) - restriction: >= netstandard2.0 System.Reactive (>= 5.0) - restriction: >= netstandard2.0 - FSharp.Core (5.0.1) - restriction: >= netstandard2.0 + FSharp.Core (5.0.2) - restriction: >= netstandard2.0 Microsoft.Bcl.AsyncInterfaces (5.0) - restriction: || (&& (>= monoandroid) (>= net50) (< netcoreapp2.0)) (&& (< monoandroid) (>= net50) (< netcoreapp2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= net50) (< netcoreapp2.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= net50) (< netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= monotouch) (>= net50)) (&& (>= net461) (>= net50)) (>= net472) (&& (>= net50) (< netcoreapp2.0) (>= xamarinios)) (&& (>= net50) (< netcoreapp2.0) (>= xamarinmac)) (&& (>= net50) (< netstandard2.0) (>= xamarintvos)) (&& (>= net50) (< netstandard2.0) (>= xamarinwatchos)) (&& (>= net50) (>= uap10.1)) System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (< netcoreapp2.1) (>= netstandard2.0) (< netstandard2.1)) Microsoft.Build (16.10) - restriction: >= netstandard2.0 @@ -761,21 +769,21 @@ NUGET Microsoft.Build.Tasks.Core (>= 16.4) - restriction: >= netstandard2.0 Microsoft.Build.Utilities.Core (>= 16.4) - restriction: >= netstandard2.0 Newtonsoft.Json (13.0.1) - restriction: >= netstandard2.0 - NuGet.Common (5.9.1) - restriction: >= netstandard2.0 - NuGet.Frameworks (>= 5.9.1) - restriction: || (>= net45) (>= netstandard2.0) - NuGet.Configuration (5.9.1) - restriction: >= netstandard2.0 - NuGet.Common (>= 5.9.1) - restriction: || (>= net45) (>= netstandard2.0) + NuGet.Common (5.10) - restriction: >= netstandard2.0 + NuGet.Frameworks (>= 5.10) - restriction: || (>= net45) (>= netstandard2.0) + NuGet.Configuration (5.10) - restriction: >= netstandard2.0 + NuGet.Common (>= 5.10) - restriction: || (>= net45) (>= netstandard2.0) System.Security.Cryptography.ProtectedData (>= 4.4) - restriction: && (< net45) (>= netstandard2.0) - NuGet.Frameworks (5.9.1) - restriction: >= netstandard2.0 - NuGet.Packaging (5.9.1) - restriction: >= netstandard2.0 + NuGet.Frameworks (5.10) - restriction: >= netstandard2.0 + NuGet.Packaging (5.10) - restriction: >= netstandard2.0 Newtonsoft.Json (>= 9.0.1) - restriction: >= netstandard2.0 - NuGet.Configuration (>= 5.9.1) - restriction: >= netstandard2.0 - NuGet.Versioning (>= 5.9.1) - restriction: >= netstandard2.0 + NuGet.Configuration (>= 5.10) - restriction: >= netstandard2.0 + NuGet.Versioning (>= 5.10) - restriction: >= netstandard2.0 System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net50) System.Security.Cryptography.Pkcs (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net50) - NuGet.Protocol (5.9.1) - restriction: >= netstandard2.0 - NuGet.Packaging (>= 5.9.1) - restriction: >= netstandard2.0 - NuGet.Versioning (5.9.1) - restriction: >= netstandard2.0 + NuGet.Protocol (5.10) - restriction: >= netstandard2.0 + NuGet.Packaging (>= 5.10) - restriction: >= netstandard2.0 + NuGet.Versioning (5.10) - restriction: >= netstandard2.0 System.Buffers (4.5.1) - restriction: || (&& (>= monoandroid) (>= net50) (< netcoreapp2.0)) (&& (>= monoandroid) (< netcoreapp2.0) (>= netstandard2.0)) (&& (< monoandroid) (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (&& (< monoandroid) (< net46) (< netcoreapp2.0) (>= netstandard2.0) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= net50) (< netcoreapp2.0) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.1) (>= netstandard2.0) (< win8)) (&& (>= monotouch) (>= net50)) (&& (>= monotouch) (>= netstandard2.0)) (&& (>= net461) (>= net50)) (&& (>= net461) (>= netstandard2.0)) (>= net472) (&& (>= net50) (< netstandard2.0) (>= xamarintvos)) (&& (>= net50) (< netstandard2.0) (>= xamarinwatchos)) (&& (< netstandard1.1) (>= netstandard2.0) (>= win8)) (&& (>= netstandard2.0) (>= uap10.1)) (&& (>= netstandard2.0) (>= xamarintvos)) (&& (>= netstandard2.0) (>= xamarinwatchos)) (>= xamarinios) (>= xamarinmac) System.CodeDom (5.0) - restriction: && (< net472) (>= netstandard2.0) System.Collections.Immutable (5.0) - restriction: >= netstandard2.0 @@ -854,18 +862,3 @@ NUGET System.ValueTuple (4.5) - restriction: || (&& (>= net45) (>= netstandard2.0)) (&& (>= net461) (>= net50)) (>= net472) System.Windows.Extensions (5.0) - restriction: >= netcoreapp3.0 System.Drawing.Common (>= 5.0) - restriction: >= netcoreapp3.0 - -GROUP Tests -STORAGE: NONE -NUGET - remote: https://api.nuget.org/v3/index.json - Expecto (9.0.2) - FSharp.Core (>= 4.6) - restriction: || (>= net461) (>= netstandard2.0) - Mono.Cecil (>= 0.11.2) - restriction: || (>= net461) (>= netstandard2.0) - FSharp.Core (5.0.1) - restriction: || (>= net461) (>= netstandard2.0) - Mono.Cecil (0.11.3) - restriction: || (>= net461) (>= netstandard2.0) - System.Collections.Immutable (5.0) - restriction: >= netcoreapp2.1 - YoloDev.Expecto.TestSdk (0.11.1) - Expecto (>= 9.0 < 10.0) - restriction: >= netcoreapp2.1 - FSharp.Core (>= 4.6) - restriction: >= netcoreapp2.1 - System.Collections.Immutable (>= 1.5 < 5.1) - restriction: >= netcoreapp2.1 diff --git a/tests/paket.references b/tests/paket.references index fe475e6..07b0e8a 100644 --- a/tests/paket.references +++ b/tests/paket.references @@ -1,5 +1,4 @@ FSharp.Core -group Tests - Expecto - YoloDev.Expecto.TestSdk +Expecto +YoloDev.Expecto.TestSdk