Fake.StrongTargets
0.2.0
dotnet add package Fake.StrongTargets --version 0.2.0
NuGet\Install-Package Fake.StrongTargets -Version 0.2.0
<PackageReference Include="Fake.StrongTargets" Version="0.2.0" />
paket add Fake.StrongTargets --version 0.2.0
#r "nuget: Fake.StrongTargets, 0.2.0"
// Install Fake.StrongTargets as a Cake Addin #addin nuget:?package=Fake.StrongTargets&version=0.2.0 // Install Fake.StrongTargets as a Cake Tool #tool nuget:?package=Fake.StrongTargets&version=0.2.0
Fake.Targets.Strong
Improve compiler safety by refering to FAKE targets as values, not strings.
Example
Basic Project-based
See build.fs
A short sample is
open Fake.StrongTargets
let clean =
Target.ByRef.create "clean" <| fun _ ->
//...
let build =
Target.ByRef.create "build" <| fun _ ->
//...
|> Target.ByRef.dependsOn [clean]
Targets.ByRef.runOrDefault build
Note that creating a target still results in a global target registration.
Shorter Module Path
If you don't like writing Target.ByRef.methodName
or just ByRef.methodName
then you can alias the module
module TRef = Target.ByRef
let clean = TRef.create "clean" ...
Fsx/script usage
Usage in a script-based build is the same, just reference the nuget package.
#r "paket:
nuget Fake.StrongTargets //"
open Fake.StrongTargets
...
Separated Build Dependencies
I showed Target dependencies specified alongside target declaration, but they can as easily be separated
// open the module just for brevity sake
open open Fake.StrongTargets.Target.ByRef
// declare deps as a single tree
default'
|> dependsOn [
clean
test |> dependsOn [
build |> dependsOn [clean]
]
]
|> ignore
This approach can also be used for different dependencies based on different conditional statements.
Operators
There are also operators defined in Fake.StrongTargets.Operators
equivalent to the basic fake operators
- left depends
dependent <== [dependencies]
- right depends
dependency ==> dependent
- left soft depends
dependent <=? dependency
- right soft depends
dependency ?=> dependent
So you could still define target dependencies similar to what is normally shown in the Fake docs.
open Fake.StrongTargets.Operators
clean ==> build ==> test ==> default'
Note that you can't use both the string-based operators and these operators at the same time because the definitions conflict
Project Status
This repo is a proof of concept, but it works and is low risk since it just aliases a few commands in Fake.Core.Targets.
If it's popular enough I may contribute it to FAKE and/or pursue an API that separates target declaration from global registration. Feedback is appreciated!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Fake.Core.Target (>= 5.23.1)
- FSharp.Core (>= 6.0.7)
-
net6.0
- Fake.Core.Target (>= 5.23.1)
- FSharp.Core (>= 6.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.