davidontop/build.fsx
2025-06-12 14:33:59 +02:00

48 lines
No EOL
1 KiB
FSharp
Executable file

#!/usr/bin/env -S dotnet fsi
open System.Diagnostics
let run cmd args =
use p = new Process()
p.StartInfo.FileName <- cmd
p.StartInfo.Arguments <- args
p.StartInfo.UseShellExecute <- false
p.Start() |> ignore
p.WaitForExit()
if p.ExitCode <> 0 then
failwithf "Command '%s %s' failed with exit code %d.\n" cmd args p.ExitCode
if not (System.IO.File.Exists ".restored") then
run "dotnet" "tool restore"
run "dotnet" "paket restore"
run "bun" "i"
System.IO.File.WriteAllText(".restored", "")
#load @".paket/load/net9.0/Build/build.group.fsx"
open Fake.Core
let args =
System.Environment.GetCommandLineArgs()
|> Array.skip 2
args
|> Array.toList
|> Context.FakeExecutionContext.Create false "build.fsx"
|> Context.RuntimeContext.Fake
|> Context.setExecutionContext
#load "fake.fsx"
Target.create "list" (fun _ ->
printfn "\n\n"
Target.listAvailable()
printfn "\n\n"
)
let cmd =
args
|> Array.tryItem 0
|> Option.defaultValue "list"
Target.runOrDefaultWithArguments cmd