From 7fb1eca2a3023aea040c1809d2e5d1d22dffd998 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Thu, 26 Dec 2024 15:10:39 -0500 Subject: [PATCH] Convert FAKE to project (#54) --- build.fsx => build.fs | 94 +++++++++--------- build.fsproj | 19 ++++ build.fsx.lock | 217 ------------------------------------------ fake.cmd | 2 - fake.sh | 7 -- 5 files changed, 69 insertions(+), 270 deletions(-) rename build.fsx => build.fs (60%) create mode 100644 build.fsproj delete mode 100644 build.fsx.lock delete mode 100644 fake.cmd delete mode 100755 fake.sh diff --git a/build.fsx b/build.fs similarity index 60% rename from build.fsx rename to build.fs index 552973c..256f669 100644 --- a/build.fsx +++ b/build.fs @@ -1,44 +1,50 @@ -#r "paket: -nuget Fake.DotNet.Cli -nuget Fake.DotNet.Testing.Expecto -nuget Fake.IO.FileSystem -nuget Fake.Core.Target //" -#load ".fake/build.fsx/intellisense.fsx" -open Fake.Core -open Fake.DotNet -open Fake.DotNet.Testing -open Fake.IO -open Fake.IO.Globbing.Operators -open Fake.Core.TargetOperators - -Target.initEnvironment () - -/// The root path to the projects within this solution -let projPath = "src/PrayerTracker" - -Target.create "Clean" (fun _ -> - !! "src/**/bin" - ++ "src/**/obj" - |> Shell.cleanDirs -) - -Target.create "Test" (fun _ -> - let testPath = $"{projPath}.Tests" - DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj" - Expecto.run - (fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net7.0" }) - [ "PrayerTracker.Tests.dll" ]) - -Target.create "Publish" (fun _ -> - DotNet.publish - (fun opts -> { opts with Runtime = Some "linux-x64"; SelfContained = Some false; NoLogo = true }) - $"{projPath}/PrayerTracker.fsproj") - -Target.create "All" ignore - -"Clean" - ==> "Test" - ==> "Publish" - ==> "All" - -Target.runOrDefault "All" +open Fake.Core +open Fake.DotNet +open Fake.IO +open Fake.IO.Globbing.Operators + +let execContext = Context.FakeExecutionContext.Create false "build.fsx" [] +Context.setExecutionContext (Context.RuntimeContext.Fake execContext) + +/// The root path to the projects within this solution +let projPath = "src/PrayerTracker" + +Target.create "Clean" (fun _ -> + !! "src/**/bin" + ++ "src/**/obj" + |> Shell.cleanDirs +) + +Target.create "Test" (fun _ -> + let testPath = $"{projPath}.Tests" + DotNet.build (fun opts -> { opts with NoLogo = true }) $"{testPath}/PrayerTracker.Tests.fsproj" + Testing.Expecto.run + (fun opts -> { opts with WorkingDirectory = $"{testPath}/bin/Release/net9.0" }) + [ "PrayerTracker.Tests.dll" ]) + +Target.create "Publish" (fun _ -> + DotNet.publish + (fun opts -> { opts with Runtime = Some "linux-x64"; SelfContained = Some false; NoLogo = true }) + $"{projPath}/PrayerTracker.fsproj") + +Target.create "All" ignore + +open Fake.Core.TargetOperators + +let dependencies = [ + "Clean" + ==> "Test" + ==> "Publish" + ==> "All" +] + +[] +let main args = + try + match args with + | [| target |] -> Target.runOrDefault target + | _ -> Target.runOrDefault "All" + 0 + with e -> + printfn "%A" e + 1 diff --git a/build.fsproj b/build.fsproj new file mode 100644 index 0000000..dc04a05 --- /dev/null +++ b/build.fsproj @@ -0,0 +1,19 @@ + + + + Exe + net9.0 + + + + + + + + + + + + + + diff --git a/build.fsx.lock b/build.fsx.lock deleted file mode 100644 index b7b2c44..0000000 --- a/build.fsx.lock +++ /dev/null @@ -1,217 +0,0 @@ -STORAGE: NONE -RESTRICTION: || (== net6.0) (== netstandard2.0) -NUGET - remote: https://api.nuget.org/v3/index.json - BlackFox.VsWhere (1.1) - FSharp.Core (>= 4.2.3) - Microsoft.Win32.Registry (>= 4.7) - Fake.Core.CommandLineParsing (6.1.3) - FParsec (>= 1.1.1) - FSharp.Core (>= 8.0.301) - Fake.Core.Context (6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.Environment (6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.FakeVar (6.1.3) - Fake.Core.Context (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.Process (6.1.3) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.FakeVar (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - Fake.IO.FileSystem (>= 6.1.3) - FSharp.Core (>= 8.0.301) - System.Collections.Immutable (>= 8.0) - Fake.Core.SemVer (6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.String (6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.Target (6.1.3) - Fake.Core.CommandLineParsing (>= 6.1.3) - Fake.Core.Context (>= 6.1.3) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.FakeVar (>= 6.1.3) - Fake.Core.Process (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - FSharp.Control.Reactive (>= 5.0.2) - FSharp.Core (>= 8.0.301) - Fake.Core.Tasks (6.1.3) - Fake.Core.Trace (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.Trace (6.1.3) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.FakeVar (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Core.Xml (6.1.3) - Fake.Core.String (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.DotNet.Cli (6.1.3) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.Process (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - Fake.DotNet.MSBuild (>= 6.1.3) - Fake.DotNet.NuGet (>= 6.1.3) - Fake.IO.FileSystem (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Mono.Posix.NETStandard (>= 1.0) - Newtonsoft.Json (>= 13.0.3) - Fake.DotNet.MSBuild (6.1.3) - BlackFox.VsWhere (>= 1.1) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.Process (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - Fake.IO.FileSystem (>= 6.1.3) - FSharp.Core (>= 8.0.301) - MSBuild.StructuredLogger (>= 2.1.815) - Fake.DotNet.NuGet (6.1.3) - Fake.Core.Environment (>= 6.1.3) - Fake.Core.Process (>= 6.1.3) - Fake.Core.SemVer (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Tasks (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - Fake.Core.Xml (>= 6.1.3) - Fake.IO.FileSystem (>= 6.1.3) - Fake.Net.Http (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Newtonsoft.Json (>= 13.0.3) - NuGet.Protocol (>= 6.10.1) - Fake.DotNet.Testing.Expecto (6.1.3) - Fake.Core.Process (>= 6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - Fake.Testing.Common (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.IO.FileSystem (6.1.3) - Fake.Core.String (>= 6.1.3) - Fake.Core.Trace (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Net.Http (6.1.3) - Fake.Core.Trace (>= 6.1.3) - FSharp.Core (>= 8.0.301) - Fake.Testing.Common (6.1.3) - Fake.Core.Trace (>= 6.1.3) - FSharp.Core (>= 8.0.301) - FParsec (1.1.1) - FSharp.Core (>= 4.3.4) - FSharp.Control.Reactive (5.0.5) - FSharp.Core (>= 4.7.2) - System.Reactive (>= 5.0 < 6.0) - FSharp.Core (9.0.100) - Microsoft.Bcl.AsyncInterfaces (9.0) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (>= net472)) (&& (== net6.0) (< net5.0)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) - Microsoft.Bcl.Cryptography (9.0) - System.Formats.Asn1 (>= 9.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - Microsoft.Build.Framework (17.12.6) - Microsoft.Win32.Registry (>= 5.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Security.Principal.Windows (>= 5.0) - Microsoft.Build.Utilities.Core (17.12.6) - Microsoft.Build.Framework (>= 17.12.6) - Microsoft.NET.StringTools (>= 17.12.6) - Microsoft.Win32.Registry (>= 5.0) - System.Collections.Immutable (>= 8.0) - System.Configuration.ConfigurationManager (>= 8.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Security.Principal.Windows (>= 5.0) - System.Text.Encoding.CodePages (>= 7.0) - Microsoft.NET.StringTools (17.12.6) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - Microsoft.NETCore.Platforms (7.0.4) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard1.2)) (&& (== net6.0) (< netstandard1.3)) (&& (== net6.0) (< netstandard1.5)) (== netstandard2.0) - Microsoft.NETCore.Targets (5.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard1.2)) (&& (== net6.0) (< netstandard1.3)) (&& (== net6.0) (< netstandard1.5)) (== netstandard2.0) - Microsoft.Win32.Registry (5.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monoandroid) (< netstandard1.3)) (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0) - System.Security.AccessControl (>= 5.0) - System.Security.Principal.Windows (>= 5.0) - Mono.Posix.NETStandard (1.0) - MSBuild.StructuredLogger (2.2.386) - Microsoft.Build.Framework (>= 17.5) - Microsoft.Build.Utilities.Core (>= 17.5) - System.Collections.Immutable (>= 8.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - Newtonsoft.Json (13.0.3) - NuGet.Common (6.12.1) - NuGet.Frameworks (>= 6.12.1) - NuGet.Configuration (6.12.1) - NuGet.Common (>= 6.12.1) - System.Security.Cryptography.ProtectedData (>= 4.4) - NuGet.Frameworks (6.12.1) - NuGet.Packaging (6.12.1) - Newtonsoft.Json (>= 13.0.3) - NuGet.Configuration (>= 6.12.1) - NuGet.Versioning (>= 6.12.1) - System.Formats.Asn1 (>= 8.0.1) - System.Security.Cryptography.Pkcs (>= 6.0.4) - NuGet.Protocol (6.12.1) - NuGet.Packaging (>= 6.12.1) - System.Text.Json (>= 8.0.4) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< net5.0)) (== netstandard2.0) - NuGet.Versioning (6.12.1) - System.Buffers (4.6) - System.Collections.Immutable (9.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Configuration.ConfigurationManager (9.0) - System.Security.Cryptography.ProtectedData (>= 9.0) - System.Formats.Asn1 (9.0) - System.Buffers (>= 4.5.1) - System.Memory (>= 4.5.5) - System.IO.Pipelines (9.0) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (>= net472)) (&& (== net6.0) (< net5.0)) (== netstandard2.0) - System.Buffers (>= 4.5.1) - System.Memory (>= 4.5.5) - System.Threading.Tasks.Extensions (>= 4.5.4) - System.Memory (4.6) - System.Buffers (>= 4.6) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netcoreapp2.1)) (== netstandard2.0) - System.Numerics.Vectors (>= 4.6) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netcoreapp2.1)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.1) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netcoreapp2.1)) (== netstandard2.0) - System.Numerics.Vectors (4.6) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netcoreapp2.1)) (== netstandard2.0) - System.Reactive (5.0) - System.Runtime.InteropServices.WindowsRuntime (>= 4.3) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0) - System.Runtime (4.3.1) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (6.1) - System.Runtime.InteropServices.WindowsRuntime (4.3) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Runtime (>= 4.3) - System.Security.AccessControl (6.0.1) - System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (== net6.0) (>= net461)) (== netstandard2.0) - System.Security.Cryptography.Cng (5.0) - System.Formats.Asn1 (>= 5.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.0)) - System.Security.Cryptography.Pkcs (9.0) - Microsoft.Bcl.Cryptography (>= 9.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) - System.Formats.Asn1 (>= 9.0) - System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (< netstandard2.1)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Security.Cryptography.Cng (>= 5.0) - System.Security.Cryptography.ProtectedData (9.0) - System.Memory (>= 4.5.5) - System.Security.Principal.Windows (5.0) - System.Text.Encoding.CodePages (9.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (9.0) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (>= net472)) (&& (== net6.0) (< net5.0)) (== netstandard2.0) - System.Buffers (>= 4.5.1) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Json (9.0) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< net5.0)) (== netstandard2.0) - Microsoft.Bcl.AsyncInterfaces (>= 9.0) - System.Buffers (>= 4.5.1) - System.IO.Pipelines (>= 9.0) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (>= 9.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - System.Threading.Tasks.Extensions (4.6) - restriction: || (&& (== net6.0) (>= net472)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (>= uap10.1)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.1) - restriction: || (&& (== net6.0) (>= net462)) (&& (== net6.0) (< netcoreapp2.1)) (== netstandard2.0) diff --git a/fake.cmd b/fake.cmd deleted file mode 100644 index 72bbc3e..0000000 --- a/fake.cmd +++ /dev/null @@ -1,2 +0,0 @@ -dotnet tool restore -dotnet fake %* \ No newline at end of file diff --git a/fake.sh b/fake.sh deleted file mode 100755 index bc92bc9..0000000 --- a/fake.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -eu -set -o pipefail - -dotnet tool restore -dotnet fake "$@" \ No newline at end of file