<commit_before>﻿// include Fake lib
#r @"tools\FAKE\tools\FakeLib.dll"
open Fake 
open Fake.AssemblyInfoFile

// Assembly / NuGet package properties
let projectName = "canopy"
let version = "0.7.5"
let projectDescription = "A simple framework in f# on top of selenium for writing UI automation tests."
let authors = ["<NAME>"]

// Folders
let buildDir = @".\build\"
let testDir = @".\tests\"
let nugetDir = @".\nuget\"

// Targets

// Update assembly info
Target "UpdateAssemblyInfo" (fun _ ->
    CreateFSharpAssemblyInfo ".\AssemblyInfo.fs"
        [ Attribute.Product projectName
          Attribute.Title projectName
          Attribute.Description projectDescription
          Attribute.Version version ]
)

// Clean build directory
Target "Clean" (fun _ ->
    CleanDir buildDir
)

// Build Canopy
Target "BuildCanopy" (fun _ ->
    !! @"canopy\canopy.fsproj"
      |> MSBuildDebug buildDir "Build"
      |> Log "AppBuild-Output: "
)

// Clean tests directory
Target "CleanTests" (fun _ ->
    CleanDir testDir
)

// Test Canopy
Target "TestCanopy" (fun _ ->
    !! @"basictests\basictests.fsproj"
      |> MSBuildDebug testDir "Build"
      |> Log "AppBuild-Output: "
      
    let result =
        ExecProcess (fun info -> 
            info.FileName <- (testDir @@ "basictests.exe")
        ) (System.TimeSpan.FromMinutes 3.)
    if result <> 0 then failwith "Failed result from basictests"
)

// Clean NuGet directory
Target "CleanNuGet" (fun _ ->
    CleanDir nugetDir
)

// Create NuGet package
Target "CreateNuGet" (fun _ ->     
    XCopy @".\build\" (nugetDir @@ "lib")

    "canopy.nuspec"
      |> NuGet (fun p -> 
            {p with
                Project = projectName
                Authors = authors
                Version = version
                Description = projectDescription
                NoPackageAnalysis = true
                ToolPath = @".\tools\Nuget\Nuget.exe" 
                OutputPath = nugetDir })
)

// Default target
Target "Default" (fun _ ->
    trace "Building canopy"
)

// Dependencies
"UpdateAssemblyInfo"
  ==> "CleanTests"
  ==> "TestCanopy"
  ==> "Clean"
  ==> "BuildCanopy"
  ==> "CleanNuGet"
  ==> "CreateNuGet"
  ==> "Default"

// start build
Run "Default"<commit_msg>Selenium binaries was excluded from NuGet package<commit_after>﻿// include Fake lib
#r @"tools\FAKE\tools\FakeLib.dll"
open Fake 
open Fake.AssemblyInfoFile

// Assembly / NuGet package properties
let projectName = "canopy"
let version = "0.7.5"
let projectDescription = "A simple framework in f# on top of selenium for writing UI automation tests."
let authors = ["<NAME>"]

// Folders
let buildDir = @".\build\"
let testDir = @".\tests\"
let nugetDir = @".\nuget\"

// Targets

// Update assembly info
Target "UpdateAssemblyInfo" (fun _ ->
    CreateFSharpAssemblyInfo ".\AssemblyInfo.fs"
        [ Attribute.Product projectName
          Attribute.Title projectName
          Attribute.Description projectDescription
          Attribute.Version version ]
)

// Clean build directory
Target "Clean" (fun _ ->
    CleanDir buildDir
)

// Build Canopy
Target "BuildCanopy" (fun _ ->
    !! @"canopy\canopy.fsproj"
      |> MSBuildDebug buildDir "Build"
      |> Log "AppBuild-Output: "
)

// Clean tests directory
Target "CleanTests" (fun _ ->
    CleanDir testDir
)

// Test Canopy
Target "TestCanopy" (fun _ ->
    !! @"basictests\basictests.fsproj"
      |> MSBuildDebug testDir "Build"
      |> Log "AppBuild-Output: "
      
    let result =
        ExecProcess (fun info -> 
            info.FileName <- (testDir @@ "basictests.exe")
        ) (System.TimeSpan.FromMinutes 3.)
    if result <> 0 then failwith "Failed result from basictests"
)

// Clean NuGet directory
Target "CleanNuGet" (fun _ ->
    CleanDir nugetDir
)

// Create NuGet package
Target "CreateNuGet" (fun _ ->     
    XCopy @".\build\" (nugetDir @@ "lib")
    !+ @"nuget/lib/*.*"
        -- @"nuget/lib/canopy*.*"
        |> ScanImmediately
        |> Seq.iter (System.IO.File.Delete)

    "canopy.nuspec"
      |> NuGet (fun p -> 
            {p with
                Project = projectName
                Authors = authors
                Version = version
                Description = projectDescription
                NoPackageAnalysis = true
                ToolPath = @".\tools\Nuget\Nuget.exe" 
                OutputPath = nugetDir })
)

// Default target
Target "Default" (fun _ ->
    trace "Building canopy"
)

// Dependencies
"UpdateAssemblyInfo"
  ==> "CleanTests"
  ==> "TestCanopy"
  ==> "Clean"
  ==> "BuildCanopy"
  ==> "CleanNuGet"
  ==> "CreateNuGet"
  ==> "Default"

// start build
Run "Default"
{'fraction_non_alphanumeric': 0.12724518502488638, 'fraction_numerical': 0.002164033758926639, 'mean_word_length': 2.398529411764706, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 53, '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': '6656190', 'n_tokens_mistral': 1488, 'n_tokens_neox': 1404, 'n_words': 374}