<commit_before>﻿[<AutoOpen>]
module Fake.AdditionalSyntax

open System.Collections.Generic

/// Allows to use Tokens instead of strings
let (?) f s = f s

/// Allows to use Tokens instead of strings for TargetNames
let (?<-) f str action = f str action

/// Allows to use For? syntax for Dependencies
let For x y = x <== y

/// Converts a dependency into a list
let Dependency x = [x]

/// Appends the dependency to the list of dependencies
let And x y = y @ [x]

/// Runs a Target and its dependencies
let Run = run

/// Runs the target given by the build script parameter or the given default target
let RunParameterTargetOrDefault parameterName defaultTarget = getBuildParamOrDefault parameterName defaultTarget |> Run

/// Stores which targets are on the same level
let private sameLevels = new Dictionary<_,_>()

let targetsAreOnSameLevel x y =
    match sameLevels.TryGetValue y with
    | true, z -> failwithf "Target %s is already on same level with %s" x z
    | _  -> sameLevels.[y] <- x

let rec addDependenciesOnSameLevel target dependency =
    match sameLevels.TryGetValue dependency with
    | true, x -> 
        addDependenciesOnSameLevel target x
        Dependencies target [x]
    | _  -> ()

/// Defines a dependency - y is dependent on x
let inline (==>) x y =
    addDependenciesOnSameLevel y x 
    Dependencies y [x]

    y

/// Defines that x and y are not dependent on each other but y is dependent on all dependencies of x.
let inline (<=>) x y =   
    let target_x = getTarget x<commit_msg>Make use of the default "target" parameter<commit_after>﻿[<AutoOpen>]
module Fake.AdditionalSyntax

open System.Collections.Generic

/// Allows to use Tokens instead of strings
let (?) f s = f s

/// Allows to use Tokens instead of strings for TargetNames
let (?<-) f str action = f str action

/// Allows to use For? syntax for Dependencies
let For x y = x <== y

/// Converts a dependency into a list
let Dependency x = [x]

/// Appends the dependency to the list of dependencies
let And x y = y @ [x]

/// Runs a Target and its dependencies
let Run = run

/// Runs the target given by the build script parameter or the given default target
let RunParameterTargetOrDefault parameterName defaultTarget = getBuildParamOrDefault parameterName defaultTarget |> Run

/// Runs the target given by the target parameter or the given default target
let RunTargetOrDefault parameterName defaultTarget = getBuildParamOrDefault "target" defaultTarget |> Run

/// Runs the target given by the target parameter
let RunTarget parameterName defaultTarget = getBuildParam "target" |> Run

/// Stores which targets are on the same level
let private sameLevels = new Dictionary<_,_>()

let targetsAreOnSameLevel x y =
    match sameLevels.TryGetValue y with
    | true, z -> failwithf "Target %s is already on same level with %s" x z
    | _  -> sameLevels.[y] <- x

let rec addDependenciesOnSameLevel target dependency =
    match sameLevels.TryGetValue dependency with
    | true, x -> 
        addDependenciesOnSameLevel target x
        Dependencies target [x]
    | _  -> ()

/// Defines a dependency - y is dependent on x
let inline (==>) x y =
    addDependenciesOnSameLevel y x 
    Dependencies y [x]

    y

/// Defines that x and y are not dependent on each other but y is dependent on all dependencies of x.
let inline (<=>) x y =   
    let target_x = getTarget x
{'fraction_non_alphanumeric': 0.07694584196507842, 'fraction_numerical': 0.0, 'mean_word_length': 3.2947903430749683, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7539718', 'n_tokens_mistral': 972, 'n_tokens_neox': 931, 'n_words': 445}