fsprojects / FAKE

FAKE - F# Make
https://fake.build
Other
1.28k stars 582 forks source link

add Context.setExecutionContextFromCommandLineArgs #2750

Open cataggar opened 1 year ago

cataggar commented 1 year ago

This moves this boilerplate into a function. A minimal build script that works on .NET 6 & .NET 7 with Visual Studio IntelliSense and works with private NuGet feeds will now be:

#!/usr/bin/env -S dotnet fsi
#r "nuget: Fake.Core.Target"

Fake.Core.Context.setExecutionContextFromCommandLineArgs __SOURCE_FILE__

open Fake.Core

Target.create "clean" (fun _ ->
  Trace.log "Cleaning stuff"
)

Target.create "build" (fun _ ->
  Trace.log "Building the app"
)

Target.create "deploy" (fun _ ->
  Trace.log "Deploying app"
)

open Fake.Core.TargetOperators

"clean"
  ==> "build"
  ==> "deploy"

Target.runOrList()

This can be run with dotnet fsi build.fsx. On Linux or Mac OSX, this can be run with ./buid.fsx as well.

xperiandri commented 8 months ago

What if executed not from the script?

xperiandri commented 8 months ago

Maybe it must be in the separate package?