Skip to content

Commit

Permalink
Groupref in build.fsx
Browse files Browse the repository at this point in the history
  • Loading branch information
haf committed Sep 16, 2019
1 parent 92f4f62 commit b1276be
Show file tree
Hide file tree
Showing 3 changed files with 903 additions and 37 deletions.
62 changes: 28 additions & 34 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#r "paket:
nuget Fake.Core.Xml
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket
nuget Fake.Tools.Git
nuget Fake.Api.GitHub
nuget Fake.Core.Target
nuget Fake.Core.Environment
nuget Fake.Core.UserInput
nuget Fake.DotNet.AssemblyInfoFile
nuget Fake.BuildServer.AppVeyor
nuget Fake.BuildServer.Travis
nuget Fake.Core.ReleaseNotes //"
#r "paket: groupref Build //"

#load "./.fake/build.fsx/intellisense.fsx"
#load "paket-files/eiriktsarpalis/snippets/SlnTools/SlnTools.fs"
#load "paket-files/build/eiriktsarpalis/snippets/SlnTools/SlnTools.fs"
#if !FAKE
#r "netstandard"
#r "facades/netstandard"
Expand All @@ -30,7 +19,11 @@ open Fake.IO.Globbing.Operators
open Fake.BuildServer

Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let configuration = Environment.environVarOrDefault "Configuration" "Release"

let configuration =
Environment.environVarOrDefault "CONFIGURATION" "Release"
|> DotNet.BuildConfiguration.fromString

let release = ReleaseNotes.load "RELEASE_NOTES.md"
let description = "Advanced testing library for F#"
let tags = "test testing fsharp assert expect stress performance unit random property"
Expand Down Expand Up @@ -59,6 +52,16 @@ let libProjects =
++ "Expecto.Hopac/*.fsproj"
++ "Expecto.TestResults/*.fsproj"

let testProjects =
!! "Expecto.Tests/*.Tests.fsproj"
++ "Expecto.Hopac.Tests/*.Tests.fsproj"
++ "Expecto.Tests.CSharp/*.Tests.CSharp.csproj"
++ "Expecto.Focused.Tests/*.Tests.fsproj"

let benchmarkProjects =
!! "Expecto.BenchmarkDotNet/*.fsproj"
++ "Expecto.BenchmarkDotNet.Tests/*.fsproj"

let pkgPath = Path.GetFullPath "./pkg"

Target.create "Clean" <| fun _ ->
Expand Down Expand Up @@ -103,41 +106,33 @@ Target.create "ProjectVersion" (fun _ ->
setProjectVersion "Expecto.Hopac"
setProjectVersion "Expecto.TestResults"
)

let build project =
DotNet.build (fun p ->
{ p with
Configuration = DotNet.BuildConfiguration.Custom configuration
Common = DotNet.Options.withDotNetCliPath dotnetExePath p.Common
|> DotNet.Options.withCustomParams (Some "--no-dependencies")
}) project
DotNet.build (fun p ->
{ p with Configuration = configuration
Common = DotNet.Options.withDotNetCliPath dotnetExePath p.Common })
project

Target.create "BuildExpecto" (fun _ ->
build "Expecto/Expecto.fsproj"
build "Expecto.TestResults/Expecto.TestResults.fsproj"
build "Expecto.Hopac/Expecto.Hopac.fsproj"
build "Expecto.FsCheck/Expecto.FsCheck.fsproj"
build (SlnTools.createTempSolutionFile libProjects)
)

Target.create "BuildBenchmarkDotNet" (fun _ ->
build "Expecto.BenchmarkDotNet/Expecto.BenchmarkDotNet.fsproj"
build "Expecto.BenchmarkDotNet.Tests/Expecto.BenchmarkDotNet.Tests.fsproj"
build (SlnTools.createTempSolutionFile benchmarkProjects)
)

Target.create "BuildTest" (fun _ ->
build "Expecto.Tests/Expecto.Tests.fsproj"
build "Expecto.Hopac.Tests/Expecto.Hopac.Tests.fsproj"
build "Expecto.Tests.CSharp/Expecto.Tests.CSharp.csproj"
build "Expecto.Focused.Tests/Expecto.Focused.Tests.fsproj"
build (SlnTools.createTempSolutionFile testProjects)
)

Target.create "RunTest" <| fun _ ->

let runTest project =
DotNet.exec (DotNet.Options.withDotNetCliPath dotnetExePath)
(project+"/bin/"+configuration+"/netcoreapp2.1/"+project+".dll")
(sprintf "%s/bin/%O/netcoreapp2.1/%s.dll" project configuration project)
"--summary"
|> fun r -> if r.ExitCode<>0 then project+".dll failed" |> failwith
let exeName = project+"/bin/"+configuration+"/net461/"+project+".exe"
let exeName = sprintf "%s/bin/%O/net461/%s.exe" project configuration project
let filename, arguments =
let args = "--colours 0 --summary"
if Environment.isWindows then exeName, args
Expand Down Expand Up @@ -204,7 +199,6 @@ Target.create "CheckEnv" <| fun _ ->
ignore (envRequired "GITHUB_TOKEN")
ignore (envRequired "NUGET_TOKEN")


Target.create "Release" (fun _ ->
let gitOwner = "haf"
let gitName = "expecto"
Expand Down
24 changes: 22 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source https://api.nuget.org/v3/index.json
framework net461, netstandard2.0, netcoreapp2.0, netcoreapp2.1
storage:none
storage: none
clitool paket
version 5.219.0

Expand All @@ -10,4 +10,24 @@ nuget Hopac ~> 0.3
nuget Mono.Cecil ~> 0.10
nuget BenchmarkDotNet 0.10.14

github eiriktsarpalis/snippets SlnTools/SlnTools.fs
group Build
source https://api.nuget.org/v3/index.json
storage none
framework auto-detect

nuget FSharp.Core ~> 4.6.0
nuget Fake.Api.GitHub
nuget Fake.BuildServer.AppVeyor
nuget Fake.BuildServer.Travis
nuget Fake.Core.ReleaseNotes
nuget Fake.Core.Target
nuget Fake.Core.Xml
nuget Fake.DotNet.AssemblyInfoFile
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket
nuget Fake.IO.FileSystem
nuget Fake.IO.Zip
nuget Fake.Tools.Git
nuget Fake.Tools.Octo

github eiriktsarpalis/snippets SlnTools/SlnTools.fs
Loading

0 comments on commit b1276be

Please sign in to comment.